From 6afea7421a9d50cc37d1d596389b8b34d5a351e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Fri, 22 Aug 2014 11:16:35 +0000 Subject: [PATCH] [GB.GTK] * NEW: Add an environment variable to debug keypress events. git-svn-id: svn://localhost/gambas/trunk@6420 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.gtk/src/gapplication.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gb.gtk/src/gapplication.cpp b/gb.gtk/src/gapplication.cpp index c127f8986..32a28aa8a 100644 --- a/gb.gtk/src/gapplication.cpp +++ b/gb.gtk/src/gapplication.cpp @@ -42,6 +42,8 @@ //#define DEBUG_ENTER_LEAVE 1 +static bool _debug_keypress = false; + /************************************************************************** Global event handler @@ -238,8 +240,8 @@ static void gambas_handle_event(GdkEvent *event) if (!widget) goto __HANDLE_EVENT; - /*if (event->type == GDK_KEY_PRESS) - fprintf(stderr, "GDK_KEY_PRESS: keyval = %d state = %08X is_modifier = %d\n", event->key.keyval, event->key.state, event->key.is_modifier);*/ + if (_debug_keypress && event->type == GDK_KEY_PRESS) + fprintf(stderr, "GDK_KEY_PRESS: keyval = %d state = %08X is_modifier = %d\n", event->key.keyval, event->key.state, event->key.is_modifier); if ((event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) && (event->key.state & ~GDK_MODIFIER_MASK) == 0) { @@ -997,6 +999,10 @@ void gApplication::init(int *argc, char ***argv) _loop_owner = 0; + char *env = getenv("GB_GTK_DEBUG_KEYPRESS"); + if (env && strcmp(env, "0")) + _debug_keypress = true; + /*#ifdef GTK3 // patch GtkRange class GtkWidgetClass *klass;