[gimp] app: redo commit "make sure overlay widgets are keyboard navigatable"



commit 934edb75abafc31c50f084a5d8837d3feeeb8e05
Author: Michael Natterer <mitch gimp org>
Date:   Sat Jun 8 17:27:05 2013 +0200

    app: redo commit "make sure overlay widgets are keyboard navigatable"
    
    Letting just tab presses bubble up when an overlay canvas child didn't
    handle a key event isn't enough. Instead, let all key presses and
    releases bubble up if the canvas itself doesn't have the focus.
    Read: don't make assumptions.

 app/display/gimpdisplayshell-tool-events.c |   36 +++++++++++++++++-----------
 1 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 26df542..ec54e96 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -1039,6 +1039,16 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
                   }
               }
 
+            if (! gtk_widget_has_focus (shell->canvas))
+              {
+                /*  The event was in an overlay widget and not handled
+                 *  there, make sure the overlay widgets are keyboard
+                 *  navigatable by letting the generic widget handlers
+                 *  deal with the event.
+                 */
+                return FALSE;
+              }
+
             switch (kevent->keyval)
               {
               case GDK_KEY_Left:
@@ -1081,20 +1091,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
               case GDK_KEY_Tab:
               case GDK_KEY_KP_Tab:
               case GDK_KEY_ISO_Left_Tab:
-                if (! gtk_widget_has_focus (shell->canvas))
-                  {
-                    /*  The event was in an overlay widget and not
-                     *  handled there, make sure the overlay widgets
-                     *  are keyboard navigatable by letting the generic
-                     *  focus handler deal with tabs.
-                     */
-                    return FALSE;
-                  }
-                else
-                  {
-                    gimp_display_shell_tab_pressed (shell, kevent);
-                    return_val = TRUE;
-                  }
+                gimp_display_shell_tab_pressed (shell, kevent);
+                return_val = TRUE;
                 break;
 
                 /*  Update the state based on modifiers being pressed  */
@@ -1170,6 +1168,16 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
                   }
               }
 
+            if (! gtk_widget_has_focus (shell->canvas))
+              {
+                /*  The event was in an overlay widget and not handled
+                 *  there, make sure the overlay widgets are keyboard
+                 *  navigatable by letting the generic widget handlers
+                 *  deal with the event.
+                 */
+                return FALSE;
+              }
+
             switch (kevent->keyval)
               {
               case GDK_KEY_space:


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