]> icculus.org git repositories - dana/openbox.git/blob - openbox/dispatch.h
stop using python internally. add an event dispatcher
[dana/openbox.git] / openbox / dispatch.h
1 #ifndef __dispatch_h
2 #define __dispatch_h
3
4 #include "client.h"
5 #include <X11/Xlib.h>
6
7 void dispatch_startup();
8 void dispatch_shutdown();
9
10 typedef enum {
11     Event_X_EnterNotify   = 1 << 0,
12     Event_X_LeaveNotify   = 1 << 1,
13     Event_X_KeyPress      = 1 << 2,
14     Event_X_KeyRelease    = 1 << 3,
15     Event_X_ButtonPress   = 1 << 4,
16     Event_X_ButtonRelease = 1 << 5,
17     Event_X_MotionNotify  = 1 << 6,
18
19     Event_Client_New      = 1 << 7, /* new window, before mapping */
20     Event_Client_Mapped   = 1 << 8, /* new window, after mapping */
21     Event_Client_Destroy  = 1 << 9, /* unmanaged */
22     Event_Client_Focus    = 1 << 10,
23     Event_Client_Unfocus  = 1 << 11,
24
25     Event_Ob_Desktop      = 1 << 12, /* changed desktops */
26     Event_Ob_NumDesktops  = 1 << 13, /* changed the number of desktops */
27     Event_Ob_ShowDesktop  = 1 << 14, /* entered/left show-the-desktop mode */
28     Event_Ob_Startup      = 1 << 15, /* startup complete */
29     Event_Ob_Shutdown     = 1 << 16, /* shutdown about to start */
30
31     Event_Signal          = 1 << 17,
32
33     EVENT_RANGE           = 1 << 18
34 } EventType;
35
36 typedef union {
37     XEvent *x; /* for Event_X_* event types */
38     Client *client; /* for Event_Client_* event types */
39     int signal;
40 } EventData;
41
42 typedef struct {
43     EventType type;
44     EventData data;
45 } ObEvent;
46
47 typedef void (*EventHandler)(const ObEvent *e);
48
49 typedef unsigned int EventMask;
50
51 void dispatch_register(EventHandler h, EventMask mask);
52
53 void dispatch_x(XEvent *e);
54 void dispatch_client(EventType e, Client *c);
55 void dispatch_ob(EventType e);
56 void dispatch_signal(int signal);
57
58 #endif