app: make switching paint tools to color picker mode more robust

Don't rely on the exact modifier being pressed or released. Instead,
check if only the right modifier is pressed after *each* modifier
change, and switch to color picking if it is; disable color picking
otherwise. This greatly reduces the risk of missing the user's wish to
pick colors because of other modifiers being pressed and released in
whatever order.

Probably fixes bug #734743.
This commit is contained in:
Michael Natterer
2016-11-16 13:16:24 +01:00
parent 61f91c7cd2
commit 014fdb87e5

View File

@ -472,12 +472,12 @@ gimp_paint_tool_modifier_key (GimpTool *tool,
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (key != gimp_get_constrain_behavior_mask ())
return;
if (paint_tool->pick_colors && ! paint_tool->draw_line)
{
if (press)
if ((state & gimp_get_all_modifiers_mask ()) ==
gimp_get_constrain_behavior_mask ())
{
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
GimpToolInfo *info = gimp_get_tool_info (display->gimp,
"gimp-color-picker-tool");
@ -509,6 +509,7 @@ gimp_paint_tool_modifier_key (GimpTool *tool,
}
}
}
}
else
{
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))