Commit 7ec04e4a authored by Michael Natterer's avatar Michael Natterer 😴

app: get rid of hardcoding GDK_SHIFT_MASK in tools/

gimp_suggest_modifiers(): change "shift_format" and "control_format"
parameters to "extend_selection_format" and "toggle_behavior_format",
which fixes the longstanding problem that the function did the right
thing only by accident.

tools: use gimp_get_extend_selection_mask() instead of GDK_SHIFT_MASK
which is not 100% semantically correct in all cases, but at least a
step in the right direction to make the tool modifiers easier to
improve.
parent 1318015a
......@@ -221,9 +221,8 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
GtkWidget *scale;
GtkWidget *combo;
gchar *str;
GdkModifierType toggle_mask;
toggle_mask = gimp_get_toggle_behavior_mask ();
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
/* fill type */
str = g_strdup_printf (_("Fill Type (%s)"),
......@@ -242,7 +241,7 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
/* fill selection */
str = g_strdup_printf (_("Affected Area (%s)"),
gimp_get_mod_string (GDK_SHIFT_MASK));
gimp_get_mod_string (extend_mask));
frame = gimp_prop_boolean_radio_frame_new (config, "fill-selection",
str,
_("Fill whole selection"),
......
......@@ -268,7 +268,7 @@ gimp_bucket_fill_tool_modifier_key (GimpTool *tool,
break;
}
}
else if (key == GDK_SHIFT_MASK)
else if (key == gimp_get_extend_selection_mask ())
{
g_object_set (options, "fill-selection", ! options->fill_selection, NULL);
}
......
......@@ -46,6 +46,7 @@
#include "core/gimpprojection.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
......@@ -551,7 +552,7 @@ gimp_cage_tool_button_press (GimpTool *tool,
{
/* User clicked on a handle, so we move it */
if (state & GDK_SHIFT_MASK)
if (state & gimp_get_extend_selection_mask ())
{
/* Multiple selection */
......@@ -595,7 +596,7 @@ gimp_cage_tool_button_press (GimpTool *tool,
{
/* User clicked on a handle, so we move it */
if (state & GDK_SHIFT_MASK)
if (state & gimp_get_extend_selection_mask ())
{
/* Multiple selection */
......@@ -690,7 +691,7 @@ gimp_cage_tool_button_release (GimpTool *tool,
abs (ct->selection_start_x - coords->x),
abs (ct->selection_start_y - coords->y) };
if (state & GDK_SHIFT_MASK)
if (state & gimp_get_extend_selection_mask ())
{
gimp_cage_config_select_add_area (ct->config,
GIMP_CAGE_MODE_CAGE_CHANGE,
......@@ -720,7 +721,7 @@ gimp_cage_tool_button_release (GimpTool *tool,
abs (ct->selection_start_x - coords->x),
abs (ct->selection_start_y - coords->y) };
if (state & GDK_SHIFT_MASK)
if (state & gimp_get_extend_selection_mask ())
{
gimp_cage_config_select_add_area (ct->config,
GIMP_CAGE_MODE_DEFORM, area);
......
......@@ -150,9 +150,8 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options)
GtkWidget *button;
GtkWidget *frame;
gchar *str;
GdkModifierType toggle_mask;
toggle_mask = gimp_get_toggle_behavior_mask ();
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
/* the sample merged toggle button */
button = gimp_prop_check_button_new (config, "sample-merged",
......@@ -171,7 +170,7 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options)
/* the use_info_window toggle button */
str = g_strdup_printf (_("Use info window (%s)"),
gimp_get_mod_string (GDK_SHIFT_MASK));
gimp_get_mod_string (extend_mask));
button = gimp_prop_check_button_new (config, "use-info-window", str);
g_free (str);
......
......@@ -191,7 +191,7 @@ gimp_color_picker_tool_modifier_key (GimpTool *tool,
{
GimpColorPickerOptions *options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (tool);
if (key == GDK_SHIFT_MASK)
if (key == gimp_get_extend_selection_mask ())
{
g_object_set (options, "use-info-window", ! options->use_info_window,
NULL);
......@@ -226,9 +226,6 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
{
GimpColorPickerTool *picker_tool = GIMP_COLOR_PICKER_TOOL (tool);
GimpColorPickerOptions *options = GIMP_COLOR_PICKER_TOOL_GET_OPTIONS (tool);
GdkModifierType toggle_mask;
toggle_mask = gimp_get_toggle_behavior_mask ();
GIMP_COLOR_TOOL (tool)->pick_mode = options->pick_mode;
......@@ -237,24 +234,27 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
if (proximity)
{
gchar *status_help = NULL;
GdkModifierType shift_mod = 0;
GdkModifierType extend_mask = 0;
GdkModifierType toggle_mask;
if (! picker_tool->gui)
shift_mod = GDK_SHIFT_MASK;
extend_mask = gimp_get_extend_selection_mask ();
toggle_mask = gimp_get_toggle_behavior_mask ();
switch (options->pick_mode)
{
case GIMP_COLOR_PICK_MODE_NONE:
status_help = gimp_suggest_modifiers (_("Click in any image to view"
" its color"),
shift_mod & ~state,
extend_mask & ~state,
NULL, NULL, NULL);
break;
case GIMP_COLOR_PICK_MODE_FOREGROUND:
status_help = gimp_suggest_modifiers (_("Click in any image to pick"
" the foreground color"),
(shift_mod | toggle_mask) &
(extend_mask | toggle_mask) &
~state,
NULL, NULL, NULL);
break;
......@@ -262,7 +262,7 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
case GIMP_COLOR_PICK_MODE_BACKGROUND:
status_help = gimp_suggest_modifiers (_("Click in any image to pick"
" the background color"),
(shift_mod | toggle_mask) &
(extend_mask | toggle_mask) &
~state,
NULL, NULL, NULL);
break;
......@@ -270,7 +270,7 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
case GIMP_COLOR_PICK_MODE_PALETTE:
status_help = gimp_suggest_modifiers (_("Click in any image to add"
" the color to the palette"),
shift_mod & ~state,
extend_mask & ~state,
NULL, NULL, NULL);
break;
}
......
......@@ -109,21 +109,20 @@ gimp_convolve_tool_modifier_key (GimpTool *tool,
GdkModifierType state,
GimpDisplay *display)
{
GimpConvolveTool *convolve = GIMP_CONVOLVE_TOOL (tool);
GimpConvolveOptions *options = GIMP_CONVOLVE_TOOL_GET_OPTIONS (tool);
GdkModifierType toggle_mask;
GimpConvolveTool *convolve = GIMP_CONVOLVE_TOOL (tool);
GimpConvolveOptions *options = GIMP_CONVOLVE_TOOL_GET_OPTIONS (tool);
GdkModifierType line_mask = GIMP_PAINT_TOOL_LINE_MASK;
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
toggle_mask = gimp_get_toggle_behavior_mask ();
if (((key == toggle_mask) &&
! (state & GDK_SHIFT_MASK) && /* leave stuff untouched in line draw mode */
if (((key == toggle_mask) &&
! (state & line_mask) && /* leave stuff untouched in line draw mode */
press != convolve->toggled)
||
(key == GDK_SHIFT_MASK && /* toggle back after keypresses CTRL(hold)-> */
! press && /* SHIFT(hold)->CTRL(release)->SHIFT(release) */
convolve->toggled &&
(key == line_mask && /* toggle back after keypresses CTRL(hold)-> */
! press && /* SHIFT(hold)->CTRL(release)->SHIFT(release) */
convolve->toggled &&
! (state & toggle_mask)))
{
convolve->toggled = press;
......
......@@ -237,7 +237,7 @@ gimp_curves_tool_button_release (GimpTool *tool,
GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool);
GimpCurvesConfig *config = c_tool->config;
if (state & GDK_SHIFT_MASK)
if (state & gimp_get_extend_selection_mask ())
{
GimpCurve *curve = config->curve[config->channel];
gdouble value = c_tool->picked_color[config->channel];
......@@ -300,33 +300,41 @@ gimp_curves_tool_oper_update (GimpTool *tool,
GimpDisplay *display)
{
GimpColorPickMode mode;
const gchar *status;
gchar *status = NULL;
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
display);
gimp_tool_pop_status (tool, display);
if (state & GDK_SHIFT_MASK)
if (state & extend_mask)
{
mode = GIMP_COLOR_PICK_MODE_PALETTE;
status = _("Click to add a control point");
status = g_strdup (_("Click to add a control point"));
}
else if (state & gimp_get_toggle_behavior_mask ())
else if (state & toggle_mask)
{
mode = GIMP_COLOR_PICK_MODE_PALETTE;
status = _("Click to add control points to all channels");
status = g_strdup (_("Click to add control points to all channels"));
}
else
{
mode = GIMP_COLOR_PICK_MODE_NONE;
status = _("Click to locate on curve (try Shift, Ctrl)");
status = gimp_suggest_modifiers (_("Click to locate on curve"),
(extend_mask | toggle_mask) & ~state,
_("%s: add control point"),
_("%s: add control points to all channels"),
NULL);
}
GIMP_COLOR_TOOL (tool)->pick_mode = mode;
if (proximity)
gimp_tool_push_status (tool, display, "%s", status);
g_free (status);
}
static void
......
......@@ -109,21 +109,20 @@ gimp_dodge_burn_tool_modifier_key (GimpTool *tool,
GdkModifierType state,
GimpDisplay *display)
{
GimpDodgeBurnTool *dodgeburn = GIMP_DODGE_BURN_TOOL (tool);
GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_TOOL_GET_OPTIONS (tool);
GdkModifierType toggle_mask;
GimpDodgeBurnTool *dodgeburn = GIMP_DODGE_BURN_TOOL (tool);
GimpDodgeBurnOptions *options = GIMP_DODGE_BURN_TOOL_GET_OPTIONS (tool);
GdkModifierType line_mask = GIMP_PAINT_TOOL_LINE_MASK;
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
toggle_mask = gimp_get_toggle_behavior_mask ();
if ((key == toggle_mask &&
! (state & GDK_SHIFT_MASK) && /* leave stuff untouched in line draw mode */
if ((key == toggle_mask &&
! (state & line_mask) && /* leave stuff untouched in line draw mode */
press != dodgeburn->toggled)
||
(key == GDK_SHIFT_MASK && /* toggle back after keypresses CTRL(hold)-> */
! press && /* SHIFT(hold)->CTRL(release)->SHIFT(release) */
dodgeburn->toggled &&
(key == line_mask && /* toggle back after keypresses CTRL(hold)-> */
! press && /* SHIFT(hold)->CTRL(release)->SHIFT(release) */
dodgeburn->toggled &&
! (state & toggle_mask)))
{
dodgeburn->toggled = press;
......
......@@ -964,11 +964,17 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
GimpTransformType translate_type;
if (kevent->state & GDK_MOD1_MASK)
translate_type = GIMP_TRANSFORM_TYPE_SELECTION;
{
translate_type = GIMP_TRANSFORM_TYPE_SELECTION;
}
else if (kevent->state & gimp_get_toggle_behavior_mask ())
translate_type = GIMP_TRANSFORM_TYPE_PATH;
{
translate_type = GIMP_TRANSFORM_TYPE_PATH;
}
else
translate_type = GIMP_TRANSFORM_TYPE_LAYER;
{
translate_type = GIMP_TRANSFORM_TYPE_LAYER;
}
return gimp_edit_selection_tool_translate (tool, kevent, translate_type,
display);
......@@ -980,15 +986,16 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
GimpTransformType translate_type,
GimpDisplay *display)
{
gint inc_x = 0;
gint inc_y = 0;
gint inc_x = 0;
gint inc_y = 0;
GimpUndo *undo;
gboolean push_undo = TRUE;
GimpImage *image = gimp_display_get_image (display);
GimpItem *item = NULL;
GimpTranslateMode edit_mode = GIMP_TRANSLATE_MODE_MASK;
GimpUndoType undo_type = GIMP_UNDO_GROUP_MASK;
const gchar *undo_desc = NULL;
gboolean push_undo = TRUE;
GimpImage *image = gimp_display_get_image (display);
GimpItem *item = NULL;
GimpTranslateMode edit_mode = GIMP_TRANSLATE_MODE_MASK;
GimpUndoType undo_type = GIMP_UNDO_GROUP_MASK;
const gchar *undo_desc = NULL;
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
gint velocity;
/* bail out early if it is not an arrow key event */
......@@ -1005,43 +1012,43 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
velocity = MAX (1.0, velocity);
/* check the event queue for key events with the same modifier mask
* as the current event, allowing only GDK_SHIFT_MASK to vary between
* as the current event, allowing only extend_mask to vary between
* them.
*/
inc_x = process_event_queue_keys (kevent,
GDK_KEY_Left,
kevent->state | GDK_SHIFT_MASK,
kevent->state | extend_mask,
-1 * velocity,
GDK_KEY_Left,
kevent->state & ~GDK_SHIFT_MASK,
kevent->state & ~extend_mask,
-1,
GDK_KEY_Right,
kevent->state | GDK_SHIFT_MASK,
kevent->state | extend_mask,
1 * velocity,
GDK_KEY_Right,
kevent->state & ~GDK_SHIFT_MASK,
kevent->state & ~extend_mask,
1,
0);
inc_y = process_event_queue_keys (kevent,
GDK_KEY_Up,
kevent->state | GDK_SHIFT_MASK,
kevent->state | extend_mask,
-1 * velocity,
GDK_KEY_Up,
kevent->state & ~GDK_SHIFT_MASK,
kevent->state & ~extend_mask,
-1,
GDK_KEY_Down,
kevent->state | GDK_SHIFT_MASK,
kevent->state | extend_mask,
1 * velocity,
GDK_KEY_Down,
kevent->state & ~GDK_SHIFT_MASK,
kevent->state & ~extend_mask,
1,
0);
......
......@@ -1393,7 +1393,8 @@ gimp_free_select_tool_modifier_key (GimpTool *tool,
priv->constrain_angle = ((state & gimp_get_constrain_behavior_mask ()) ?
TRUE : FALSE);
priv->supress_handles = state & GDK_SHIFT_MASK ? TRUE : FALSE;
priv->supress_handles = ((state & gimp_get_extend_selection_mask ()) ?
TRUE : FALSE);
gimp_draw_tool_resume (draw_tool);
}
......
......@@ -417,7 +417,7 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
case NO_ACTION:
iscissors->state = SEED_PLACEMENT;
if (! (state & GDK_SHIFT_MASK))
if (! (state & gimp_get_extend_selection_mask ()))
find_max_gradient (iscissors, image,
&iscissors->x, &iscissors->y);
......@@ -742,7 +742,7 @@ gimp_iscissors_tool_motion (GimpTool *tool,
iscissors->y = RINT (coords->y);
/* Hold the shift key down to disable the auto-edge snap feature */
if (! (state & GDK_SHIFT_MASK))
if (! (state & gimp_get_extend_selection_mask ()))
find_max_gradient (iscissors, image,
&iscissors->x, &iscissors->y);
......@@ -927,6 +927,7 @@ gimp_iscissors_tool_oper_update (GimpTool *tool,
if (mouse_over_vertex (iscissors, coords->x, coords->y) > 1)
{
GdkModifierType snap_mask = gimp_get_extend_selection_mask ();
GdkModifierType remove_mask = gimp_get_modify_selection_mask ();
if (state & remove_mask)
......@@ -939,7 +940,7 @@ gimp_iscissors_tool_oper_update (GimpTool *tool,
{
gchar *status =
gimp_suggest_modifiers (_("Click-Drag to move this point"),
(GDK_SHIFT_MASK | remove_mask) & ~state,
(snap_mask | remove_mask) & ~state,
_("%s: disable auto-snap"),
_("%s: remove this point"),
NULL);
......@@ -1003,11 +1004,12 @@ gimp_iscissors_tool_oper_update (GimpTool *tool,
case WAITING:
if (proximity)
{
gchar *status;
GdkModifierType snap_mask = gimp_get_extend_selection_mask ();
gchar *status;
status = gimp_suggest_modifiers (_("Click or Click-Drag to add a"
" point"),
GDK_SHIFT_MASK & ~state,
snap_mask & ~state,
_("%s: disable auto-snap"),
NULL, NULL);
gimp_tool_replace_status (tool, display, "%s", status);
......
......@@ -223,6 +223,7 @@ gimp_measure_tool_button_press (GimpTool *tool,
*/
if (measure->point != -1)
{
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
if (state & (toggle_mask | GDK_MOD1_MASK))
......@@ -267,7 +268,7 @@ gimp_measure_tool_button_press (GimpTool *tool,
}
else
{
if (state & GDK_SHIFT_MASK)
if (state & extend_mask)
measure->function = ADDING;
else
measure->function = MOVING;
......@@ -550,6 +551,7 @@ gimp_measure_tool_oper_update (GimpTool *tool,
if (gimp_canvas_item_hit (measure->handles[i],
coords->x, coords->y))
{
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
point = i;
......@@ -590,7 +592,7 @@ gimp_measure_tool_oper_update (GimpTool *tool,
break;
}
if ((state & GDK_SHIFT_MASK)
if ((state & extend_mask)
&& ! ((i == 0) && (measure->num_points == 3)))
{
status = gimp_suggest_modifiers (_("Click-Drag to add a "
......@@ -602,11 +604,11 @@ gimp_measure_tool_oper_update (GimpTool *tool,
else
{
if ((i == 0) && (measure->num_points == 3))
state |= GDK_SHIFT_MASK;
state |= extend_mask;
status = gimp_suggest_modifiers (_("Click-Drag to move this "
"point"),
(GDK_SHIFT_MASK |
toggle_mask |
(extend_mask |
toggle_mask |
GDK_MOD1_MASK) & ~state,
NULL, NULL, NULL);
}
......@@ -673,6 +675,7 @@ gimp_measure_tool_cursor_update (GimpTool *tool,
{
if (measure->point != -1)
{
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
if (state & toggle_mask)
......@@ -686,7 +689,7 @@ gimp_measure_tool_cursor_update (GimpTool *tool,
{
cursor = GIMP_CURSOR_SIDE_RIGHT;
}
else if ((state & GDK_SHIFT_MASK) &&
else if ((state & extend_mask) &&
! ((measure->point == 0) &&
(measure->num_points == 3)))
{
......
......@@ -185,8 +185,9 @@ gimp_move_options_gui (GimpToolOptions *tool_options)
gtk_widget_show (box);
/* tool toggle */
title = g_strdup_printf (_("Tool Toggle (%s)"),
gimp_get_mod_string (GDK_SHIFT_MASK));
title =
g_strdup_printf (_("Tool Toggle (%s)"),
gimp_get_mod_string (gimp_get_extend_selection_mask ()));
frame = gimp_prop_boolean_radio_frame_new (config, "move-current",
title, "true", "false");
......
......@@ -635,7 +635,7 @@ gimp_move_tool_modifier_key (GimpTool *tool,
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
if (key == GDK_SHIFT_MASK)
if (key == gimp_get_extend_selection_mask ())
{
g_object_set (options, "move-current", ! options->move_current, NULL);
}
......
......@@ -578,7 +578,7 @@ gimp_n_point_deformation_tool_button_press (GimpTool *tool,
* list of selected control points
*/
if (! (state & GDK_SHIFT_MASK))
if (! (state & gimp_get_extend_selection_mask ()))
{
/* <SHIFT> isn't pressed, so this isn't a
* multiselection - clear the list of selected
......@@ -589,7 +589,7 @@ gimp_n_point_deformation_tool_button_press (GimpTool *tool,
gimp_n_point_deformation_tool_add_cp_to_selection (npd_tool, cp);
}
else if (state & GDK_SHIFT_MASK)
else if (state & gimp_get_extend_selection_mask ())
{
/* control point is selected and <SHIFT> is pressed -
* remove control point from selected points
......@@ -666,7 +666,7 @@ gimp_n_point_deformation_tool_button_release (GimpTool *tool,
gint y1 = MAX (npd_tool->start_y, npd_tool->cursor_y);
gint i;
if (! (state & GDK_SHIFT_MASK))
if (! (state & gimp_get_extend_selection_mask ()))
{
/* <SHIFT> isn't pressed, so we want a clear selection */
gimp_n_point_deformation_tool_clear_selected_points_list (npd_tool);
......
......@@ -634,7 +634,7 @@ gimp_paint_tool_oper_update (GimpTool *tool,
core->cur_coords.x -= off_x;
core->cur_coords.y -= off_y;
if (display == tool->display && (state & GDK_SHIFT_MASK))
if (display == tool->display && (state & GIMP_PAINT_TOOL_LINE_MASK))
{
/* If shift is down and this is not the first paint stroke,
* draw a line.
......@@ -703,7 +703,7 @@ gimp_paint_tool_oper_update (GimpTool *tool,
/* suggest drawing lines only after the first point is set
*/
if (display == tool->display)
modifiers |= GDK_SHIFT_MASK;
modifiers |= GIMP_PAINT_TOOL_LINE_MASK;
status = gimp_suggest_modifiers (paint_tool->status,
modifiers & ~state,
......
......@@ -22,6 +22,9 @@
#include "gimpcolortool.h"
#define GIMP_PAINT_TOOL_LINE_MASK (gimp_get_extend_selection_mask ())
#define GIMP_TYPE_PAINT_TOOL (gimp_paint_tool_get_type ())
#define GIMP_PAINT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_TOOL, GimpPaintTool))
#define GIMP_PAINT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PAINT_TOOL, GimpPaintToolClass))
......
......@@ -342,12 +342,13 @@ gimp_perspective_clone_tool_button_press (GimpTool *tool,
case GIMP_PERSPECTIVE_CLONE_MODE_PAINT:
{
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
gdouble nnx, nny;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
if ((state & (toggle_mask | GDK_SHIFT_MASK)) == toggle_mask)
if ((state & (toggle_mask | extend_mask)) == toggle_mask)
{
source_core->set_source = TRUE;
......@@ -569,9 +570,10 @@ gimp_perspective_clone_tool_cursor_update (GimpTool *tool,
}
else
{
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
if ((state & (toggle_mask | GDK_SHIFT_MASK)) == toggle_mask)
if ((state & (toggle_mask | extend_mask)) == toggle_mask)
{
cursor = GIMP_CURSOR_CROSSHAIR_SMALL;
}
......
......@@ -1242,7 +1242,7 @@ gimp_rectangle_tool_active_modifier_key (GimpTool *tool,
gimp_draw_tool_pause (draw_tool);
if (key == GDK_SHIFT_MASK)
if (key == gimp_get_extend_selection_mask ())
{
/* Here we want to handle manualy when to update the rectangle, so we
* don't want gimp_rectangle_tool_options_notify to do anything.
......@@ -1462,7 +1462,7 @@ gimp_rectangle_tool_key_press (GimpTool *tool,
}
/* If the shift key is down, move by an accelerated increment */
if (kevent->state & GDK_SHIFT_MASK)
if (kevent->state & gimp_get_extend_selection_mask ())
{
dx *= ARROW_VELOCITY;
dy *= ARROW_VELOCITY;
......
......@@ -179,11 +179,12 @@ gimp_source_tool_button_press (GimpTool *tool,
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpSourceTool *source_tool = GIMP_SOURCE_TOOL (tool);
GimpSourceCore *source = GIMP_SOURCE_CORE (paint_tool->core);
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
if ((state & (toggle_mask | GDK_SHIFT_MASK)) == toggle_mask)
if ((state & (toggle_mask | extend_mask)) == toggle_mask)
{
source->set_source = TRUE;
......@@ -275,9 +276,10 @@ gimp_source_tool_cursor_update (GimpTool *tool,
if (gimp_source_core_use_source (GIMP_SOURCE_CORE (paint_tool->core),
options))
{
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
if ((state & (toggle_mask | GDK_SHIFT_MASK)) == toggle_mask)
if ((state & (toggle_mask | extend_mask)) == toggle_mask)
{
cursor = GIMP_CURSOR_CROSSHAIR_SMALL;
}
......
......@@ -61,7 +61,7 @@
#include "gimp-intl.h"
#define TOGGLE_MASK GDK_SHIFT_MASK
#define TOGGLE_MASK gimp_get_extend_selection_mask ()
#define MOVE_MASK GDK_MOD1_MASK
#define INSDEL_MASK gimp_get_toggle_behavior_mask ()
......@@ -815,7 +815,7 @@ gimp_vector_tool_key_press (GimpTool *tool,
shell = gimp_display_get_shell (draw_tool->display);
if (kevent->state & GDK_SHIFT_MASK)
if (kevent->state & gimp_get_extend_selection_mask ())
pixels = 10.0;
if (kevent->state & gimp_get_toggle_behavior_mask ())
......@@ -1198,8 +1198,10 @@ gimp_vector_tool_status_update (GimpTool *tool,
if (proximity)
{
const gchar *status = NULL;
gboolean free_status = FALSE;
GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
const gchar *status = NULL;
gboolean free_status = FALSE;
switch (vector_tool->function)
{
......@@ -1218,7 +1220,7 @@ gimp_vector_tool_status_update (GimpTool *tool,
case VECTORS_ADD_ANCHOR:
status = gimp_suggest_modifiers (_("Click or Click-Drag to create "
"a new anchor"),
GDK_SHIFT_MASK & ~state,
extend_mask & ~state,
NULL, NULL, NULL);
free_status = TRUE;
break;
......@@ -1226,8 +1228,6 @@ gimp_vector_tool_status_update (GimpTool *tool,
case VECTORS_MOVE_ANCHOR:
if (options->edit_mode != GIMP_VECTOR_MODE_EDIT)
{
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"anchor around"),
toggle_mask & ~state,
......@@ -1247,14 +1247,14 @@ gimp_vector_tool_status_update (GimpTool *tool,
{
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"handle around"),
GDK_SHIFT_MASK & ~state,
extend_mask & ~state,
NULL, NULL, NULL);
}
else
{
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"handles around symmetrically"),
GDK_SHIFT_MASK & ~state,
extend_mask & ~state,
NULL, NULL, NULL);
}
free_status = TRUE;
......@@ -1264,12 +1264,12 @@ gimp_vector_tool_status_update (GimpTool *tool,
if (GIMP_VECTOR_TOOL_GET_OPTIONS (tool)->polygonal)
status = gimp_suggest_modifiers (_("Click-Drag to move the "
"anchors around"),
GDK_SHIFT_MASK & ~state,
extend_mask & ~state,
NULL, NULL, NULL);
else
status = gimp_suggest_modifiers (_("Click-Drag to change the "
"shape of the curve"),