[gtk: 3/3] Add GTK_DEBUG=shortcuts



commit 8ce1034e874e4ae74a3c51e5d8efa0f9d5af6297
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 29 17:58:33 2020 -0400

    Add GTK_DEBUG=shortcuts
    
    If the shortcuts debug flag is set, print out
    shortcut activations.

 gtk/gtkdebug.h          | 1 +
 gtk/gtkmain.c           | 1 +
 gtk/gtkshortcutaction.c | 7 +++++++
 3 files changed, 9 insertions(+)
---
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index d3ef264cd1..a615921b19 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -45,6 +45,7 @@ typedef enum {
   GTK_DEBUG_BUILDER         = 1 <<  7,
   GTK_DEBUG_SIZE_REQUEST    = 1 <<  8,
   GTK_DEBUG_NO_CSS_CACHE    = 1 <<  9,
+  GTK_DEBUG_SHORTCUTS       = 1 << 10,
   GTK_DEBUG_INTERACTIVE     = 1 << 11,
   GTK_DEBUG_TOUCHSCREEN     = 1 << 12,
   GTK_DEBUG_ACTIONS         = 1 << 13,
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 0088a5d8c1..03437167cf 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -170,6 +170,7 @@ static const GDebugKey gtk_debug_keys[] = {
   { "builder", GTK_DEBUG_BUILDER },
   { "size-request", GTK_DEBUG_SIZE_REQUEST },
   { "no-css-cache", GTK_DEBUG_NO_CSS_CACHE },
+  { "shortcuts", GTK_DEBUG_SHORTCUTS },
   { "interactive", GTK_DEBUG_INTERACTIVE },
   { "touchscreen", GTK_DEBUG_TOUCHSCREEN },
   { "actions", GTK_DEBUG_ACTIONS },
diff --git a/gtk/gtkshortcutaction.c b/gtk/gtkshortcutaction.c
index d831ce42bd..98f113c947 100644
--- a/gtk/gtkshortcutaction.c
+++ b/gtk/gtkshortcutaction.c
@@ -56,6 +56,7 @@
 #include "gtkbuilder.h"
 #include "gtkintl.h"
 #include "gtkwidgetprivate.h"
+#include "gtkdebug.h"
 
 /* {{{ GtkShortcutAction */
 
@@ -158,6 +159,12 @@ gtk_shortcut_action_activate (GtkShortcutAction      *self,
   g_return_val_if_fail (GTK_IS_SHORTCUT_ACTION (self), FALSE);
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
+  GTK_NOTE (SHORTCUTS, {
+            char *act = gtk_shortcut_action_to_string (self);
+            g_print ("Shortcut action activate on %s: %s\n", G_OBJECT_TYPE_NAME (widget), act);
+            g_free (act);
+            });
+
   return GTK_SHORTCUT_ACTION_GET_CLASS (self)->activate (self, flags, widget, args);
 }
 


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