[gimp] app: fix event reordering during motion compression



commit b737463a3b6fe581aa233729ed8934c7b97f31b6
Author: Ell <ell_se yahoo com>
Date:   Sun Jun 11 18:50:36 2017 -0400

    app: fix event reordering during motion compression
    
    ... due to commit 5543a9da4f168c2c30ff06d358f8f48f3a250b88

 app/display/gimpdisplayshell-tool-events.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index d08ed13..262a9e7 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -1986,8 +1986,27 @@ gimp_display_shell_compress_motion (GdkEvent *initial_event)
         }
       else
         {
-          gdk_event_put (event);
-          gdk_event_free (event);
+          GSList *remaining_events = NULL;
+
+          /* Put the event back at the front of the queue... the hard way :P */
+          remaining_events = g_slist_prepend (remaining_events, event);
+
+          while (gdk_events_pending ())
+            if ((event = gdk_event_get ()))
+              remaining_events = g_slist_prepend (remaining_events, event);
+
+          remaining_events = g_slist_reverse (remaining_events);
+
+          while (remaining_events)
+            {
+              event = remaining_events->data;
+
+              gdk_event_put (event);
+              gdk_event_free (event);
+
+              remaining_events = g_slist_delete_link (remaining_events,
+                                                      remaining_events);
+            }
 
           break;
         }


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