diff --git a/awesome.c b/awesome.c index aae5062d..3cc22c10 100644 --- a/awesome.c +++ b/awesome.c @@ -630,8 +630,6 @@ main(int argc, char **argv) /* Allocate the key symbols */ globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection); - xcb_get_modifier_mapping_cookie_t xmapping_cookie = - xcb_get_modifier_mapping_unchecked(globalconf.connection); /* init atom cache */ atoms_init(globalconf.connection); @@ -639,11 +637,6 @@ main(int argc, char **argv) /* init screens information */ screen_scan(); - xutil_lock_mask_get(globalconf.connection, xmapping_cookie, - globalconf.keysyms, &globalconf.numlockmask, - &globalconf.shiftlockmask, &globalconf.capslockmask, - &globalconf.modeswitchmask); - /* do this only for real screen */ ewmh_init(); systray_init(); diff --git a/common/xutil.c b/common/xutil.c index 8e96b246..7ae62490 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -27,65 +27,6 @@ #include #include -/** Get the lock masks (shiftlock, numlock, capslock, modeswitch). - * \param connection The X connection. - * \param cookie The cookie of the request. - * \param keysyms Key symbols. - * \param numlockmask Numlock mask. - * \param shiftlockmask Shiftlock mask. - * \param capslockmask Capslock mask. - * \todo Split this. - */ -void -xutil_lock_mask_get(xcb_connection_t *connection, - xcb_get_modifier_mapping_cookie_t cookie, - xcb_key_symbols_t *keysyms, - uint16_t *numlockmask, - uint16_t *shiftlockmask, - uint16_t *capslockmask, - uint16_t *modeswitchmask) -{ - xcb_get_modifier_mapping_reply_t *modmap_r; - xcb_keycode_t *modmap, kc; - xcb_keycode_t *numlockcodes = xcb_key_symbols_get_keycode(keysyms, XK_Num_Lock); - xcb_keycode_t *shiftlockcodes = xcb_key_symbols_get_keycode(keysyms, XK_Shift_Lock); - xcb_keycode_t *capslockcodes = xcb_key_symbols_get_keycode(keysyms, XK_Caps_Lock); - xcb_keycode_t *modeswitchcodes = xcb_key_symbols_get_keycode(keysyms, XK_Mode_switch); - - modmap_r = xcb_get_modifier_mapping_reply(connection, cookie, NULL); - modmap = xcb_get_modifier_mapping_keycodes(modmap_r); - - /* reset */ - *numlockmask = *shiftlockmask = *capslockmask = *modeswitchmask = 0; - - int i; - for(i = 0; i < 8; i++) - for(int j = 0; j < modmap_r->keycodes_per_modifier; j++) - { - kc = modmap[i * modmap_r->keycodes_per_modifier + j]; - -#define LOOK_FOR(mask, codes) \ - if(*mask == 0 && codes) \ - for(xcb_keycode_t *ktest = codes; *ktest; ktest++) \ - if(*ktest == kc) \ - { \ - *mask = (1 << i); \ - break; \ - } - - LOOK_FOR(numlockmask, numlockcodes) - LOOK_FOR(shiftlockmask, shiftlockcodes) - LOOK_FOR(capslockmask, capslockcodes) - LOOK_FOR(modeswitchmask, modeswitchcodes) -#undef LOOK_FOR - } - p_delete(&numlockcodes); - p_delete(&shiftlockcodes); - p_delete(&capslockcodes); - p_delete(&modeswitchcodes); - p_delete(&modmap_r); -} - uint16_t xutil_key_mask_fromstr(const char *keyname) { diff --git a/event.c b/event.c index 4de18274..0d2f8090 100644 --- a/event.c +++ b/event.c @@ -837,19 +837,11 @@ event_handle_mappingnotify(xcb_mapping_notify_event_t *ev) if(ev->request == XCB_MAPPING_MODIFIER || ev->request == XCB_MAPPING_KEYBOARD) { - xcb_get_modifier_mapping_cookie_t xmapping_cookie = - xcb_get_modifier_mapping_unchecked(globalconf.connection); - /* Free and then allocate the key symbols */ xcb_key_symbols_free(globalconf.keysyms); globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection); - xutil_lock_mask_get(globalconf.connection, xmapping_cookie, - globalconf.keysyms, &globalconf.numlockmask, - &globalconf.shiftlockmask, &globalconf.capslockmask, - &globalconf.modeswitchmask); - - /* regrab everything */ + /* regrab everything TODO: Move this to xkb.c suitably */ xcb_screen_t *s = globalconf.screen; xwindow_grabkeys(s->root, &globalconf.keys); diff --git a/globalconf.h b/globalconf.h index 523474ce..f936369e 100644 --- a/globalconf.h +++ b/globalconf.h @@ -88,8 +88,6 @@ typedef struct xcb_atom_t selection_atom; /** Window owning the WM_Sn selection */ xcb_window_t selection_owner_window; - /** Modifiers masks */ - uint16_t numlockmask, shiftlockmask, capslockmask, modeswitchmask; /** Check for XTest extension */ bool have_xtest; /** Check for SHAPE extension */