[gimp/gimp-2-10] Issue #3514: Free Select tool: Alt-Ctrl|Shift not working unless...
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #3514: Free Select tool: Alt-Ctrl|Shift not working unless...
- Date: Sun, 16 Jun 2019 18:20:30 +0000 (UTC)
commit f948aaa93938c90a999c000cff3583eb8f747d03
Author: Jehan <jehan girinstud io>
Date: Sun Jun 16 19:52:07 2019 +0200
Issue #3514: Free Select tool: Alt-Ctrl|Shift not working unless...
... selection is committed;
Fast copy|cut-paste modifiers in selection tools were not working with
the Free Select tool, even when the polygon was closed. The reason was
that GimpPolygonSelectTool was not properly chaining up with the parent
implementation for oper_update(), and then upon a button press, we need
to check to call gimp_selection_tool_start_edit() to see if the action
should not be handled by GimpSelectionTool.
Of course, since we don't necessarily want all child class of
GimpPolygonSelectTool to support these modifiers (typically we may not
want these in the Foreground select tool), I set allow_move to FALSE,
then set it to TRUE only in the GimpFreeSelectTool subclass.
(cherry picked from commit c9a91b32bc512e3b336607191759be5a69e940e1)
app/tools/gimpfreeselecttool.c | 12 ++++++++++-
app/tools/gimppolygonselecttool.c | 42 +++++++++++++++++++--------------------
2 files changed, 31 insertions(+), 23 deletions(-)
---
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index 46b036c097..a146225276 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -125,7 +125,8 @@ gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass)
static void
gimp_free_select_tool_init (GimpFreeSelectTool *free_sel)
{
- GimpTool *tool = GIMP_TOOL (free_sel);
+ GimpTool *tool = GIMP_TOOL (free_sel);
+ GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
free_sel->priv = gimp_free_select_tool_get_instance_private (free_sel);
@@ -136,6 +137,8 @@ gimp_free_select_tool_init (GimpFreeSelectTool *free_sel)
GIMP_TOOL_ACTION_COMMIT);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FREE_SELECT);
+
+ sel_tool->allow_move = TRUE;
}
static void
@@ -176,6 +179,13 @@ gimp_free_select_tool_button_press (GimpTool *tool,
GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *priv = free_sel->priv;
+ if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (poly_sel),
+ display, coords))
+ {
+ if (display)
+ gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
+ return;
+ }
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
press_type, display);
diff --git a/app/tools/gimppolygonselecttool.c b/app/tools/gimppolygonselecttool.c
index af3bfb5eb4..6877500f59 100644
--- a/app/tools/gimppolygonselecttool.c
+++ b/app/tools/gimppolygonselecttool.c
@@ -145,7 +145,8 @@ gimp_polygon_select_tool_class_init (GimpPolygonSelectToolClass *klass)
static void
gimp_polygon_select_tool_init (GimpPolygonSelectTool *poly_sel)
{
- GimpTool *tool = GIMP_TOOL (poly_sel);
+ GimpTool *tool = GIMP_TOOL (poly_sel);
+ GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
poly_sel->priv = gimp_polygon_select_tool_get_instance_private (poly_sel);
@@ -157,6 +158,8 @@ gimp_polygon_select_tool_init (GimpPolygonSelectTool *poly_sel)
GIMP_TOOL_ACTIVE_MODIFIERS_SEPARATE);
gimp_tool_control_set_precision (tool->control,
GIMP_CURSOR_PRECISION_SUBPIXEL);
+
+ sel_tool->allow_move = FALSE;
}
static void
@@ -204,17 +207,13 @@ gimp_polygon_select_tool_oper_update (GimpTool *tool,
GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (tool);
GimpPolygonSelectToolPrivate *priv = poly_sel->priv;
- if (display != tool->display)
- {
- GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
- proximity, display);
- return;
- }
-
- if (priv->widget)
+ if (priv->widget && display == tool->display)
{
gimp_tool_widget_hover (priv->widget, coords, state, proximity);
}
+
+ GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
+ display);
}
static void
@@ -227,23 +226,22 @@ gimp_polygon_select_tool_cursor_update (GimpTool *tool,
GimpPolygonSelectToolPrivate *priv = poly_sel->priv;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
- if (tool->display == NULL)
+ if (tool->display)
{
- GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
- display);
- return;
- }
+ if (priv->widget && display == tool->display)
+ {
+ gimp_tool_widget_get_cursor (priv->widget, coords, state,
+ NULL, NULL, &modifier);
+ }
- if (priv->widget && display == tool->display)
- {
- gimp_tool_widget_get_cursor (priv->widget, coords, state,
- NULL, NULL, &modifier);
+ gimp_tool_set_cursor (tool, display,
+ gimp_tool_control_get_cursor (tool->control),
+ gimp_tool_control_get_tool_cursor (tool->control),
+ modifier);
}
- gimp_tool_set_cursor (tool, display,
- gimp_tool_control_get_cursor (tool->control),
- gimp_tool_control_get_tool_cursor (tool->control),
- modifier);
+ GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
+ display);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]