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.
This commit is contained in:
Michael Natterer 2017-04-27 20:23:24 +02:00
parent e0dcf538e5
commit 74606d0bbd
1 changed files with 10 additions and 6 deletions

View File

@ -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)
{