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
|
#ifndef __dispatch_h
#define __dispatch_h
#include "client.h"
#include <X11/Xlib.h>
void dispatch_startup();
void dispatch_shutdown();
typedef enum {
Event_X_EnterNotify = 1 << 0,
Event_X_LeaveNotify = 1 << 1,
Event_X_KeyPress = 1 << 2,
Event_X_KeyRelease = 1 << 3,
Event_X_ButtonPress = 1 << 4,
Event_X_ButtonRelease = 1 << 5,
Event_X_MotionNotify = 1 << 6,
Event_Client_New = 1 << 7, /* new window, before mapping */
Event_Client_Mapped = 1 << 8, /* new window, after mapping */
Event_Client_Destroy = 1 << 9, /* unmanaged */
Event_Client_Focus = 1 << 10,
Event_Client_Unfocus = 1 << 11,
Event_Ob_Desktop = 1 << 12, /* changed desktops */
Event_Ob_NumDesktops = 1 << 13, /* changed the number of desktops */
Event_Ob_ShowDesktop = 1 << 14, /* entered/left show-the-desktop mode */
Event_Ob_Startup = 1 << 15, /* startup complete */
Event_Ob_Shutdown = 1 << 16, /* shutdown about to start */
Event_Signal = 1 << 17,
EVENT_RANGE = 1 << 18
} EventType;
typedef union {
XEvent *x; /* for Event_X_* event types */
Client *client; /* for Event_Client_* event types */
int signal;
} EventData;
typedef struct {
EventType type;
EventData data;
} ObEvent;
typedef void (*EventHandler)(const ObEvent *e);
typedef unsigned int EventMask;
void dispatch_register(EventHandler h, EventMask mask);
void dispatch_x(XEvent *e);
void dispatch_client(EventType e, Client *c);
void dispatch_ob(EventType e);
void dispatch_signal(int signal);
#endif
|