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:
@ -472,40 +472,41 @@ gimp_paint_tool_modifier_key (GimpTool *tool,
|
|||||||
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
|
||||||
GimpDrawTool *draw_tool = GIMP_DRAW_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 (paint_tool->pick_colors && ! paint_tool->draw_line)
|
||||||
{
|
{
|
||||||
if (press)
|
if ((state & gimp_get_all_modifiers_mask ()) ==
|
||||||
|
gimp_get_constrain_behavior_mask ())
|
||||||
{
|
{
|
||||||
GimpToolInfo *info = gimp_get_tool_info (display->gimp,
|
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
|
||||||
"gimp-color-picker-tool");
|
|
||||||
|
|
||||||
if (GIMP_IS_TOOL_INFO (info))
|
|
||||||
{
|
{
|
||||||
if (gimp_draw_tool_is_active (draw_tool))
|
GimpToolInfo *info = gimp_get_tool_info (display->gimp,
|
||||||
gimp_draw_tool_stop (draw_tool);
|
"gimp-color-picker-tool");
|
||||||
|
|
||||||
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
|
if (GIMP_IS_TOOL_INFO (info))
|
||||||
GIMP_COLOR_OPTIONS (info->tool_options));
|
|
||||||
|
|
||||||
switch (GIMP_COLOR_TOOL (tool)->pick_mode)
|
|
||||||
{
|
{
|
||||||
case GIMP_COLOR_PICK_MODE_FOREGROUND:
|
if (gimp_draw_tool_is_active (draw_tool))
|
||||||
gimp_tool_push_status (tool, display,
|
gimp_draw_tool_stop (draw_tool);
|
||||||
_("Click in any image to pick the "
|
|
||||||
"foreground color"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GIMP_COLOR_PICK_MODE_BACKGROUND:
|
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
|
||||||
gimp_tool_push_status (tool, display,
|
GIMP_COLOR_OPTIONS (info->tool_options));
|
||||||
_("Click in any image to pick the "
|
|
||||||
"background color"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
switch (GIMP_COLOR_TOOL (tool)->pick_mode)
|
||||||
break;
|
{
|
||||||
|
case GIMP_COLOR_PICK_MODE_FOREGROUND:
|
||||||
|
gimp_tool_push_status (tool, display,
|
||||||
|
_("Click in any image to pick the "
|
||||||
|
"foreground color"));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_COLOR_PICK_MODE_BACKGROUND:
|
||||||
|
gimp_tool_push_status (tool, display,
|
||||||
|
_("Click in any image to pick the "
|
||||||
|
"background color"));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user