chiark / gitweb /
terminal/idev: don't remove consumed-mods from kbd-matches
authorDavid Herrmann <dh.herrmann@gmail.com>
Sun, 5 Oct 2014 15:44:09 +0000 (17:44 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sun, 5 Oct 2014 16:02:28 +0000 (18:02 +0200)
XKB consumed mods include modifiers that *didn't* affect the translation,
but might affect it if used. This is very misleading, given that we are
usually not interested in that information. Therefore, keep them in real
mods to behave like X11 does. Maybe at some point, XKB introduces proper
shortcut matching...

Also make evcat display consumed modifiers so we can better debug those
situations.

src/libsystemd-terminal/evcat.c
src/libsystemd-terminal/idev.h

index 62556f6a2b4e83f1b9d1025ba373115b6d91b2dd..9e8a262b79ae6fb7d2a5aa5169dc799ffc875da1 100644 (file)
@@ -219,6 +219,13 @@ static void kdata_print(idev_data *data) {
         printf(" %-5s", (k->mods & IDEV_KBDMOD_LINUX) ? "LINUX" : "");
         printf(" %-4s", (k->mods & IDEV_KBDMOD_CAPS) ? "CAPS" : "");
 
+        /* Consumed modifiers */
+        printf(" | %-5s", (k->consumed_mods & IDEV_KBDMOD_SHIFT) ? "SHIFT" : "");
+        printf(" %-4s", (k->consumed_mods & IDEV_KBDMOD_CTRL) ? "CTRL" : "");
+        printf(" %-3s", (k->consumed_mods & IDEV_KBDMOD_ALT) ? "ALT" : "");
+        printf(" %-5s", (k->consumed_mods & IDEV_KBDMOD_LINUX) ? "LINUX" : "");
+        printf(" %-4s", (k->consumed_mods & IDEV_KBDMOD_CAPS) ? "CAPS" : "");
+
         /* Resolved symbols */
         printf(" |");
         for (i = 0; i < k->n_syms; ++i) {
index ea79bb6ab6224a97350cdb8800a7eb8cf1350af4..c8c03f3d41be9937182fb184252f46e0f0fda544 100644 (file)
@@ -123,7 +123,7 @@ static inline bool idev_kbdmatch(idev_data_keyboard *kdata,
                 return false;
 
         real = kdata->mods & ~kdata->consumed_mods & significant;
-        if (real != (mods & ~kdata->consumed_mods))
+        if (real != mods)
                 return false;
 
         return !memcmp(syms, kdata->keysyms, n_syms * sizeof(*syms));