From b655f6348cf8b257de7eaea2ddee8f72e68c67fd Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Mon, 11 Aug 2008 13:27:28 +0200 Subject: [PATCH] xutil: rename xutil functions according to the rest of code. --- awesome.c | 44 ++++++++--------- client.c | 23 +++++---- common/xutil.c | 32 ++++++------ common/xutil.h | 119 +++++++++++++++++++++++++-------------------- event.c | 4 +- keybinding.c | 4 +- keygrabber.c | 16 +++--- mouse.c | 2 +- widget.c | 2 +- widgets/taglist.c | 2 +- widgets/tasklist.c | 2 +- window.c | 2 +- 12 files changed, 137 insertions(+), 115 deletions(-) diff --git a/awesome.c b/awesome.c index e83343a14..c258f5c79 100644 --- a/awesome.c +++ b/awesome.c @@ -106,7 +106,7 @@ scan(void) state = window_getstate(wins[i]); - has_awesome_prop = xutil_gettextprop(globalconf.connection, wins[1], _AWESOME_PROPERTIES, NULL, NULL); + has_awesome_prop = xutil_text_prop_get(globalconf.connection, wins[1], _AWESOME_PROPERTIES, NULL, NULL); if(!attr_r || attr_r->override_redirect || has_awesome_prop @@ -224,21 +224,21 @@ xerror(void *data __attribute__ ((unused)), xcb_connection_t *c __attribute__ ((unused)), xcb_generic_error_t *e) { - xutil_error_t *err = xutil_get_error(e); + xutil_error_t *err = xutil_error_get(e); if(!err) return 0; - if(e->error_code == BadWindow - || (e->error_code == BadMatch && err->request_code == XCB_SET_INPUT_FOCUS) - || (e->error_code == BadValue && err->request_code == XCB_KILL_CLIENT) - || (err->request_code == XCB_CONFIGURE_WINDOW && e->error_code == BadMatch)) + if(e->error_code == XUTIL_BAD_WINDOW + || (e->error_code == XUTIL_BAD_MATCH && err->request_code == XCB_SET_INPUT_FOCUS) + || (e->error_code == XUTIL_BAD_VALUE && err->request_code == XCB_KILL_CLIENT) + || (err->request_code == XCB_CONFIGURE_WINDOW && e->error_code == XUTIL_BAD_MATCH)) { - xutil_delete_error(err); + xutil_error_delete(err); return 0; } warn("fatal error: request=%s, error=%s", err->request_label, err->error_label); - xutil_delete_error(err); + xutil_error_delete(err); /* * Xlib code was using default X error handler, namely @@ -248,7 +248,7 @@ xerror(void *data __attribute__ ((unused)), * * \todo display more informations about the error (like the Xlib default error handler) */ - if(e->error_code == BadImplementation) + if(e->error_code == XUTIL_BAD_IMPLEMENTATION) exit(EXIT_FAILURE); return 0; @@ -363,7 +363,7 @@ main(int argc, char **argv) /* Allocate a handler which will holds all errors and events */ globalconf.evenths = xcb_alloc_event_handlers(globalconf.connection); - xutil_set_error_handler_catch_all(globalconf.evenths, xerrorstart, NULL); + xutil_error_handler_catch_all_set(globalconf.evenths, xerrorstart, NULL); for(screen_nbr = 0; screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection)); @@ -384,14 +384,14 @@ main(int argc, char **argv) xcb_poll_for_event_loop(globalconf.evenths); /* Set the default xerror handler */ - xutil_set_error_handler_catch_all(globalconf.evenths, xerror, NULL); + xutil_error_handler_catch_all_set(globalconf.evenths, xerror, NULL); /* Allocate the key symbols */ globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection); /* Get the NumLock, ShiftLock and CapsLock masks */ - xutil_getlockmask(globalconf.connection, globalconf.keysyms, &globalconf.numlockmask, - &globalconf.shiftlockmask, &globalconf.capslockmask); + xutil_lock_mask_get(globalconf.connection, globalconf.keysyms, &globalconf.numlockmask, + &globalconf.shiftlockmask, &globalconf.capslockmask); /* init atom cache */ atoms_init(globalconf.connection); @@ -412,15 +412,15 @@ main(int argc, char **argv) xcolor_init(&globalconf.colors.bg, globalconf.connection, globalconf.default_screen, "white", sizeof("white")-1); /* init cursors */ - globalconf.cursor[CurNormal] = xutil_cursor_new(globalconf.connection, CURSOR_LEFT_PTR); - globalconf.cursor[CurResize] = xutil_cursor_new(globalconf.connection, CURSOR_SIZING); - globalconf.cursor[CurResizeH] = xutil_cursor_new(globalconf.connection, CURSOR_DOUBLE_ARROW_HORIZ); - globalconf.cursor[CurResizeV] = xutil_cursor_new(globalconf.connection, CURSOR_DOUBLE_ARROW_VERT); - globalconf.cursor[CurMove] = xutil_cursor_new(globalconf.connection, CURSOR_FLEUR); - globalconf.cursor[CurTopRight] = xutil_cursor_new(globalconf.connection, CURSOR_TOP_RIGHT_CORNER); - globalconf.cursor[CurTopLeft] = xutil_cursor_new(globalconf.connection, CURSOR_TOP_LEFT_CORNER); - globalconf.cursor[CurBotRight] = xutil_cursor_new(globalconf.connection, CURSOR_BOTTOM_RIGHT_CORNER); - globalconf.cursor[CurBotLeft] = xutil_cursor_new(globalconf.connection, CURSOR_BOTTOM_LEFT_CORNER); + globalconf.cursor[CurNormal] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_LEFT_PTR); + globalconf.cursor[CurResize] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_SIZING); + globalconf.cursor[CurResizeH] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_DOUBLE_ARROW_HORIZ); + globalconf.cursor[CurResizeV] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_DOUBLE_ARROW_VERT); + globalconf.cursor[CurMove] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_FLEUR); + globalconf.cursor[CurTopRight] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_TOP_RIGHT_CORNER); + globalconf.cursor[CurTopLeft] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_TOP_LEFT_CORNER); + globalconf.cursor[CurBotRight] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_BOTTOM_RIGHT_CORNER); + globalconf.cursor[CurBotLeft] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_BOTTOM_LEFT_CORNER); /* init lua */ luaA_init(); diff --git a/client.c b/client.c index acf386646..fc46f0f1f 100644 --- a/client.c +++ b/client.c @@ -73,7 +73,8 @@ client_loadprops(client_t * c, screen_t *screen) tag_array_t *tags = &screen->tags; char *prop = NULL; - if(!xutil_gettextprop(globalconf.connection, c->win, _AWESOME_PROPERTIES, &prop, &len)) + if(!xutil_text_prop_get(globalconf.connection, c->win, _AWESOME_PROPERTIES, + &prop, &len)) return false; if(len != tags->len + 2) @@ -169,8 +170,8 @@ client_updatetitle(client_t *c) char *name, *utf8; ssize_t len; - if(!xutil_gettextprop(globalconf.connection, c->win, _NET_WM_NAME, &name, &len)) - if(!xutil_gettextprop(globalconf.connection, c->win, WM_NAME, &name, &len)) + if(!xutil_text_prop_get(globalconf.connection, c->win, _NET_WM_NAME, &name, &len)) + if(!xutil_text_prop_get(globalconf.connection, c->win, WM_NAME, &name, &len)) return false; p_delete(&c->name); @@ -686,7 +687,8 @@ client_unmanage(client_t *c) XCB_CONFIG_WINDOW_BORDER_WIDTH, (uint32_t *) &c->oldborder); - xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, c->win, ANY_MODIFIER); + xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, c->win, + XUTIL_ANY_MODIFIER); window_setstate(c->win, XCB_WM_WITHDRAWN_STATE); xcb_aux_sync(globalconf.connection); @@ -1233,12 +1235,12 @@ luaA_client_index(lua_State *L) lua_pushstring(L, (*c)->name); break; case A_TK_CLASS: - if(!xutil_get_class_hint(globalconf.connection, (*c)->win, &hint)) + if(!xutil_class_hint_get(globalconf.connection, (*c)->win, &hint)) return 0; lua_pushstring(L, hint.res_class); break; case A_TK_INSTANCE: - if(!xutil_get_class_hint(globalconf.connection, (*c)->win, &hint)) + if(!xutil_class_hint_get(globalconf.connection, (*c)->win, &hint)) return 0; lua_pushstring(L, hint.res_name); break; @@ -1255,14 +1257,17 @@ luaA_client_index(lua_State *L) } break; case A_TK_MACHINE: - if(!xutil_gettextprop(globalconf.connection, (*c)->win, WM_CLIENT_MACHINE, &value, &slen)) + if(!xutil_text_prop_get(globalconf.connection, (*c)->win, + WM_CLIENT_MACHINE, &value, &slen)) return 0; lua_pushlstring(L, value, slen); p_delete(&value); break; case A_TK_ICON_NAME: - if(!xutil_gettextprop(globalconf.connection, (*c)->win, _NET_WM_ICON_NAME, &value, &slen)) - if(!xutil_gettextprop(globalconf.connection, (*c)->win, WM_ICON_NAME, &value, &slen)) + if(!xutil_text_prop_get(globalconf.connection, (*c)->win, + _NET_WM_ICON_NAME, &value, &slen)) + if(!xutil_text_prop_get(globalconf.connection, (*c)->win, + WM_ICON_NAME, &value, &slen)) return 0; lua_pushlstring(L, value, slen); p_delete(&value); diff --git a/common/xutil.c b/common/xutil.c index 53c271093..913422ff4 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -40,7 +40,8 @@ * \return True on sucess, false on failure. */ bool -xutil_gettextprop(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom, char **text, ssize_t *len) +xutil_text_prop_get(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom, + char **text, ssize_t *len) { xcb_get_property_cookie_t prop_c; xcb_get_property_reply_t *prop_r; @@ -76,9 +77,9 @@ xutil_gettextprop(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom, char } void -xutil_getlockmask(xcb_connection_t *conn, xcb_key_symbols_t *keysyms, - unsigned int *numlockmask, unsigned int *shiftlockmask, - unsigned int *capslockmask) +xutil_lock_mask_get(xcb_connection_t *conn, xcb_key_symbols_t *keysyms, + unsigned int *numlockmask, unsigned int *shiftlockmask, + unsigned int *capslockmask) { xcb_get_modifier_mapping_reply_t *modmap_r; xcb_keycode_t *modmap, kc; @@ -112,7 +113,8 @@ xutil_getlockmask(xcb_connection_t *conn, xcb_key_symbols_t *keysyms, } bool -xutil_get_class_hint(xcb_connection_t *conn, xcb_window_t win, xutil_class_hint_t *ch) +xutil_class_hint_get(xcb_connection_t *conn, xcb_window_t win, + xutil_class_hint_t *ch) { xcb_get_property_reply_t *class_hint_r; xcb_get_property_cookie_t class_hint_c; @@ -152,7 +154,7 @@ xutil_get_class_hint(xcb_connection_t *conn, xcb_window_t win, xutil_class_hint_ #define EVENTS_NBR 126 void -xutil_set_error_handler_catch_all(xcb_event_handlers_t *evenths, +xutil_error_handler_catch_all_set(xcb_event_handlers_t *evenths, xcb_generic_error_handler_t handler, void *data) { @@ -162,7 +164,7 @@ xutil_set_error_handler_catch_all(xcb_event_handlers_t *evenths, } const char * -xutil_error_label[] = +xutil_label_error[] = { "Success", "BadRequest", @@ -185,7 +187,7 @@ xutil_error_label[] = }; const char * -xutil_request_label[] = +xutil_label_request[] = { "None", "CreateWindow", @@ -318,7 +320,7 @@ xutil_request_label[] = }; xutil_error_t * -xutil_get_error(const xcb_generic_error_t *e) +xutil_error_get(const xcb_generic_error_t *e) { if(e->response_type != 0) /* This is not an error, this _should_ not happen */ @@ -335,23 +337,23 @@ xutil_get_error(const xcb_generic_error_t *e) /* Extensions generally provide their own requests so we just * store the request code */ - if(err->request_code >= (sizeof(xutil_request_label) / sizeof(char *))) + if(err->request_code >= (sizeof(xutil_label_request) / sizeof(char *))) asprintf(&err->request_label, "%d", err->request_code); else - err->request_label = a_strdup(xutil_request_label[err->request_code]); + err->request_label = a_strdup(xutil_label_request[err->request_code]); /* Extensions may also define their own errors, so just store the * error_code */ - if(e->error_code >= (sizeof(xutil_error_label) / sizeof(char *))) + if(e->error_code >= (sizeof(xutil_label_error) / sizeof(char *))) asprintf(&err->error_label, "%d", e->error_code); else - err->error_label = a_strdup(xutil_error_label[e->error_code]); + err->error_label = a_strdup(xutil_label_error[e->error_code]); return err; } void -xutil_delete_error(xutil_error_t *err) +xutil_error_delete(xutil_error_t *err) { p_delete(&err->error_label); p_delete(&err->request_label); @@ -366,7 +368,7 @@ typedef struct } keymod_t; xcb_keysym_t -xutil_keymask_fromstr(const char *keyname) +xutil_key_mask_fromstr(const char *keyname) { /** List of keyname and corresponding X11 mask codes */ static const keymod_t KeyModList[] = diff --git a/common/xutil.h b/common/xutil.h index 43af0f1bf..e9553df1f 100644 --- a/common/xutil.h +++ b/common/xutil.h @@ -34,56 +34,71 @@ #include "array.h" -#define CLEANMASK(mask) (mask & ~(globalconf.numlockmask | XCB_MOD_MASK_LOCK)) +#define XUTIL_MASK_CLEAN(mask) (mask & ~(globalconf.numlockmask | XCB_MOD_MASK_LOCK)) /* See http://tronche.com/gui/x/xlib/appendix/b/ for values */ -#define CURSOR_FLEUR 52 -#define CURSOR_LEFT_PTR 68 -#define CURSOR_SIZING 120 -#define CURSOR_BOTTOM_LEFT_CORNER 12 -#define CURSOR_BOTTOM_RIGHT_CORNER 14 -#define CURSOR_TOP_LEFT_CORNER 134 -#define CURSOR_TOP_RIGHT_CORNER 136 -#define CURSOR_DOUBLE_ARROW_HORIZ 108 -#define CURSOR_DOUBLE_ARROW_VERT 116 +#define XUTIL_CURSOR_FLEUR 52 +#define XUTIL_CURSOR_LEFT_PTR 68 +#define XUTIL_CURSOR_SIZING 120 +#define XUTIL_CURSOR_BOTTOM_LEFT_CORNER 12 +#define XUTIL_CURSOR_BOTTOM_RIGHT_CORNER 14 +#define XUTIL_CURSOR_TOP_LEFT_CORNER 134 +#define XUTIL_CURSOR_TOP_RIGHT_CORNER 136 +#define XUTIL_CURSOR_DOUBLE_ARROW_HORIZ 108 +#define XUTIL_CURSOR_DOUBLE_ARROW_VERT 116 -#define ANY_KEY 0L /* special Key Code, passed to GrabKey */ -#define ANY_MODIFIER (1<<15) /* used in Grabbutton_t, GrabKey */ +/* Special Key Code, passed to GrabKey */ +#define XUTIL_ANY_KEY 0L -/***************************************************************** - * ERROR CODES - *****************************************************************/ +/* Used in Grabbutton_t, GrabKey */ +#define XUTIL_ANY_MODIFIER (1<<15) -#define Success 0 /* everything's okay */ -#define BadRequest 1 /* bad request code */ -#define BadValue 2 /* int parameter out of range */ -#define BadWindow 3 /* parameter not a Window */ -#define BadPixmap 4 /* parameter not a Pixmap */ -#define BadAtom 5 /* parameter not an Atom */ -#define BadCursor 6 /* parameter not a Cursor */ -#define BadFont 7 /* parameter not a Font */ -#define BadMatch 8 /* parameter mismatch */ -#define BadDrawable 9 /* parameter not a Pixmap or Window */ -#define BadAccess 10 /* depending on context: - - key/button already grabbed - - attempt to free an illegal - cmap entry - - attempt to store into a read-only - color map entry. - - attempt to modify the access control - list from other than the local host. - */ -#define BadAlloc 11 /* insufficient resources */ -#define BadColor 12 /* no such colormap */ -#define BadGC 13 /* parameter not a GC */ -#define BadIDChoice 14 /* choice not in range or already used */ -#define BadName 15 /* font or color name doesn't exist */ -#define BadLength 16 /* Request length incorrect */ -#define BadImplementation 17 /* server is defective */ +/* X error codes */ -#define FirstExtensionError 128 -#define LastExtensionError 255 -/* End of macros not defined in XCB */ +/* Everything's okay */ +#define XUTIL_SUCCESS 0 +/* Bad request code */ +#define XUTIL_BAD_REQUEST 1 +/* Int parameter out of range */ +#define XUTIL_BAD_VALUE 2 +/* Parameter not a Window */ +#define XUTIL_BAD_WINDOW 3 +/* Parameter not a Pixmap */ +#define XUTIL_BAD_PIXMAP 4 +/* Parameter not an Atom */ +#define XUTIL_BAD_ATOM 5 +/* Parameter not a Cursor */ +#define XUTIL_BAD_CURSOR 6 +/* Parameter not a Font */ +#define XUTIL_BAD_FONT 7 +/* Parameter mismatch */ +#define XUTIL_BAD_MATCH 8 +/* Parameter not a Pixmap or Window */ +#define XUTIL_BAD_DRAWABLE 9 +/* Depending on context: + - key/button already grabbed + - attempt to free an illegal + cmap entry + - attempt to store into a read-only + color map entry. + - attempt to modify the access control + list from other than the local host. +*/ +#define XUTIL_BAD_ACCESS 10 +/* Insufficient resources */ +#define XUTIL_BAD_ALLOC 11 +/* No such colormap */ +#define XUTIL_BAD_COLOR 12 +/* Parameter not a GC */ +#define XUTIL_BAD_GC 13 +/* Choice not in range or already used */ +#define XUTIL_BAD_ID_CHOICE 14 +/* Font or color name doesn't exist */ +#define XUTIL_BAD_NAME 15 +/* Request length incorrect */ +#define XUTIL_BAD_LENGTH 16 +/* Server is defective */ +#define XUTIL_BAD_IMPLEMENTATION 17 typedef struct { @@ -91,15 +106,15 @@ typedef struct char *res_class; } xutil_class_hint_t; -bool xutil_get_class_hint(xcb_connection_t *, xcb_window_t, xutil_class_hint_t *); +bool xutil_class_hint_get(xcb_connection_t *, xcb_window_t, xutil_class_hint_t *); -bool xutil_gettextprop(xcb_connection_t *, xcb_window_t, xcb_atom_t, char **, ssize_t *); +bool xutil_text_prop_get(xcb_connection_t *, xcb_window_t, xcb_atom_t, char **, ssize_t *); -void xutil_getlockmask(xcb_connection_t *, xcb_key_symbols_t *, - unsigned int *, unsigned int *, unsigned int *); +void xutil_lock_mask_get(xcb_connection_t *, xcb_key_symbols_t *, + unsigned int *, unsigned int *, unsigned int *); /** Set the same handler for all errors */ -void xutil_set_error_handler_catch_all(xcb_event_handlers_t *, +void xutil_error_handler_catch_all_set(xcb_event_handlers_t *, xcb_generic_error_handler_t, void *); typedef struct @@ -109,9 +124,9 @@ typedef struct char *error_label; } xutil_error_t; -xutil_error_t *xutil_get_error(const xcb_generic_error_t *); -void xutil_delete_error(xutil_error_t *); -xcb_keysym_t xutil_keymask_fromstr(const char *); +xutil_error_t *xutil_error_get(const xcb_generic_error_t *); +void xutil_error_delete(xutil_error_t *); +xcb_keysym_t xutil_key_mask_fromstr(const char *); unsigned int xutil_button_fromint(int); xcb_cursor_t xutil_cursor_new(xcb_connection_t *, unsigned int); diff --git a/event.c b/event.c index 2b5833c0a..06013b801 100644 --- a/event.c +++ b/event.c @@ -55,7 +55,7 @@ event_handle_mouse_button_press(client_t *c, button_t *b; for(b = buttons; b; b = b->next) - if(button == b->button && CLEANMASK(state) == b->mod && b->fct) + if(button == b->button && XUTIL_MASK_CLEAN(state) == b->mod && b->fct) { if(c) { @@ -350,7 +350,7 @@ event_handle_enternotify(void *data __attribute__ ((unused)), else if((emwin = xembed_getbywin(globalconf.embedded, ev->event))) xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, xutil_screen_get(connection, emwin->phys_screen)->root, - ANY_MODIFIER); + XUTIL_ANY_MODIFIER); else window_root_grabbuttons(ev->root); diff --git a/keybinding.c b/keybinding.c index 4558d74d3..332ea91d2 100644 --- a/keybinding.c +++ b/keybinding.c @@ -189,7 +189,7 @@ keybinding_t * keybinding_find(const xcb_key_press_event_t *ev) { const keybinding_array_t *arr = &keys_g.by_sym; - int l, r, mod = CLEANMASK(ev->state); + int l, r, mod = XUTIL_MASK_CLEAN(ev->state); xcb_keysym_t keysym; keysym = xcb_key_symbols_get_keysym(globalconf.keysyms, ev->detail, 0); @@ -260,7 +260,7 @@ luaA_keybinding_new(lua_State *L) for(i = 1; i <= len; i++) { lua_rawgeti(L, 2, i); - k->mod |= xutil_keymask_fromstr(luaL_checkstring(L, -1)); + k->mod |= xutil_key_mask_fromstr(luaL_checkstring(L, -1)); } return luaA_keybinding_userdata_new(L, k); diff --git a/keygrabber.c b/keygrabber.c index 03b4a98cb..329b631ca 100644 --- a/keygrabber.c +++ b/keygrabber.c @@ -601,42 +601,42 @@ keygrabber_handlekpress(lua_State *L, xcb_key_press_event_t *e) lua_newtable(L); - if(CLEANMASK(e->state) & XCB_MOD_MASK_CONTROL) + if(XUTIL_MASK_CLEAN(e->state) & XCB_MOD_MASK_CONTROL) { lua_pushliteral(L, "Control"); lua_rawseti(L, -2, i++); } - if(CLEANMASK(e->state) & XCB_MOD_MASK_LOCK) + if(XUTIL_MASK_CLEAN(e->state) & XCB_MOD_MASK_LOCK) { lua_pushliteral(L, "Lock"); lua_rawseti(L, -2, i++); } - if(CLEANMASK(e->state) & XCB_MOD_MASK_SHIFT) + if(XUTIL_MASK_CLEAN(e->state) & XCB_MOD_MASK_SHIFT) { lua_pushliteral(L, "Shift"); lua_rawseti(L, -2, i++); } - if(CLEANMASK(e->state) & XCB_MOD_MASK_1) + if(XUTIL_MASK_CLEAN(e->state) & XCB_MOD_MASK_1) { lua_pushliteral(L, "Mod1"); lua_rawseti(L, -2, i++); } - if(CLEANMASK(e->state) & XCB_MOD_MASK_2) + if(XUTIL_MASK_CLEAN(e->state) & XCB_MOD_MASK_2) { lua_pushliteral(L, "Mod2"); lua_rawseti(L, -2, i++); } - if(CLEANMASK(e->state) & XCB_MOD_MASK_3) + if(XUTIL_MASK_CLEAN(e->state) & XCB_MOD_MASK_3) { lua_pushliteral(L, "Mod3"); lua_rawseti(L, -2, i++); } - if(CLEANMASK(e->state) & XCB_MOD_MASK_4) + if(XUTIL_MASK_CLEAN(e->state) & XCB_MOD_MASK_4) { lua_pushliteral(L, "Mod4"); lua_rawseti(L, -2, i++); } - if(CLEANMASK(e->state) & XCB_MOD_MASK_5) + if(XUTIL_MASK_CLEAN(e->state) & XCB_MOD_MASK_5) { lua_pushliteral(L, "Mod5"); lua_rawseti(L, -2, i++); diff --git a/mouse.c b/mouse.c index 363d9a5db..bf8f4d6b5 100644 --- a/mouse.c +++ b/mouse.c @@ -1050,7 +1050,7 @@ luaA_mouse_new(lua_State *L) for(i = 1; i <= len; i++) { lua_rawgeti(L, 2, i); - button->mod |= xutil_keymask_fromstr(luaL_checkstring(L, -1)); + button->mod |= xutil_key_mask_fromstr(luaL_checkstring(L, -1)); } return luaA_mouse_userdata_new(L, button); diff --git a/widget.c b/widget.c index a2ab58312..b30eaa960 100644 --- a/widget.c +++ b/widget.c @@ -72,7 +72,7 @@ widget_common_button_press(widget_node_t *w, button_t *b; for(b = w->widget->buttons; b; b = b->next) - if(ev->detail == b->button && CLEANMASK(ev->state) == b->mod && b->fct) + if(ev->detail == b->button && XUTIL_MASK_CLEAN(ev->state) == b->mod && b->fct) { luaA_pushpointer(globalconf.L, p, type); luaA_dofunction(globalconf.L, b->fct, 1, 0); diff --git a/widgets/taglist.c b/widgets/taglist.c index 2c9939ce7..d2eac6bbf 100644 --- a/widgets/taglist.c +++ b/widgets/taglist.c @@ -177,7 +177,7 @@ taglist_button_press(widget_node_t *w, /* Find the good drawn area list */ if((tda = taglist_drawn_area_getbyobj(data->drawn_area, object))) for(b = w->widget->buttons; b; b = b->next) - if(ev->detail == b->button && CLEANMASK(ev->state) == b->mod && b->fct) + if(ev->detail == b->button && XUTIL_MASK_CLEAN(ev->state) == b->mod && b->fct) for(int i = 0; i < MIN(tags->len, tda->areas.len); i++) { tag_t *tag = tags->tab[i]; diff --git a/widgets/tasklist.c b/widgets/tasklist.c index 57ce67d38..48671ea4c 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -277,7 +277,7 @@ tasklist_button_press(widget_node_t *w, ci = (ev->event_x - w->area.x) / odata->box_width; for(b = w->widget->buttons; b; b = b->next) - if(ev->detail == b->button && CLEANMASK(ev->state) == b->mod && b->fct) + if(ev->detail == b->button && XUTIL_MASK_CLEAN(ev->state) == b->mod && b->fct) { luaA_pushpointer(globalconf.L, object, type); luaA_client_userdata_new(globalconf.L, odata->client_labels.tab[ci].client); diff --git a/window.c b/window.c index 4238ec6b2..88aa9accc 100644 --- a/window.c +++ b/window.c @@ -119,7 +119,7 @@ window_grabbuttons(xcb_window_t win, xcb_window_t root, button_t *buttons) b->button, b->mod | globalconf.numlockmask | XCB_MOD_MASK_LOCK); } - xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, root, ANY_MODIFIER); + xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, root, XUTIL_ANY_MODIFIER); } /** Grab all buttons on the root window.