[gimp] app: improve GimpTool::button_release(GIMP_BUTTON_RELEASE_CLICK)



commit 74606d0bbd5083910f69db7562d33e52b46deca0
Author: Michael Natterer <mitch gimp org>
Date:   Thu Apr 27 20:23:24 2017 +0200

    app: improve GimpTool::button_release(GIMP_BUTTON_RELEASE_CLICK)
    
    when a click is detected by gimp_tool_check_click_distance(), only do
    a motion() back to the button_press() coordinates if there has been a
    motion at all since button_press(). This should not change any tool's
    behavior, it's only an optimization to keep tools from doing useless
    work.

 app/tools/gimptool.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c
index 2ed0259..eaa1d62 100644
--- a/app/tools/gimptool.c
+++ b/app/tools/gimptool.c
@@ -712,12 +712,16 @@ gimp_tool_button_release (GimpTool         *tool,
           release_type = GIMP_BUTTON_RELEASE_CLICK;
           my_coords    = tool->button_press_coords;
 
-          /*  synthesize a motion event back to the recorded press
-           *  coordinates
-           */
-          GIMP_TOOL_GET_CLASS (tool)->motion (tool, &my_coords, time,
-                                              state & GDK_BUTTON1_MASK,
-                                              display);
+          if (tool->got_motion_event)
+            {
+              /*  if there has been a motion() since button_press(),
+               *  synthesize a motion() back to the recorded press
+               *  coordinates
+               */
+              GIMP_TOOL_GET_CLASS (tool)->motion (tool, &my_coords, time,
+                                                  state & GDK_BUTTON1_MASK,
+                                                  display);
+            }
         }
       else if (! tool->got_motion_event)
         {


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