all repos — fluxbox @ 72130f350ef08c6200d18e544b861940cbcb7526

custom fork of the fluxbox windowmanager

add OnWindow modifier to keys file
markt markt
commit

72130f350ef08c6200d18e544b861940cbcb7526

parent

7e4f8a38531642cc9cb6cba31499d549f4c5f8a0

5 files changed, 28 insertions(+), 2 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 1.0.1: +*07/10/15: + * Added OnWindow modifier to keys file (Mark) + Keys.cc Window.cc Screen.cc CurrentWindowCmd.cc *07/10/14: * Added support for transient windows in window patterns, e.g. (transient=yes|no), defaulting to "no" for the apps file (Mark)
M src/CurrentWindowCmd.ccsrc/CurrentWindowCmd.cc

@@ -26,6 +26,7 @@ #include "CurrentWindowCmd.hh"

#include "fluxbox.hh" #include "Window.hh" +#include "WindowCmd.hh" #include "Screen.hh" #include "WinClient.hh"

@@ -33,7 +34,7 @@ #include "FocusControl.hh"

void WindowHelperCmd::execute() { m_win = 0; - if (FocusControl::focusedFbWindow()) // guarantee that fbwindow() exists too + if (WindowCmd<void>::window() || FocusControl::focusedFbWindow()) real_execute(); }

@@ -44,7 +45,11 @@ }

FluxboxWindow &WindowHelperCmd::fbwindow() { // will exist from execute above - return (m_win ? *m_win : *FocusControl::focusedFbWindow()); + if (m_win) + return *m_win; + FluxboxWindow *tmp = WindowCmd<void>::window(); + if (tmp) return *tmp; + return *FocusControl::focusedFbWindow(); } void CurrentWindowCmd::real_execute() {
M src/Keys.ccsrc/Keys.cc

@@ -301,6 +301,8 @@ else if (strcasecmp("ondesktop", val[argc].c_str()) == 0)

context |= ON_DESKTOP; else if (strcasecmp("ontoolbar", val[argc].c_str()) == 0) context |= ON_TOOLBAR; + else if (strcasecmp("onwindow", val[argc].c_str()) == 0) + context |= ON_WINDOW; else if (strcasecmp("NONE",val[argc].c_str())) { // check if it's a mouse button if (!strcasecmp(val[argc].substr(0,5).c_str(), "mouse") &&
M src/Screen.ccsrc/Screen.cc

@@ -30,6 +30,7 @@

#include "fluxbox.hh" #include "Keys.hh" #include "Window.hh" +#include "WindowCmd.hh" #include "Workspace.hh" #include "Layer.hh"

@@ -827,6 +828,7 @@ }

void BScreen::keyPressEvent(XKeyEvent &ke) { if (!m_typing_ahead) { + WindowCmd<void>::setWindow(FocusControl::focusedFbWindow()); Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, Keys::GLOBAL|Keys::ON_DESKTOP); return;

@@ -882,6 +884,7 @@ if (be.button == 1 && !isRootColormapInstalled())

imageControl().installRootColormap(); Keys *keys = Fluxbox::instance()->keys(); + WindowCmd<void>::setWindow(FocusControl::focusedFbWindow()); keys->doAction(be.type, be.state, be.button, Keys::GLOBAL|Keys::ON_DESKTOP); }
M src/Window.ccsrc/Window.cc

@@ -28,6 +28,7 @@ #include "Window.hh"

#include "WinClient.hh" #include "fluxbox.hh" +#include "Keys.hh" #include "Screen.hh" #include "FbWinFrameTheme.hh" #include "FbAtoms.hh"

@@ -285,12 +286,17 @@ screen().focusControl().addFocusWinFront(*this);

else screen().focusControl().addFocusWinBack(*this); + Fluxbox::instance()->keys()->registerWindow(frame().window().window(), + Keys::ON_WINDOW); + } FluxboxWindow::~FluxboxWindow() { if (WindowCmd<void>::window() == this) WindowCmd<void>::setWindow(0); + + Fluxbox::instance()->keys()->unregisterWindow(frame().window().window()); #ifdef DEBUG const char* title = m_client ? m_client->title().c_str() : "" ;

@@ -2575,6 +2581,13 @@

void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { m_last_button_x = be.x_root; m_last_button_y = be.y_root; + + // check keys file first + WindowCmd<void>::setWindow(this); + if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button, + Keys::ON_WINDOW)) { + return; + } // check frame events first frame().buttonPressEvent(be);