[gimp] app: handle canvas overlays better in gimp_window_key_press_event()



commit 24d150f537e7d4d5613219d73a88f3fe4d6cca3f
Author: Michael Natterer <mitch gimp org>
Date:   Thu Apr 25 23:49:29 2013 +0200

    app: handle canvas overlays better in gimp_window_key_press_event()
    
    forward events first not only if a GimpCanvas has the focus, but also
    it one of its children has.

 app/widgets/gimpwindow.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpwindow.c b/app/widgets/gimpwindow.c
index 4bcf607..18ff6d3 100644
--- a/app/widgets/gimpwindow.c
+++ b/app/widgets/gimpwindow.c
@@ -86,9 +86,11 @@ gimp_window_key_press_event (GtkWidget   *widget,
    */
 
   /* text widgets get all key events first */
-  if (GTK_IS_EDITABLE (focus)  ||
-      GTK_IS_TEXT_VIEW (focus) ||
-      GIMP_IS_CANVAS (focus))
+  if (focus &&
+      (GTK_IS_EDITABLE (focus)  ||
+       GTK_IS_TEXT_VIEW (focus) ||
+       GIMP_IS_CANVAS (focus)   ||
+       gtk_widget_get_ancestor (focus, GIMP_TYPE_CANVAS)))
     {
       handled = gtk_window_propagate_key_event (window, event);
 
@@ -104,7 +106,8 @@ gimp_window_key_press_event (GtkWidget   *widget,
         geimnum (eb);
     }
 
-  if (event->keyval == GDK_KEY_Escape && gimp_window->primary_focus_widget)
+  if (! handled &&
+      event->keyval == GDK_KEY_Escape && gimp_window->primary_focus_widget)
     {
       if (focus != gimp_window->primary_focus_widget)
         gtk_widget_grab_focus (gimp_window->primary_focus_widget);


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