From 8017b75de4c2a77245f5ae9d635cc026c00783a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Tue, 9 Jan 2018 19:37:56 +0100 Subject: Refactoring --- main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 41ae8b2..04e155a 100644 --- a/main.c +++ b/main.c @@ -566,22 +566,20 @@ end: void on_keypress(XKeyEvent *kev) { int i; - unsigned int sh; + unsigned int sh = 0; KeySym ksym, shksym; - char key; + char dummy, key; bool dirty = false; + XLookupString(kev, &key, 1, &ksym, NULL); + if (kev->state & ShiftMask) { kev->state &= ~ShiftMask; - XLookupString(kev, &key, 1, &shksym, NULL); + XLookupString(kev, &dummy, 1, &shksym, NULL); kev->state |= ShiftMask; - XLookupString(kev, &key, 1, &ksym, NULL); - sh = ksym != shksym ? ShiftMask : 0; - } else { - XLookupString(kev, &key, 1, &ksym, NULL); - sh = 0; + if (ksym != shksym) + sh = ShiftMask; } - if (IsModifierKey(ksym)) return; if (ksym == XK_Escape && MODMASK(kev->state) == 0) { -- cgit v1.2.3