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