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



commit 50257e9f7eeca2b9c89616fc521a7a77accbadd4
Author: Michael Natterer <mitch gimp org>
Date:   Wed Apr 29 13:30:35 2020 +0200

    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().

 app/actions/channels-commands.c |  6 +++---
 app/actions/layers-commands.c   | 36 +++++++++++++++++++++---------------
 app/actions/vectors-commands.c  | 15 +++++++++------
 3 files changed, 33 insertions(+), 24 deletions(-)
---
diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c
index 2a2393e99a..6701242e20 100644
--- a/app/actions/channels-commands.c
+++ b/app/actions/channels-commands.c
@@ -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)
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index e211270ae6..68c6dcc1fa 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -1155,20 +1155,23 @@ layers_opacity_cmd_callback (GimpAction *action,
                              GVariant   *value,
                              gpointer    data)
 {
-  GimpImage      *image;
-  GimpLayer      *layer;
-  gdouble         opacity;
-  GimpUndo       *undo;
-  gboolean        push_undo = TRUE;
+  GimpImage            *image;
+  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);
@@ -1181,16 +1184,19 @@ layers_mode_cmd_callback (GimpAction *action,
                           GVariant   *value,
                           gpointer    data)
 {
-  GimpImage     *image;
-  GimpLayer     *layer;
-  GimpLayerMode *modes;
-  gint           n_modes;
-  GimpLayerMode  layer_mode;
-  gint           index;
-  GimpUndo      *undo;
-  gboolean       push_undo = TRUE;
+  GimpImage            *image;
+  GimpLayer            *layer;
+  GimpLayerMode        *modes;
+  gint                  n_modes;
+  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];
diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c
index 120e600b73..2cb3872ed8 100644
--- a/app/actions/vectors-commands.c
+++ b/app/actions/vectors-commands.c
@@ -860,12 +860,15 @@ vectors_select_cmd_callback (GimpAction *action,
                              GVariant   *value,
                              gpointer    data)
 {
-  GimpImage      *image;
-  GimpVectors    *vectors;
-  GimpContainer  *container;
-  GimpVectors    *new_vectors;
+  GimpImage            *image;
+  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,8 +876,8 @@ vectors_select_cmd_callback (GimpAction *action,
   else
     container = gimp_image_get_vectors (image);
 
-  new_vectors = (GimpVectors *) action_select_object ((GimpActionSelectType) value,
-                                                       container,
+  new_vectors = (GimpVectors *) action_select_object (select_type,
+                                                      container,
                                                       (GimpObject *) vectors);
 
   if (new_vectors && new_vectors != vectors)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]