]> Dogcows Code - chaz/openbox/blob - openbox/dispatch.h
prefixing and capitalizing the StackLayer -> ObStackingLayer enum.
[chaz/openbox] / openbox / dispatch.h
1 #ifndef __dispatch_h
2 #define __dispatch_h
3
4 #include "misc.h"
5
6 #include <X11/Xlib.h>
7
8 struct _ObClient;
9
10 void dispatch_startup();
11 void dispatch_shutdown();
12
13 typedef enum {
14 Event_X_EnterNotify = 1 << 0, /* pointer entered a window */
15 Event_X_LeaveNotify = 1 << 1, /* pointer left a window */
16 Event_X_KeyPress = 1 << 2, /* key pressed */
17 Event_X_KeyRelease = 1 << 3, /* key released */
18 Event_X_ButtonPress = 1 << 4, /* mouse button pressed */
19 Event_X_ButtonRelease = 1 << 5, /* mouse button released */
20 Event_X_MotionNotify = 1 << 6, /* mouse motion */
21 Event_X_Bell = 1 << 7, /* an XKB bell event */
22
23 Event_Client_New = 1 << 8, /* new window, before mapping */
24 Event_Client_Mapped = 1 << 9, /* new window, after mapping
25 or uniconified */
26 Event_Client_Destroy = 1 << 10, /* unmanaged */
27 Event_Client_Unmapped = 1 << 11, /* unmanaged, after unmapping
28 or iconified */
29 Event_Client_Focus = 1 << 12, /* focused */
30 Event_Client_Unfocus = 1 << 13, /* unfocused */
31 Event_Client_Urgent = 1 << 14, /* entered/left urgent state */
32 Event_Client_Desktop = 1 << 15, /* moved to a new desktop */
33 Event_Client_Moving = 1 << 16, /* being interactively moved */
34 Event_Client_Resizing = 1 << 17, /* being interactively resized */
35
36 Event_Ob_Desktop = 1 << 18, /* changed desktops */
37 Event_Ob_NumDesktops = 1 << 19, /* changed the number of desktops */
38 Event_Ob_ShowDesktop = 1 << 20, /* entered/left show-the-desktop mode */
39
40 Event_Signal = 1 << 21, /* a signal from the OS */
41
42 EVENT_RANGE = 1 << 22
43 } EventType;
44
45 typedef struct {
46 XEvent *e;
47 struct _ObClient *client;
48 } EventData_X;
49
50 typedef struct {
51 struct _ObClient *client;
52 int num[3];
53 /* Event_Client_Desktop: num[0] = new number, num[1] = old number
54 Event_Client_Urgent: num[0] = urgent state
55 Event_Client_Moving: num[0] = dest x coord, num[1] = dest y coord --
56 change these in the handler to adjust where the
57 window will be placed
58 Event_Client_Resizing: num[0] = dest width, num[1] = dest height --
59 change these in the handler to adjust where the
60 window will be placed
61 num[2] = the anchored corner
62 */
63 } EventData_Client;
64
65 typedef struct {
66 int num[2];
67 /* Event_Ob_Desktop: num[0] = new number, num[1] = old number
68 Event_Ob_NumDesktops: num[0] = new number, num[1] = old number
69 Event_Ob_ShowDesktop: num[0] = new show-desktop mode
70 */
71 } EventData_Ob;
72
73 typedef struct {
74 int signal;
75 } EventData_Signal;
76
77 typedef struct {
78 EventData_X x; /* for Event_X_* event types */
79 EventData_Client c; /* for Event_ObClient_* event types */
80 EventData_Ob o; /* for Event_Ob_* event types */
81 EventData_Signal s; /* for Event_Signal */
82 } EventData;
83
84 typedef struct {
85 EventType type;
86 EventData data;
87 } ObEvent;
88
89 typedef void (*EventHandler)(const ObEvent *e, void *data);
90
91 typedef unsigned int EventMask;
92
93 void dispatch_register(EventMask mask, EventHandler h, void *data);
94
95 void dispatch_x(XEvent *e, struct _ObClient *c);
96 void dispatch_client(EventType e, struct _ObClient *c, int num0, int num1);
97 void dispatch_ob(EventType e, int num0, int num1);
98 void dispatch_signal(int signal);
99 /* *x and *y should be set with the destination of the window, they may be
100 changed by the event handlers */
101 void dispatch_move(struct _ObClient *c, int *x, int *y);
102 /* *w and *h should be set with the destination of the window, they may be
103 changed by the event handlers */
104 void dispatch_resize(struct _ObClient *c, int *w, int *h, ObCorner corner);
105
106 #endif
This page took 0.036468 seconds and 4 git commands to generate.