-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
xwm.h
59 lines (51 loc) · 1.91 KB
/
xwm.h
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
59
/* See LICENSE file for copyright and license details. */
/* typedefs */
typedef struct {
unsigned int mod;
xcb_keysym_t keysym;
void (*func)(char **com);
char **com;
} Key;
typedef struct {
uint32_t request;
void (*func)(xcb_generic_event_t *ev);
} handler_func_t;
/* convert keycode to keysym and back */
static xcb_keycode_t *xcb_get_keycodes(xcb_keysym_t keysym);
static xcb_keysym_t xcb_get_keysym(xcb_keycode_t keycode);
/* user defined command actions */
static void killclient(char **com);
static void spawn(char **com);
static void closewm(char **com);
static void fullclient(char **com);
/* window behavior */
static void setFocus(xcb_drawable_t window);
static void setFocusColor(xcb_drawable_t window, int focus);
/* event hander actions */
static int eventHandler(void);
static void handleMotionNotify(xcb_generic_event_t *ev);
static void handleEnterNotify(xcb_generic_event_t *ev);
static void handleDestroyNotify(xcb_generic_event_t *ev);
static void handleButtonPress(xcb_generic_event_t *ev);
static void handleButtonRelease(xcb_generic_event_t *ev);
static void handleKeyPress(xcb_generic_event_t *ev);
static void handleMapRequest(xcb_generic_event_t *ev);
static void handleFocusIn(xcb_generic_event_t *ev);
static void handleFocusOut(xcb_generic_event_t *ev);
static handler_func_t handler_funs[] = {
{ XCB_MOTION_NOTIFY, handleMotionNotify },
{ XCB_ENTER_NOTIFY, handleEnterNotify },
{ XCB_DESTROY_NOTIFY, handleDestroyNotify },
{ XCB_BUTTON_PRESS, handleButtonPress },
{ XCB_BUTTON_RELEASE, handleButtonRelease },
{ XCB_KEY_PRESS, handleKeyPress },
{ XCB_MAP_REQUEST, handleMapRequest },
{ XCB_FOCUS_IN, handleFocusIn },
{ XCB_FOCUS_OUT, handleFocusOut },
{ XCB_NONE, NULL }
};
/* intialize */
static void setup(void);
/* error handling & misc. */
static int die(char *errstr);
static int strcmp_c(char *str1, char *str2);