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