mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
940dbdf6a7
commit
c9a91b32bc
|
@ -126,6 +126,7 @@ static void
|
||||||
gimp_free_select_tool_init (GimpFreeSelectTool *free_sel)
|
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);
|
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_ACTION_COMMIT);
|
||||||
gimp_tool_control_set_tool_cursor (tool->control,
|
gimp_tool_control_set_tool_cursor (tool->control,
|
||||||
GIMP_TOOL_CURSOR_FREE_SELECT);
|
GIMP_TOOL_CURSOR_FREE_SELECT);
|
||||||
|
|
||||||
|
sel_tool->allow_move = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -176,6 +179,13 @@ gimp_free_select_tool_button_press (GimpTool *tool,
|
||||||
GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (tool);
|
GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (tool);
|
||||||
GimpFreeSelectToolPrivate *priv = free_sel->priv;
|
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,
|
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
|
||||||
press_type, display);
|
press_type, display);
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,7 @@ static void
|
||||||
gimp_polygon_select_tool_init (GimpPolygonSelectTool *poly_sel)
|
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);
|
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_ACTIVE_MODIFIERS_SEPARATE);
|
||||||
gimp_tool_control_set_precision (tool->control,
|
gimp_tool_control_set_precision (tool->control,
|
||||||
GIMP_CURSOR_PRECISION_SUBPIXEL);
|
GIMP_CURSOR_PRECISION_SUBPIXEL);
|
||||||
|
|
||||||
|
sel_tool->allow_move = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -204,17 +207,13 @@ gimp_polygon_select_tool_oper_update (GimpTool *tool,
|
||||||
GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (tool);
|
GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (tool);
|
||||||
GimpPolygonSelectToolPrivate *priv = poly_sel->priv;
|
GimpPolygonSelectToolPrivate *priv = poly_sel->priv;
|
||||||
|
|
||||||
if (display != tool->display)
|
if (priv->widget && display == tool->display)
|
||||||
{
|
|
||||||
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
|
|
||||||
proximity, display);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->widget)
|
|
||||||
{
|
{
|
||||||
gimp_tool_widget_hover (priv->widget, coords, state, proximity);
|
gimp_tool_widget_hover (priv->widget, coords, state, proximity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
|
||||||
|
display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -227,13 +226,8 @@ gimp_polygon_select_tool_cursor_update (GimpTool *tool,
|
||||||
GimpPolygonSelectToolPrivate *priv = poly_sel->priv;
|
GimpPolygonSelectToolPrivate *priv = poly_sel->priv;
|
||||||
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
|
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)
|
if (priv->widget && display == tool->display)
|
||||||
{
|
{
|
||||||
gimp_tool_widget_get_cursor (priv->widget, coords, state,
|
gimp_tool_widget_get_cursor (priv->widget, coords, state,
|
||||||
|
@ -244,6 +238,10 @@ gimp_polygon_select_tool_cursor_update (GimpTool *tool,
|
||||||
gimp_tool_control_get_cursor (tool->control),
|
gimp_tool_control_get_cursor (tool->control),
|
||||||
gimp_tool_control_get_tool_cursor (tool->control),
|
gimp_tool_control_get_tool_cursor (tool->control),
|
||||||
modifier);
|
modifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
|
||||||
|
display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue