X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fdispatch.h;h=a28386210ad3f95bcec472c6d93eab0d71b2155d;hb=bf707e7240bbf86be7628c28319d463847738671;hp=c8371b990f93f6cbfff411fa522f7ba5e8330572;hpb=9b33f7ded69e22ad18169c45b6b340dcb348e072;p=chaz%2Fopenbox diff --git a/openbox/dispatch.h b/openbox/dispatch.h index c8371b99..a2838621 100644 --- a/openbox/dispatch.h +++ b/openbox/dispatch.h @@ -8,35 +8,63 @@ 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 + Event_X_EnterNotify = 1 << 0, /* pointer entered a window */ + Event_X_LeaveNotify = 1 << 1, /* pointer left a window */ + Event_X_KeyPress = 1 << 2, /* key pressed */ + Event_X_KeyRelease = 1 << 3, /* key released */ + Event_X_ButtonPress = 1 << 4, /* mouse button pressed */ + Event_X_ButtonRelease = 1 << 5, /* mouse button released */ + Event_X_MotionNotify = 1 << 6, /* mouse motion */ + Event_X_Bell = 1 << 7, /* an XKB bell event */ + + Event_Client_New = 1 << 8, /* new window, before mapping */ + Event_Client_Mapped = 1 << 9, /* new window, after mapping */ + Event_Client_Destroy = 1 << 10, /* unmanaged */ + Event_Client_Unmapped = 1 << 11, /* unmanaged, after unmapping */ + Event_Client_Focus = 1 << 12, /* focused */ + Event_Client_Unfocus = 1 << 13, /* unfocused */ + Event_Client_Urgent = 1 << 14, /* entered/left urgent state */ + Event_Client_Desktop = 1 << 15, /* moved to a new desktop */ + + Event_Ob_Desktop = 1 << 16, /* changed desktops */ + Event_Ob_NumDesktops = 1 << 17, /* changed the number of desktops */ + Event_Ob_ShowDesktop = 1 << 18, /* entered/left show-the-desktop mode */ + + Event_Signal = 1 << 19, /* a signal from the OS */ + + EVENT_RANGE = 1 << 20 } EventType; -typedef union { - XEvent *x; /* for Event_X_* event types */ - Client *client; /* for Event_Client_* event types */ +typedef struct { + XEvent *e; + Client *client; +} EventData_X; + +typedef struct { + Client *client; + int num[2]; + /* Event_Client_Desktop: num[0] = new number, num[1] = old number + Event_Client_Urgent: num[0] = urgent state + */ +} EventData_Client; + +typedef struct { + int num[2]; + /* Event_Ob_Desktop: num[0] = new number, num[1] = old number + Event_Ob_NumDesktops: num[0] = new number, num[1] = old number + Event_Ob_ShowDesktop: num[0] = new show-desktop mode + */ +} EventData_Ob; + +typedef struct { int signal; +} EventData_Signal; + +typedef struct { + EventData_X x; /* for Event_X_* event types */ + EventData_Client c; /* for Event_Client_* event types */ + EventData_Ob o; /* for Event_Ob_* event types */ + EventData_Signal s; /* for Event_Signal */ } EventData; typedef struct { @@ -44,15 +72,15 @@ typedef struct { EventData data; } ObEvent; -typedef void (*EventHandler)(const ObEvent *e); +typedef void (*EventHandler)(const ObEvent *e, void *data); typedef unsigned int EventMask; -void dispatch_register(EventHandler h, EventMask mask); +void dispatch_register(EventMask mask, EventHandler h, void *data); -void dispatch_x(XEvent *e); -void dispatch_client(EventType e, Client *c); -void dispatch_ob(EventType e); +void dispatch_x(XEvent *e, Client *c); +void dispatch_client(EventType e, Client *c, int num0, int num1); +void dispatch_ob(EventType e, int num0, int num1); void dispatch_signal(int signal); #endif