[gimp/soc-2010-cage] app: Make zoom focus with keyboard work again



commit 90f5b7a25309c02af5e3bd7af9068322151e0804
Author: Martin Nordholts <martinn src gnome org>
Date:   Sat Jun 12 15:36:14 2010 +0200

    app: Make zoom focus with keyboard work again
    
    Make zoom focus with keyboard work again, it broke when
    GimpDisplayShell stopped being a GtkWindow and thus the source of key
    events.

 app/display/gimpdisplayshell-scale.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c
index 3c62cf6..c167947 100644
--- a/app/display/gimpdisplayshell-scale.c
+++ b/app/display/gimpdisplayshell-scale.c
@@ -1023,10 +1023,13 @@ gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
 
   /* Calculate other focus point */
   {
-    GdkEvent *event;
-    gboolean  event_looks_sane;
-    gboolean  cursor_within_canvas;
-    gint      canvas_pointer_x, canvas_pointer_y;
+    GdkEvent  *event;
+    GtkWidget *window;
+    gboolean   event_looks_sane;
+    gboolean   cursor_within_canvas;
+    gint       canvas_pointer_x, canvas_pointer_y;
+
+    window = GTK_WIDGET (gimp_display_shell_get_window (shell));
 
     /*  Center on the mouse position instead of the display center if
      *  one of the following conditions are fulfilled and pointer is
@@ -1035,7 +1038,7 @@ gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
      *   (1) there's no current event (the action was triggered by an
      *       input controller)
      *   (2) the event originates from the canvas (a scroll event)
-     *   (3) the event originates from the shell (a key press event)
+     *   (3) the event originates from the window (a key press event)
      *
      *  Basically the only situation where we don't want to center on
      *  mouse position is if the action is being called from a menu.
@@ -1043,9 +1046,9 @@ gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
 
     event = gtk_get_current_event ();
 
-    event_looks_sane = ! event ||
-                       gtk_get_event_widget (event) == shell->canvas ||
-                       gtk_get_event_widget (event) == GTK_WIDGET (shell);
+    event_looks_sane = (! event ||
+                        gtk_get_event_widget (event) == shell->canvas ||
+                        gtk_get_event_widget (event) == window);
 
 
     gtk_widget_get_pointer (shell->canvas,



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