aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/EventManager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/EventManager.cc')
-rw-r--r--src/FbTk/EventManager.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc
index 02259ac..fd26950 100644
--- a/src/FbTk/EventManager.cc
+++ b/src/FbTk/EventManager.cc
@@ -66,6 +66,26 @@ EventHandler *EventManager::find(Window win) {
66 return m_eventhandlers[win]; 66 return m_eventhandlers[win];
67} 67}
68 68
69bool EventManager::grabKeyboard(EventHandler &ev, Window win) {
70 if (m_grabbing_keyboard)
71 ungrabKeyboard();
72
73 int ret = XGrabKeyboard(App::instance()->display(), win, False,
74 GrabModeAsync, GrabModeAsync, CurrentTime);
75
76 if (ret == Success) {
77 m_grabbing_keyboard = &ev;
78 return true;
79 }
80 return false;
81}
82
83void EventManager::ungrabKeyboard() {
84 XUngrabKeyboard(App::instance()->display(), CurrentTime);
85 if (m_grabbing_keyboard)
86 m_grabbing_keyboard->notifyUngrabKeyboard();
87 m_grabbing_keyboard = 0;
88}
69 89
70Window EventManager::getEventWindow(XEvent &ev) { 90Window EventManager::getEventWindow(XEvent &ev) {
71 // we only have cases for events that differ from xany 91 // we only have cases for events that differ from xany
@@ -156,9 +176,7 @@ void EventManager::dispatch(Window win, XEvent &ev, bool parent) {
156 evhand->keyPressEvent(ev.xkey); 176 evhand->keyPressEvent(ev.xkey);
157 break; 177 break;
158 case KeyRelease: 178 case KeyRelease:
159#ifdef NOT_USED
160 evhand->keyReleaseEvent(ev.xkey); 179 evhand->keyReleaseEvent(ev.xkey);
161#endif
162 break; 180 break;
163 case ButtonPress: 181 case ButtonPress:
164 evhand->buttonPressEvent(ev.xbutton); 182 evhand->buttonPressEvent(ev.xbutton);