[gtk+] wayland: Some more debug spew



commit b8a86e6ca4fd3cf64ae0c2d014b4355dc9315146
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 19 12:43:03 2016 -0400

    wayland: Some more debug spew
    
    Print the modifiers and their mapping out as well. This
    information is contained in the keymap, but this is a bit
    easier to digest.

 gdk/wayland/gdkkeys-wayland.c |   42 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c
index a4f39d3..086e4de 100644
--- a/gdk/wayland/gdkkeys-wayland.c
+++ b/gdk/wayland/gdkkeys-wayland.c
@@ -552,6 +552,46 @@ _gdk_wayland_keymap_new (void)
   return GDK_KEYMAP (keymap);
 }
 
+#ifdef G_ENABLE_DEBUG
+static void
+print_modifiers (struct xkb_keymap *keymap)
+{
+  int i, j;
+  uint32_t real;
+  struct xkb_state *state;
+
+  g_print ("modifiers:\n");
+  for (i = 0; i < xkb_keymap_num_mods (keymap); i++)
+    g_print ("%s ", xkb_keymap_mod_get_name (keymap, i));
+  g_print ("\n\n");
+
+  g_print ("modifier mapping\n");
+  state = xkb_state_new (keymap);
+  for (i = 0; i < 8; i++)
+    {
+      gboolean need_arrow = TRUE;
+      g_print ("%s ", xkb_keymap_mod_get_name (keymap, i));
+      for (j = 8; j < xkb_keymap_num_mods (keymap); j++)
+        {
+          xkb_state_update_mask (state, 1 << j, 0, 0, 0, 0, 0);
+          real = xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE);
+          if (real & (1 << i))
+            {
+              if (need_arrow)
+                {
+                  g_print ("-> ");
+                  need_arrow = FALSE;
+                }
+              g_print ("%s ", xkb_keymap_mod_get_name (keymap, j));
+            }
+        }
+      g_print ("\n");
+    }
+
+  xkb_state_unref (state);
+}
+#endif
+
 void
 _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
                                     uint32_t   format,
@@ -585,6 +625,8 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
       return;
     }
 
+  GDK_NOTE(INPUT, print_modifiers (xkb_keymap));
+
   xkb_keymap_unref (keymap_wayland->xkb_keymap);
   keymap_wayland->xkb_keymap = xkb_keymap;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]