diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-09-28 08:26:21 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-09-28 08:26:21 (GMT) |
commit | 04a1d2a83b96eb6d1b1958e4f3e25ffdf295aa4d (patch) | |
tree | efeb502c24025cd090629ae36d330fa882a41403 /src/FbTk/EventManager.cc | |
parent | c8022b3bdb90259352d08838576e98b559a9db68 (diff) | |
download | fluxbox_pavel-04a1d2a83b96eb6d1b1958e4f3e25ffdf295aa4d.zip fluxbox_pavel-04a1d2a83b96eb6d1b1958e4f3e25ffdf295aa4d.tar.bz2 |
don't let KeyRelease events propagate to windows
Diffstat (limited to 'src/FbTk/EventManager.cc')
-rw-r--r-- | src/FbTk/EventManager.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc index 31d0293..ae52908 100644 --- a/src/FbTk/EventManager.cc +++ b/src/FbTk/EventManager.cc | |||
@@ -65,25 +65,14 @@ EventHandler *EventManager::find(Window win) { | |||
65 | return m_eventhandlers[win]; | 65 | return m_eventhandlers[win]; |
66 | } | 66 | } |
67 | 67 | ||
68 | bool EventManager::grabKeyboard(EventHandler &ev, Window win) { | 68 | bool EventManager::grabKeyboard(Window win) { |
69 | if (m_grabbing_keyboard) | ||
70 | ungrabKeyboard(); | ||
71 | |||
72 | int ret = XGrabKeyboard(App::instance()->display(), win, False, | 69 | int ret = XGrabKeyboard(App::instance()->display(), win, False, |
73 | GrabModeAsync, GrabModeAsync, CurrentTime); | 70 | GrabModeAsync, GrabModeAsync, CurrentTime); |
74 | 71 | return (ret == Success); | |
75 | if (ret == Success) { | ||
76 | m_grabbing_keyboard = &ev; | ||
77 | return true; | ||
78 | } | ||
79 | return false; | ||
80 | } | 72 | } |
81 | 73 | ||
82 | void EventManager::ungrabKeyboard() { | 74 | void EventManager::ungrabKeyboard() { |
83 | XUngrabKeyboard(App::instance()->display(), CurrentTime); | 75 | XUngrabKeyboard(App::instance()->display(), CurrentTime); |
84 | if (m_grabbing_keyboard) | ||
85 | m_grabbing_keyboard->notifyUngrabKeyboard(); | ||
86 | m_grabbing_keyboard = 0; | ||
87 | } | 76 | } |
88 | 77 | ||
89 | Window EventManager::getEventWindow(XEvent &ev) { | 78 | Window EventManager::getEventWindow(XEvent &ev) { |
@@ -190,10 +179,14 @@ void EventManager::dispatch(Window win, XEvent &ev, bool parent) { | |||
190 | evhand->exposeEvent(ev.xexpose); | 179 | evhand->exposeEvent(ev.xexpose); |
191 | break; | 180 | break; |
192 | case EnterNotify: | 181 | case EnterNotify: |
193 | evhand->enterNotifyEvent(ev.xcrossing); | 182 | if (ev.xcrossing.mode != NotifyGrab && |
183 | ev.xcrossing.mode != NotifyUngrab) | ||
184 | evhand->enterNotifyEvent(ev.xcrossing); | ||
194 | break; | 185 | break; |
195 | case LeaveNotify: | 186 | case LeaveNotify: |
196 | evhand->leaveNotifyEvent(ev.xcrossing); | 187 | if (ev.xcrossing.mode != NotifyGrab && |
188 | ev.xcrossing.mode != NotifyUngrab) | ||
189 | evhand->leaveNotifyEvent(ev.xcrossing); | ||
197 | break; | 190 | break; |
198 | default: | 191 | default: |
199 | evhand->handleEvent(ev); | 192 | evhand->handleEvent(ev); |