summaryrefslogtreecommitdiff
path: root/src/FbTk/EventManager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/EventManager.cc')
-rw-r--r--src/FbTk/EventManager.cc58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc
index ff01794..6c697e6 100644
--- a/src/FbTk/EventManager.cc
+++ b/src/FbTk/EventManager.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: EventManager.cc,v 1.9 2003/10/02 16:14:41 rathnor Exp $ 22// $Id: EventManager.cc,v 1.10 2003/10/14 16:23:16 rathnor Exp $
23 23
24#include "EventManager.hh" 24#include "EventManager.hh"
25#include "FbWindow.hh" 25#include "FbWindow.hh"
@@ -57,6 +57,58 @@ void EventManager::remove(const FbWindow &win) {
57 unregisterEventHandler(win.window()); 57 unregisterEventHandler(win.window());
58} 58}
59 59
60Window EventManager::getEventWindow(XEvent &ev) {
61 // we only have cases for events that differ from xany
62 switch (ev.type) {
63 case CreateNotify:
64 // XCreateWindowEvent
65 return ev.xcreatewindow.window;
66 break;
67 case DestroyNotify:
68 // XDestroyWindowEvent
69 return ev.xdestroywindow.window;
70 break;
71 case UnmapNotify:
72 // XUnmapEvent
73 return ev.xunmap.window;
74 break;
75 case MapNotify:
76 // XMapEvent
77 return ev.xmap.window;
78 break;
79 case MapRequest:
80 // XMapRequestEvent
81 return ev.xmaprequest.window;
82 break;
83 case ReparentNotify:
84 // XReparentEvent
85 return ev.xreparent.window;
86 break;
87 case ConfigureNotify:
88 // XConfigureNotify
89 return ev.xconfigure.window;
90 break;
91 case GravityNotify:
92 // XGravityNotify
93 return ev.xgravity.window;
94 break;
95 case ConfigureRequest:
96 // XConfigureRequestEvent
97 return ev.xconfigurerequest.window;
98 break;
99 case CirculateNotify:
100 // XCirculateEvent
101 return ev.xcirculate.window;
102 break;
103 case CirculateRequest:
104 // XCirculateRequestEvent
105 return ev.xcirculaterequest.window;
106 break;
107 default:
108 return ev.xany.window;
109 }
110}
111
60void EventManager::registerEventHandler(EventHandler &ev, Window win) { 112void EventManager::registerEventHandler(EventHandler &ev, Window win) {
61 if (win != None) 113 if (win != None)
62 m_eventhandlers[win] = &ev; 114 m_eventhandlers[win] = &ev;
@@ -73,8 +125,10 @@ void EventManager::dispatch(Window win, XEvent &ev, bool parent) {
73 EventHandler *evhand = 0; 125 EventHandler *evhand = 0;
74 if (parent) 126 if (parent)
75 evhand = m_parent[win]; 127 evhand = m_parent[win];
76 else 128 else {
129 win = getEventWindow(ev);
77 evhand = m_eventhandlers[win]; 130 evhand = m_eventhandlers[win];
131 }
78 132
79 if (evhand == 0) 133 if (evhand == 0)
80 return; 134 return;