Remove some unused fields from globalconf

These fields were only ever written to since commit 19137a55c3.
This commit removes the fields and the code that sets them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-12-22 17:25:45 +01:00
parent b70af4cf2b
commit 4ad516c63a
4 changed files with 1 additions and 77 deletions

View file

@ -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();

View file

@ -27,65 +27,6 @@
#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
/** 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)
{

10
event.c
View file

@ -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);

View file

@ -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 */