Add GTK_DEBUG=shortcuts

If the shortcuts debug flag is set, print out
shortcut activations.
This commit is contained in:
Matthias Clasen 2020-05-29 17:58:33 -04:00
parent a39d708859
commit 8ce1034e87
3 changed files with 9 additions and 0 deletions

View File

@ -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,

View File

@ -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 },

View File

@ -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);
}