[gimp] app: ignore new button events on the canvas while another button is down



commit ea49a7b466ec32fcad3b366a5bc63365e1744260
Author: Michael Natterer <mitch gimp org>
Date:   Fri Dec 9 20:53:11 2011 +0100

    app: ignore new button events on the canvas while another button is down
    
    Fixes tons of possibly dangerous warnings, and likely some weird
    crashes.

 app/display/gimpdisplayshell-tool-events.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 75d0cb9..5e149d1 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -447,6 +447,14 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
         GdkEventMask    event_mask;
         GimpTool       *active_tool;
 
+        /*  ignore new mouse events  */
+        if (gimp->busy || shell->scrolling)
+          return TRUE;
+
+        /* ignore new buttons while another button is down */
+        if (state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
+          return TRUE;
+
         /*  focus the widget if it isn't; if the toplevel window
          *  already has focus, this will generate a FOCUS_IN on the
          *  canvas immediately, therefore we do this before logging
@@ -466,10 +474,6 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
         gimp_display_shell_update_cursor (shell, &display_coords,
                                           &image_coords, state, FALSE);
 
-        /*  ignore new mouse events  */
-        if (gimp->busy || shell->scrolling)
-          return TRUE;
-
         active_tool = tool_manager_get_active (gimp);
 
         state |= gimp_display_shell_button_to_state (bevent->button);
@@ -643,7 +647,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
 
         if (bevent->button == 1)
           {
-            if (! shell->pointer_grabbed)
+            if (! shell->pointer_grabbed || shell->scrolling)
               return TRUE;
 
             if (! shell->space_pressed && ! shell->space_release_pending)



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