[gtk/matthiasc/for-master: 3/4] shortcutcontroller: Add some debug spew



commit 64db05d3dd6adcb5b01389634185fb7dee7b621f
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 26 22:12:42 2020 -0400

    shortcutcontroller: Add some debug spew
    
    This helps in debugging event routing and keyboard
    shortcut issues.

 gtk/gtkshortcutcontroller.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/gtk/gtkshortcutcontroller.c b/gtk/gtkshortcutcontroller.c
index d90a181428..19c3d793dd 100644
--- a/gtk/gtkshortcutcontroller.c
+++ b/gtk/gtkshortcutcontroller.c
@@ -74,6 +74,7 @@
 #include "gtktypebuiltins.h"
 #include "gtkwidgetprivate.h"
 #include "gtknative.h"
+#include "gtkdebug.h"
 
 #include <gdk/gdk.h>
 
@@ -370,6 +371,18 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
       data->widget = widget;
     }
 
+#ifdef G_ENABLE_DEBUG
+  if (GTK_DEBUG_CHECK (KEYBINDINGS))
+    {
+      g_message ("Found %u shortcuts triggered %s by %s %u %u",
+                 shortcuts ? shortcuts->len : 0,
+                 has_exact ? "exactly" : "approximately",
+                 gdk_event_get_event_type (event) == GDK_KEY_PRESS ? "key press" : "key release",
+                 gdk_key_event_get_keyval (event),
+                 gdk_event_get_modifier_state (event));
+    }
+#endif
+
   if (!shortcuts)
     return retval;
 


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