dwmstatus: use XkbLookupKeysym

This commit is contained in:
Přemysl Eric Janouch 2016-02-11 03:56:42 +01:00
parent 945f620a3c
commit 16c8110469
1 changed files with 6 additions and 3 deletions

View File

@ -2713,10 +2713,13 @@ static void
on_x_keypress (struct app_context *ctx, XEvent *e) on_x_keypress (struct app_context *ctx, XEvent *e)
{ {
XKeyEvent *ev = &e->xkey; XKeyEvent *ev = &e->xkey;
KeySym keysym = XkbKeycodeToKeysym (ctx->dpy, (KeyCode) ev->keycode, unsigned unconsumed_mods;
0 /* XXX: current group? */, !!(ev->state & ShiftMask)); KeySym keysym;
if (!XkbLookupKeySym (ctx->dpy,
(KeyCode) ev->keycode, ev->state, &unconsumed_mods, &keysym))
return;
for (size_t i = 0; i < N_ELEMENTS (g_keys); i++) for (size_t i = 0; i < N_ELEMENTS (g_keys); i++)
if (keysym == g_keys[i].keysym if (g_keys[i].keysym == keysym
&& g_keys[i].mod == ev->state && g_keys[i].mod == ev->state
&& g_keys[i].handler) && g_keys[i].handler)
g_keys[i].handler (ctx, g_keys[i].arg); g_keys[i].handler (ctx, g_keys[i].arg);