diff options
author | rathnor <rathnor> | 2004-05-04 14:33:38 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2004-05-04 14:33:38 (GMT) |
commit | d95fcc2dbba7fdf3884452bd69c352c87ae1e57b (patch) | |
tree | b232dbadf1898049ee0fdd9cedbb00852c44d29c /src/FbTk | |
parent | e127dabae691ee567aaedb84a2d7456c72991978 (diff) | |
download | fluxbox_paul-d95fcc2dbba7fdf3884452bd69c352c87ae1e57b.zip fluxbox_paul-d95fcc2dbba7fdf3884452bd69c352c87ae1e57b.tar.bz2 |
Event Manager fixes/review
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/EventManager.cc | 18 | ||||
-rw-r--r-- | src/FbTk/EventManager.hh | 9 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc index 9a11ab2..d4f4f4c 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.11 2004/04/19 22:46:46 fluxgen Exp $ | 22 | // $Id: EventManager.cc,v 1.12 2004/05/04 14:33:38 rathnor Exp $ |
23 | 23 | ||
24 | #include "EventManager.hh" | 24 | #include "EventManager.hh" |
25 | #include "FbWindow.hh" | 25 | #include "FbWindow.hh" |
@@ -128,11 +128,19 @@ void EventManager::unregisterEventHandler(Window win) { | |||
128 | 128 | ||
129 | void EventManager::dispatch(Window win, XEvent &ev, bool parent) { | 129 | void EventManager::dispatch(Window win, XEvent &ev, bool parent) { |
130 | EventHandler *evhand = 0; | 130 | EventHandler *evhand = 0; |
131 | if (parent) | 131 | if (parent) { |
132 | evhand = m_parent[win]; | 132 | EventHandlerMap::iterator it = m_parent.find(win); |
133 | else { | 133 | if (it == m_parent.end()) |
134 | return; | ||
135 | else | ||
136 | evhand = it->second; | ||
137 | } else { | ||
134 | win = getEventWindow(ev); | 138 | win = getEventWindow(ev); |
135 | evhand = m_eventhandlers[win]; | 139 | EventHandlerMap::iterator it = m_eventhandlers.find(win); |
140 | if (it == m_eventhandlers.end()) | ||
141 | return; | ||
142 | else | ||
143 | evhand = it->second; | ||
136 | } | 144 | } |
137 | 145 | ||
138 | if (evhand == 0) | 146 | if (evhand == 0) |
diff --git a/src/FbTk/EventManager.hh b/src/FbTk/EventManager.hh index 049d527..6bd368c 100644 --- a/src/FbTk/EventManager.hh +++ b/src/FbTk/EventManager.hh | |||
@@ -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.hh,v 1.8 2004/04/19 22:46:46 fluxgen Exp $ | 22 | // $Id: EventManager.hh,v 1.9 2004/05/04 14:33:38 rathnor Exp $ |
23 | 23 | ||
24 | #include "EventHandler.hh" | 24 | #include "EventHandler.hh" |
25 | #include <map> | 25 | #include <map> |
@@ -51,12 +51,15 @@ public: | |||
51 | 51 | ||
52 | void registerEventHandler(EventHandler &ev, Window win); | 52 | void registerEventHandler(EventHandler &ev, Window win); |
53 | void unregisterEventHandler(Window win); | 53 | void unregisterEventHandler(Window win); |
54 | |||
54 | private: | 55 | private: |
55 | EventManager() { } | 56 | EventManager() { } |
56 | ~EventManager(); | 57 | ~EventManager(); |
57 | void dispatch(Window win, XEvent &event, bool parent = false); | 58 | void dispatch(Window win, XEvent &event, bool parent = false); |
58 | std::map<Window, EventHandler *> m_eventhandlers; | 59 | |
59 | std::map<Window, EventHandler *> m_parent; | 60 | typedef std::map<Window, EventHandler *> EventHandlerMap; |
61 | EventHandlerMap m_eventhandlers; | ||
62 | EventHandlerMap m_parent; | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | } //end namespace FbTk | 65 | } //end namespace FbTk |