mirror of https://github.com/GNOME/gimp.git
app: add log output of key event handling in GimpWindow
using the "key-events" debug key.
This commit is contained in:
parent
5930b13084
commit
3e2714508f
|
@ -49,8 +49,9 @@ gimp_log_init (void)
|
|||
{ "scale", GIMP_LOG_SCALE },
|
||||
{ "wm", GIMP_LOG_WM },
|
||||
{ "floating-selection", GIMP_LOG_FLOATING_SELECTION },
|
||||
{ "shm", GIMP_LOG_SHM },
|
||||
{ "text-editing", GIMP_LOG_TEXT_EDITING },
|
||||
{ "shm", GIMP_LOG_SHM }
|
||||
{ "key-events", GIMP_LOG_KEY_EVENTS }
|
||||
};
|
||||
|
||||
/* g_parse_debug_string() has special treatment of the string 'help',
|
||||
|
|
|
@ -34,7 +34,8 @@ typedef enum
|
|||
GIMP_LOG_WM = 1 << 10,
|
||||
GIMP_LOG_FLOATING_SELECTION = 1 << 11,
|
||||
GIMP_LOG_SHM = 1 << 12,
|
||||
GIMP_LOG_TEXT_EDITING = 1 << 13
|
||||
GIMP_LOG_TEXT_EDITING = 1 << 13,
|
||||
GIMP_LOG_KEY_EVENTS = 1 << 14
|
||||
} GimpLogFlags;
|
||||
|
||||
|
||||
|
@ -89,6 +90,7 @@ void gimp_logv (const gchar *function,
|
|||
#define FLOATING_SELECTION GIMP_LOG_FLOATING_SELECTION
|
||||
#define SHM GIMP_LOG_SHM
|
||||
#define TEXT_EDITING GIMP_LOG_TEXT_EDITING
|
||||
#define KEY_EVENTS GIMP_LOG_KEY_EVENTS
|
||||
|
||||
#if 0 /* last resort */
|
||||
# define GIMP_LOG /* nothing => no varargs, no log */
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include "gimpwindow.h"
|
||||
|
||||
#include "gimp-log.h"
|
||||
|
||||
|
||||
static gboolean gimp_window_key_press_event (GtkWidget *widget,
|
||||
GdkEventKey *kevent);
|
||||
|
@ -65,20 +67,44 @@ gimp_window_key_press_event (GtkWidget *widget,
|
|||
if (GTK_IS_EDITABLE (focus) ||
|
||||
GTK_IS_TEXT_VIEW (focus) ||
|
||||
GIMP_IS_CANVAS (focus))
|
||||
{
|
||||
handled = gtk_window_propagate_key_event (window, event);
|
||||
|
||||
if (handled)
|
||||
GIMP_LOG (KEY_EVENTS,
|
||||
"handled by gtk_window_propagate_key_event(text_widget)");
|
||||
}
|
||||
|
||||
/* invoke control/alt accelerators */
|
||||
if (! handled && event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))
|
||||
{
|
||||
handled = gtk_window_activate_key (window, event);
|
||||
|
||||
if (handled)
|
||||
GIMP_LOG (KEY_EVENTS,
|
||||
"handled by gtk_window_activate_key(modified)");
|
||||
}
|
||||
|
||||
/* invoke focus widget handlers */
|
||||
if (! handled)
|
||||
{
|
||||
handled = gtk_window_propagate_key_event (window, event);
|
||||
|
||||
if (handled)
|
||||
GIMP_LOG (KEY_EVENTS,
|
||||
"handled by gtk_window_propagate_key_event(other_widget)");
|
||||
}
|
||||
|
||||
/* invoke non-(control/alt) accelerators */
|
||||
if (! handled && ! (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
|
||||
{
|
||||
handled = gtk_window_activate_key (window, event);
|
||||
|
||||
if (handled)
|
||||
GIMP_LOG (KEY_EVENTS,
|
||||
"handled by gtk_window_activate_key(unmodified)");
|
||||
}
|
||||
|
||||
/* chain up, bypassing gtk_window_key_press(), to invoke binding set */
|
||||
if (! handled)
|
||||
{
|
||||
|
@ -87,6 +113,10 @@ gimp_window_key_press_event (GtkWidget *widget,
|
|||
widget_class = g_type_class_peek_static (g_type_parent (GTK_TYPE_WINDOW));
|
||||
|
||||
handled = widget_class->key_press_event (widget, event);
|
||||
|
||||
if (handled)
|
||||
GIMP_LOG (KEY_EVENTS,
|
||||
"handled by widget_class->key_press_event()");
|
||||
}
|
||||
|
||||
return handled;
|
||||
|
|
Loading…
Reference in New Issue