aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-09-28 08:26:21 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-09-28 08:26:21 (GMT)
commit04a1d2a83b96eb6d1b1958e4f3e25ffdf295aa4d (patch)
treeefeb502c24025cd090629ae36d330fa882a41403 /src/FbTk
parentc8022b3bdb90259352d08838576e98b559a9db68 (diff)
downloadfluxbox-04a1d2a83b96eb6d1b1958e4f3e25ffdf295aa4d.zip
fluxbox-04a1d2a83b96eb6d1b1958e4f3e25ffdf295aa4d.tar.bz2
don't let KeyRelease events propagate to windows
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/EventHandler.hh1
-rw-r--r--src/FbTk/EventManager.cc23
-rw-r--r--src/FbTk/EventManager.hh3
3 files changed, 9 insertions, 18 deletions
diff --git a/src/FbTk/EventHandler.hh b/src/FbTk/EventHandler.hh
index 39ea294..b78e344 100644
--- a/src/FbTk/EventHandler.hh
+++ b/src/FbTk/EventHandler.hh
@@ -56,7 +56,6 @@ public:
56 virtual void leaveNotifyEvent(XCrossingEvent &) { } 56 virtual void leaveNotifyEvent(XCrossingEvent &) { }
57 virtual void enterNotifyEvent(XCrossingEvent &) { } 57 virtual void enterNotifyEvent(XCrossingEvent &) { }
58 58
59 virtual void notifyUngrabKeyboard() { }
60 virtual void grabButtons() { } 59 virtual void grabButtons() { }
61}; 60};
62 61
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
68bool EventManager::grabKeyboard(EventHandler &ev, Window win) { 68bool 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
82void EventManager::ungrabKeyboard() { 74void 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
89Window EventManager::getEventWindow(XEvent &ev) { 78Window 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);
diff --git a/src/FbTk/EventManager.hh b/src/FbTk/EventManager.hh
index 79a25ce..fdcfe9c 100644
--- a/src/FbTk/EventManager.hh
+++ b/src/FbTk/EventManager.hh
@@ -42,9 +42,8 @@ public:
42 void add(EventHandler &ev, Window win) { registerEventHandler(ev, win); } 42 void add(EventHandler &ev, Window win) { registerEventHandler(ev, win); }
43 void remove(Window win) { unregisterEventHandler(win); } 43 void remove(Window win) { unregisterEventHandler(win); }
44 44
45 bool grabKeyboard(EventHandler &ev, Window win); 45 bool grabKeyboard(Window win);
46 void ungrabKeyboard(); 46 void ungrabKeyboard();
47 EventHandler *grabbingKeyboard() { return m_grabbing_keyboard; }
48 47
49 EventHandler *find(Window win); 48 EventHandler *find(Window win);
50 49