[gimp] app: flush the event queue unconditionally on BUTTON_RELEASE



commit 7ab72eb54a4b7940c99e9ec896c44f36795b7713
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 17 19:21:46 2011 +0200

    app: flush the event queue unconditionally on BUTTON_RELEASE
    
    The flashing function checks for a non-empty queue by itself. Also
    remove the timeout source explicitly in flush_event_queue() because it
    might be called directly, and its FALSE return value has no effect on
    the timeout source in that case.

 app/display/gimpdisplayshell-tool-events.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 3adf6f9..94acc17 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -663,8 +663,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
               {
                 if (gimp_tool_control_is_active (active_tool->control))
                   {
-                    if (shell->motion_buffer->event_queue->len > 0)
-                      gimp_display_shell_flush_event_queue (shell);
+                    gimp_display_shell_flush_event_queue (shell);
 
                     tool_manager_button_release_active (gimp,
                                                         &image_coords,
@@ -1731,8 +1730,14 @@ gimp_display_shell_flush_event_queue (GimpDisplayShell *shell)
 
   shell->motion_buffer->event_delay = FALSE;
 
-  /* Set the timeout id to 0 */
-  shell->motion_buffer->event_delay_timeout = 0;
+  /*  Remove the timeout explicitly because this function might be
+   *  called directly (not via the timeout)
+   */
+  if (shell->motion_buffer->event_delay_timeout)
+    {
+      g_source_remove (shell->motion_buffer->event_delay_timeout);
+      shell->motion_buffer->event_delay_timeout = 0;
+    }
 
   if (active_tool                                        &&
       gimp_tool_control_is_active (active_tool->control) &&
@@ -1777,8 +1782,11 @@ gimp_display_shell_process_event_queue (GimpDisplayShell *shell,
       event_state = state; /* Save the state */
     }
 
-  if (shell->motion_buffer->event_delay_timeout != 0)
-    g_source_remove (shell->motion_buffer->event_delay_timeout);
+  if (shell->motion_buffer->event_delay_timeout)
+    {
+      g_source_remove (shell->motion_buffer->event_delay_timeout);
+      shell->motion_buffer->event_delay_timeout = 0;
+    }
 
   shell->motion_buffer->last_active_state = state;
 



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