]> Dogcows Code - chaz/openbox/blob - otk/eventdispatcher.hh
keep track of the last input event time
[chaz/openbox] / otk / eventdispatcher.hh
1 #ifndef __eventdispatcher
2 #define __eventdispatcher
3
4 #include "eventhandler.hh"
5 #include <map>
6 #include <utility>
7
8 namespace otk {
9
10 typedef std::map<unsigned int, OtkEventHandler *> OtkEventMap;
11
12 class OtkEventDispatcher {
13 public:
14
15 OtkEventDispatcher();
16 virtual ~OtkEventDispatcher();
17
18 virtual void clearAllHandlers(void);
19 virtual void registerHandler(Window id, otk::OtkEventHandler *handler);
20 virtual void clearHandler(Window id);
21 virtual void dispatchEvents(void);
22
23 inline void setFallbackHandler(otk::OtkEventHandler *fallback)
24 { _fallback = fallback; }
25 otk::OtkEventHandler *getFallbackHandler(void) const { return _fallback; }
26
27 //! Sets an event handler that gets all events for all handlers after
28 //! any specific handlers have received them
29 inline void setMasterHandler(otk::OtkEventHandler *master)
30 { _master = master; }
31 otk::OtkEventHandler *getMasterHandler(void) const { return _master; }
32
33 otk::OtkEventHandler *findHandler(Window win);
34
35 inline Time lastTime() const { return _lasttime; }
36
37 private:
38 OtkEventMap _map;
39 OtkEventHandler *_fallback;
40 OtkEventHandler *_master;
41 Window _focus;
42 XEvent _focus_e;
43 XEvent _crossing_e;
44
45 //! The time at which the last XEvent with a time was received
46 Time _lasttime;
47
48 void dispatch(const XEvent &e);
49 };
50
51 }
52
53 #endif
This page took 0.041806 seconds and 5 git commands to generate.