shortcutcontroller: Add some debug spew

This helps in debugging event routing and keyboard
shortcut issues.
This commit is contained in:
Matthias Clasen 2020-06-26 22:12:42 -04:00
parent 913cd91df0
commit 64db05d3dd

View File

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