[gimp] app: make switching paint tools to color picker mode more robust
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make switching paint tools to color picker mode more robust
- Date: Wed, 16 Nov 2016 12:19:31 +0000 (UTC)
commit 014fdb87e57dcd2bbba6b2aa18371475aef98b4e
Author: Michael Natterer <mitch gimp org>
Date: Wed Nov 16 13:16:24 2016 +0100
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.
app/tools/gimppainttool.c | 57 +++++++++++++++++++++++----------------------
1 files changed, 29 insertions(+), 28 deletions(-)
---
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index f80af50..d1341dc 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -472,40 +472,41 @@ 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 ())
{
- GimpToolInfo *info = gimp_get_tool_info (display->gimp,
- "gimp-color-picker-tool");
-
- if (GIMP_IS_TOOL_INFO (info))
+ if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
- if (gimp_draw_tool_is_active (draw_tool))
- gimp_draw_tool_stop (draw_tool);
-
- gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
- GIMP_COLOR_OPTIONS (info->tool_options));
+ GimpToolInfo *info = gimp_get_tool_info (display->gimp,
+ "gimp-color-picker-tool");
- switch (GIMP_COLOR_TOOL (tool)->pick_mode)
+ if (GIMP_IS_TOOL_INFO (info))
{
- 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;
+ if (gimp_draw_tool_is_active (draw_tool))
+ gimp_draw_tool_stop (draw_tool);
+
+ gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
+ GIMP_COLOR_OPTIONS (info->tool_options));
+
+ switch (GIMP_COLOR_TOOL (tool)->pick_mode)
+ {
+ 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;
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]