Issue #4696 - Keyboard shortcuts for layer opacity are not working

layers_opacity_cmd_callback(): get the select_type from
the GVariant instead of using the GVariant as an enum
directly (missed when porting, spotted by Massimo).

Fix the same bug in channels_select_cmd_callback()
and layers_mode_cmd_callback().
This commit is contained in:
Michael Natterer 2020-04-29 13:30:35 +02:00
parent fdcf74ea72
commit 50257e9f7e
3 changed files with 33 additions and 24 deletions

View File

@ -432,13 +432,13 @@ channels_select_cmd_callback (GimpAction *action,
GimpChannel *channel;
GimpChannel *channel2;
GimpContainer *container;
GimpActionSelectType type;
GimpActionSelectType select_type;
return_if_no_channel (image, channel, data);
type = (GimpActionSelectType) g_variant_get_int32 (value);
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
container = gimp_image_get_channels (image);
channel2 = (GimpChannel *) action_select_object (type, container,
channel2 = (GimpChannel *) action_select_object (select_type, container,
(GimpObject *) channel);
if (channel2 && channel2 != channel)

View File

@ -1159,16 +1159,19 @@ layers_opacity_cmd_callback (GimpAction *action,
GimpLayer *layer;
gdouble opacity;
GimpUndo *undo;
GimpActionSelectType select_type;
gboolean push_undo = TRUE;
return_if_no_layer (image, layer, data);
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_LAYER_OPACITY);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layer))
push_undo = FALSE;
opacity = action_select_value ((GimpActionSelectType) value,
opacity = action_select_value (select_type,
gimp_layer_get_opacity (layer),
0.0, 1.0, 1.0,
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
@ -1188,9 +1191,12 @@ layers_mode_cmd_callback (GimpAction *action,
GimpLayerMode layer_mode;
gint index;
GimpUndo *undo;
GimpActionSelectType select_type;
gboolean push_undo = TRUE;
return_if_no_layer (image, layer, data);
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_LAYER_MODE);
@ -1203,7 +1209,7 @@ layers_mode_cmd_callback (GimpAction *action,
GIMP_LAYER_MODE_CONTEXT_LAYER,
&n_modes);
index = layers_mode_index (layer_mode, modes, n_modes);
index = action_select_value ((GimpActionSelectType) value,
index = action_select_value (select_type,
index, 0, n_modes - 1, 0,
0.0, 1.0, 1.0, 0.0, FALSE);
layer_mode = modes[index];

View File

@ -864,8 +864,11 @@ vectors_select_cmd_callback (GimpAction *action,
GimpVectors *vectors;
GimpContainer *container;
GimpVectors *new_vectors;
GimpActionSelectType select_type;
return_if_no_image (image, data);
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
vectors = gimp_image_get_active_vectors (image);
if (vectors)
@ -873,7 +876,7 @@ vectors_select_cmd_callback (GimpAction *action,
else
container = gimp_image_get_vectors (image);
new_vectors = (GimpVectors *) action_select_object ((GimpActionSelectType) value,
new_vectors = (GimpVectors *) action_select_object (select_type,
container,
(GimpObject *) vectors);