diff options
author | rathnor <rathnor> | 2003-10-14 16:23:16 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-10-14 16:23:16 (GMT) |
commit | f89532c0cb3c8a5cc1a78bc11f1c6445edc2d826 (patch) | |
tree | b2b28146930af8749882d814b3e7b95d68881064 /src/FbTk/EventManager.cc | |
parent | c583251e18003d4ea2886cf227b96d351d7d32c5 (diff) | |
download | fluxbox_paul-f89532c0cb3c8a5cc1a78bc11f1c6445edc2d826.zip fluxbox_paul-f89532c0cb3c8a5cc1a78bc11f1c6445edc2d826.tar.bz2 |
fix identification of event targets in event manager
Diffstat (limited to 'src/FbTk/EventManager.cc')
-rw-r--r-- | src/FbTk/EventManager.cc | 58 |
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 | ||
60 | Window 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 | |||
60 | void EventManager::registerEventHandler(EventHandler &ev, Window win) { | 112 | void 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; |