[gimp] app: fix and improve text style overlay keyboard interaction



commit 67ba62154e22d23d0a9f5c8fba61ccc547e9a2ab
Author: Michael Natterer <mitch gimp org>
Date:   Wed May 12 19:00:18 2010 +0200

    app: fix and improve text style overlay keyboard interaction
    
    - app/widgets/gimptextstyleeditor.c: don't block all key events so
      they can reach the canvas.
    
    - app/display/gimpdisplayshell-callbacks.c: instead, ignore canvas key
      events when the canvas has no focus.
    
    This fixes navigating out of the text style editor with TAB, moving
    focus to the canvas. I have no clue why navigating *between* the
    widgets in the style editor doesn't work.

 app/display/gimpdisplayshell-callbacks.c |   11 +++++++----
 app/widgets/gimptextstyleeditor.c        |    8 --------
 2 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index 05719a5..52159c0 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -657,11 +657,14 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
   /*  ignore events on overlays, but make sure key events go through
    *  anyway because they are always originating from the toplevel
    */
-  if (event->type != GDK_KEY_PRESS   &&
-      event->type != GDK_KEY_RELEASE &&
-      ((GdkEventAny *) event)->window != gtk_widget_get_window (canvas))
+  if (((GdkEventAny *) event)->window != gtk_widget_get_window (canvas))
     {
-      return FALSE;
+      if ((event->type != GDK_KEY_PRESS &&
+           event->type != GDK_KEY_RELEASE) ||
+          ! gtk_widget_has_focus (canvas))
+        {
+          return FALSE;
+        }
     }
 
   display = shell->display;
diff --git a/app/widgets/gimptextstyleeditor.c b/app/widgets/gimptextstyleeditor.c
index a781e9d..f0f6da4 100644
--- a/app/widgets/gimptextstyleeditor.c
+++ b/app/widgets/gimptextstyleeditor.c
@@ -167,14 +167,6 @@ gimp_text_style_editor_init (GimpTextStyleEditor *editor)
 {
   GtkWidget *image;
 
-  /*  don't let unhandled key events drop through to the text editor  */
-  g_signal_connect_after (editor, "key-press-event",
-                          G_CALLBACK (gtk_true),
-                          NULL);
-  g_signal_connect_after (editor, "key-release-event",
-                          G_CALLBACK (gtk_false),
-                          NULL);
-
   /*  upper row  */
 
   editor->upper_hbox = gtk_hbox_new (FALSE, 0);



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