diff options
-rw-r--r-- | src/Keys.cc | 6 | ||||
-rw-r--r-- | src/Keys.hh | 5 | ||||
-rw-r--r-- | src/WinButton.cc | 34 |
3 files changed, 40 insertions, 5 deletions
diff --git a/src/Keys.cc b/src/Keys.cc index 072cba9..846edea 100644 --- a/src/Keys.cc +++ b/src/Keys.cc | |||
@@ -400,6 +400,12 @@ bool Keys::addBinding(const string &linebuffer) { | |||
400 | context |= ON_WINDOW; | 400 | context |= ON_WINDOW; |
401 | else if (arg == "ontitlebar") | 401 | else if (arg == "ontitlebar") |
402 | context |= ON_TITLEBAR; | 402 | context |= ON_TITLEBAR; |
403 | else if (arg == "onwinbutton") | ||
404 | context |= ON_WINBUTTON; | ||
405 | else if (arg == "onminbutton") | ||
406 | context |= ON_MINBUTTON; // one char diff, oh great ... ... blast! | ||
407 | else if (arg == "onmaxbutton") | ||
408 | context |= ON_MAXBUTTON; | ||
403 | else if (arg == "onwindowborder") | 409 | else if (arg == "onwindowborder") |
404 | context |= ON_WINDOWBORDER; | 410 | context |= ON_WINDOWBORDER; |
405 | else if (arg == "onleftgrip") | 411 | else if (arg == "onleftgrip") |
diff --git a/src/Keys.hh b/src/Keys.hh index 7a6b3b8..a12efdb 100644 --- a/src/Keys.hh +++ b/src/Keys.hh | |||
@@ -53,7 +53,10 @@ public: | |||
53 | ON_LEFTGRIP = 1 << 7, | 53 | ON_LEFTGRIP = 1 << 7, |
54 | ON_RIGHTGRIP = 1 << 8, | 54 | ON_RIGHTGRIP = 1 << 8, |
55 | ON_TAB = 1 << 9, | 55 | ON_TAB = 1 << 9, |
56 | ON_SLIT = 1 << 10 | 56 | ON_SLIT = 1 << 10, |
57 | ON_WINBUTTON = 1 << 11, | ||
58 | ON_MINBUTTON = 1 << 12, | ||
59 | ON_MAXBUTTON = 1 << 13 | ||
57 | // and so on... | 60 | // and so on... |
58 | }; | 61 | }; |
59 | 62 | ||
diff --git a/src/WinButton.cc b/src/WinButton.cc index c790a03..0cd2cfb 100644 --- a/src/WinButton.cc +++ b/src/WinButton.cc | |||
@@ -20,6 +20,8 @@ | |||
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | #include "WinButton.hh" | 22 | #include "WinButton.hh" |
23 | #include "fluxbox.hh" | ||
24 | #include "Keys.hh" | ||
23 | #include "Window.hh" | 25 | #include "Window.hh" |
24 | #include "WindowCmd.hh" | 26 | #include "WindowCmd.hh" |
25 | #include "Screen.hh" | 27 | #include "Screen.hh" |
@@ -27,6 +29,8 @@ | |||
27 | #include "WinButtonTheme.hh" | 29 | #include "WinButtonTheme.hh" |
28 | #include "FbTk/App.hh" | 30 | #include "FbTk/App.hh" |
29 | #include "FbTk/Color.hh" | 31 | #include "FbTk/Color.hh" |
32 | #include "FbTk/Command.hh" | ||
33 | #include "FbTk/RefCount.hh" | ||
30 | 34 | ||
31 | #ifdef SHAPE | 35 | #ifdef SHAPE |
32 | #include <X11/extensions/shape.h> | 36 | #include <X11/extensions/shape.h> |
@@ -56,11 +60,33 @@ void WinButton::exposeEvent(XExposeEvent &event) { | |||
56 | drawType(); | 60 | drawType(); |
57 | } | 61 | } |
58 | 62 | ||
59 | void WinButton::buttonReleaseEvent(XButtonEvent &event) { | 63 | void WinButton::buttonReleaseEvent(XButtonEvent &be) { |
60 | WinClient *old = WindowCmd<void>::client(); | 64 | bool didCustomAction = false; |
65 | if (isPressed() && be.button > 0 && be.button <= 5 && | ||
66 | be.x >= -static_cast<signed>(borderWidth()) && | ||
67 | be.x <= static_cast<signed>(width()+borderWidth()) && | ||
68 | be.y >= -static_cast<signed>(borderWidth()) && | ||
69 | be.y <= static_cast<signed>(height()+borderWidth())) { | ||
70 | int context = Keys::ON_WINBUTTON; | ||
71 | if (m_type == MINIMIZE) | ||
72 | context = Keys::ON_MINBUTTON; | ||
73 | if (m_type == MAXIMIZE) | ||
74 | context = Keys::ON_MAXBUTTON; | ||
75 | Keys *k = Fluxbox::instance()->keys(); | ||
76 | didCustomAction = k->doAction(be.type, be.state, be.button, context, &m_listen_to.winClient(), be.time); | ||
77 | } | ||
78 | static FbTk::RefCount<FbTk::Command<void> > noop = FbTk::RefCount<FbTk::Command<void> >(0); | ||
79 | FbTk::RefCount<FbTk::Command<void> > oldCmd; | ||
80 | if (didCustomAction) { | ||
81 | oldCmd = command(be.button); | ||
82 | setOnClick(noop, be.button); | ||
83 | } | ||
84 | WinClient *oldClient = WindowCmd<void>::client(); | ||
61 | WindowCmd<void>::setWindow(&m_listen_to); | 85 | WindowCmd<void>::setWindow(&m_listen_to); |
62 | FbTk::Button::buttonReleaseEvent(event); | 86 | FbTk::Button::buttonReleaseEvent(be); |
63 | WindowCmd<void>::setClient(old); | 87 | WindowCmd<void>::setClient(oldClient); |
88 | if (didCustomAction) | ||
89 | setOnClick(oldCmd, be.button); | ||
64 | } | 90 | } |
65 | 91 | ||
66 | // when someone else tries to set the background, we may override it | 92 | // when someone else tries to set the background, we may override it |