1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __eventdispatcher
3 #define __eventdispatcher
5 #include "eventhandler.hh"
11 typedef std::map<unsigned int, EventHandler *> EventMap;
13 class EventDispatcher {
17 virtual ~EventDispatcher();
19 virtual void clearAllHandlers(void);
20 virtual void registerHandler(Window id, EventHandler *handler);
21 virtual void clearHandler(Window id);
22 //! Dispatch events from the X server to the appropriate EventHandlers
24 @param remote Is the Xserver on a remote (low bandwidth) connection or on a
25 local (high bandwidth) connection. This allows you to specify
26 'false' in which case slightly different semantics are used
27 for event retrieval.<br>
28 The default is 'true' since this should generally be used,
29 only the Openbox window manager should need to specify
32 virtual void dispatchEvents(bool remote = true);
34 inline void setFallbackHandler(EventHandler *fallback)
35 { _fallback = fallback; }
36 EventHandler *getFallbackHandler(void) const { return _fallback; }
38 //! Sets an event handler that gets all events for all handlers after
39 //! any specific handlers have received them
40 inline void setMasterHandler(EventHandler *master)
42 EventHandler *getMasterHandler(void) const { return _master; }
44 EventHandler *findHandler(Window win);
46 inline Time lastTime() const { return _lasttime; }
50 EventHandler *_fallback;
51 EventHandler *_master;
53 //! The time at which the last XEvent with a time was received
56 void dispatch(Window win, const XEvent &e);
57 void dispatchFocus(const XEvent &e);