aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CurrentWindowCmd.cc9
-rw-r--r--src/Keys.cc2
-rw-r--r--src/Screen.cc3
-rw-r--r--src/Window.cc13
4 files changed, 25 insertions, 2 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index 58ec78c..01b8de7 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -26,6 +26,7 @@
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28#include "Window.hh" 28#include "Window.hh"
29#include "WindowCmd.hh"
29#include "Screen.hh" 30#include "Screen.hh"
30#include "WinClient.hh" 31#include "WinClient.hh"
31 32
@@ -33,7 +34,7 @@
33 34
34void WindowHelperCmd::execute() { 35void WindowHelperCmd::execute() {
35 m_win = 0; 36 m_win = 0;
36 if (FocusControl::focusedFbWindow()) // guarantee that fbwindow() exists too 37 if (WindowCmd<void>::window() || FocusControl::focusedFbWindow())
37 real_execute(); 38 real_execute();
38} 39}
39 40
@@ -44,7 +45,11 @@ void WindowHelperCmd::execute(FluxboxWindow &win) {
44 45
45FluxboxWindow &WindowHelperCmd::fbwindow() { 46FluxboxWindow &WindowHelperCmd::fbwindow() {
46 // will exist from execute above 47 // will exist from execute above
47 return (m_win ? *m_win : *FocusControl::focusedFbWindow()); 48 if (m_win)
49 return *m_win;
50 FluxboxWindow *tmp = WindowCmd<void>::window();
51 if (tmp) return *tmp;
52 return *FocusControl::focusedFbWindow();
48} 53}
49 54
50void CurrentWindowCmd::real_execute() { 55void CurrentWindowCmd::real_execute() {
diff --git a/src/Keys.cc b/src/Keys.cc
index 6d13cd4..34d5cc0 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -301,6 +301,8 @@ bool Keys::addBinding(const string &linebuffer) {
301 context |= ON_DESKTOP; 301 context |= ON_DESKTOP;
302 else if (strcasecmp("ontoolbar", val[argc].c_str()) == 0) 302 else if (strcasecmp("ontoolbar", val[argc].c_str()) == 0)
303 context |= ON_TOOLBAR; 303 context |= ON_TOOLBAR;
304 else if (strcasecmp("onwindow", val[argc].c_str()) == 0)
305 context |= ON_WINDOW;
304 else if (strcasecmp("NONE",val[argc].c_str())) { 306 else if (strcasecmp("NONE",val[argc].c_str())) {
305 // check if it's a mouse button 307 // check if it's a mouse button
306 if (!strcasecmp(val[argc].substr(0,5).c_str(), "mouse") && 308 if (!strcasecmp(val[argc].substr(0,5).c_str(), "mouse") &&
diff --git a/src/Screen.cc b/src/Screen.cc
index d843a53..5549ca5 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -30,6 +30,7 @@
30#include "fluxbox.hh" 30#include "fluxbox.hh"
31#include "Keys.hh" 31#include "Keys.hh"
32#include "Window.hh" 32#include "Window.hh"
33#include "WindowCmd.hh"
33#include "Workspace.hh" 34#include "Workspace.hh"
34 35
35#include "Layer.hh" 36#include "Layer.hh"
@@ -827,6 +828,7 @@ void BScreen::propertyNotify(Atom atom) {
827 828
828void BScreen::keyPressEvent(XKeyEvent &ke) { 829void BScreen::keyPressEvent(XKeyEvent &ke) {
829 if (!m_typing_ahead) { 830 if (!m_typing_ahead) {
831 WindowCmd<void>::setWindow(FocusControl::focusedFbWindow());
830 Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, 832 Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode,
831 Keys::GLOBAL|Keys::ON_DESKTOP); 833 Keys::GLOBAL|Keys::ON_DESKTOP);
832 return; 834 return;
@@ -882,6 +884,7 @@ void BScreen::buttonPressEvent(XButtonEvent &be) {
882 imageControl().installRootColormap(); 884 imageControl().installRootColormap();
883 885
884 Keys *keys = Fluxbox::instance()->keys(); 886 Keys *keys = Fluxbox::instance()->keys();
887 WindowCmd<void>::setWindow(FocusControl::focusedFbWindow());
885 keys->doAction(be.type, be.state, be.button, Keys::GLOBAL|Keys::ON_DESKTOP); 888 keys->doAction(be.type, be.state, be.button, Keys::GLOBAL|Keys::ON_DESKTOP);
886} 889}
887 890
diff --git a/src/Window.cc b/src/Window.cc
index 27bc7ec..5e9aec5 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -28,6 +28,7 @@
28 28
29#include "WinClient.hh" 29#include "WinClient.hh"
30#include "fluxbox.hh" 30#include "fluxbox.hh"
31#include "Keys.hh"
31#include "Screen.hh" 32#include "Screen.hh"
32#include "FbWinFrameTheme.hh" 33#include "FbWinFrameTheme.hh"
33#include "FbAtoms.hh" 34#include "FbAtoms.hh"
@@ -285,6 +286,9 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
285 else 286 else
286 screen().focusControl().addFocusWinBack(*this); 287 screen().focusControl().addFocusWinBack(*this);
287 288
289 Fluxbox::instance()->keys()->registerWindow(frame().window().window(),
290 Keys::ON_WINDOW);
291
288} 292}
289 293
290 294
@@ -292,6 +296,8 @@ FluxboxWindow::~FluxboxWindow() {
292 if (WindowCmd<void>::window() == this) 296 if (WindowCmd<void>::window() == this)
293 WindowCmd<void>::setWindow(0); 297 WindowCmd<void>::setWindow(0);
294 298
299 Fluxbox::instance()->keys()->unregisterWindow(frame().window().window());
300
295#ifdef DEBUG 301#ifdef DEBUG
296 const char* title = m_client ? m_client->title().c_str() : "" ; 302 const char* title = m_client ? m_client->title().c_str() : "" ;
297 cerr<<__FILE__<<"("<<__LINE__<<"): starting ~FluxboxWindow("<<this<<","<<title<<")"<<endl; 303 cerr<<__FILE__<<"("<<__LINE__<<"): starting ~FluxboxWindow("<<this<<","<<title<<")"<<endl;
@@ -2576,6 +2582,13 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2576 m_last_button_x = be.x_root; 2582 m_last_button_x = be.x_root;
2577 m_last_button_y = be.y_root; 2583 m_last_button_y = be.y_root;
2578 2584
2585 // check keys file first
2586 WindowCmd<void>::setWindow(this);
2587 if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button,
2588 Keys::ON_WINDOW)) {
2589 return;
2590 }
2591
2579 // check frame events first 2592 // check frame events first
2580 frame().buttonPressEvent(be); 2593 frame().buttonPressEvent(be);
2581 2594