aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/EventManager.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-03-04 17:47:37 (GMT)
committermarkt <markt>2007-03-04 17:47:37 (GMT)
commit4c1a242968dff12e504f281224819b7cd3850a04 (patch)
tree42a6e3de02153bc8f35cae43f89238d73e9b821a /src/FbTk/EventManager.cc
parent9477af82a5835b7336fec8879967abb67f3bd848 (diff)
downloadfluxbox-4c1a242968dff12e504f281224819b7cd3850a04.zip
fluxbox-4c1a242968dff12e504f281224819b7cd3850a04.tar.bz2
moved some code around (regarding event handling) in preparation for upcoming features
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);