[gimp] app: mask alternative click modifiers must not clash with…
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: mask alternative click modifiers must not clash with…
- Date: Mon, 14 Dec 2020 00:50:39 +0000 (UTC)
commit f4d39f8c7286ac5172ff7f79fbaeaa2555134693
Author: Jehan <jehan girinstud io>
Date: Mon Dec 14 01:37:19 2020 +0100
app: mask alternative click modifiers must not clash with…
… multi-selection modifiers. Also they will work from now on on the
clicked mask only.
Shift and Ctrl clicks are reserved for multi-selection. We do not want
these to do other actions if you shift|ctrl-click on a mask (even more
as these alternative actions are hardly discoverable so it would make
for bug-like behavior to the person not knowing these alternative
actions).
So Alt-click is still used for showing/hiding the mask, but
enabling/disabling changes from Ctrl-click to Alt-Ctrl-click.
The second change is that these actions will not run the actions on
selected layers' mask, but on the clicked layer mask. This will at least
make these interaction different from the actions (e.g. with contextual
menu) and therefore it's not even redundant anymore. We will now have a
way to work on all selected layers vs a way to work on a clicked layer
(without changing the existing selection).
app/widgets/gimplayertreeview.c | 37 +++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c
index 0789d4eb73..12f75ce4df 100644
--- a/app/widgets/gimplayertreeview.c
+++ b/app/widgets/gimplayertreeview.c
@@ -1652,17 +1652,34 @@ gimp_layer_tree_view_mask_clicked (GimpCellRendererViewable *cell,
if (renderer)
{
- GimpLayer *layer = GIMP_LAYER (renderer->viewable);
-
- if (state & GDK_MOD1_MASK)
- gimp_action_group_set_action_active (group, "layers-mask-show",
- ! gimp_layer_get_show_mask (layer));
- else if (state & gimp_get_toggle_behavior_mask ())
- gimp_action_group_set_action_active (group, "layers-mask-disable",
- gimp_layer_get_apply_mask (layer));
+ GimpLayer *layer = GIMP_LAYER (renderer->viewable);
+ GdkModifierType modifiers = gimp_get_all_modifiers_mask ();
+
+ if ((state & GDK_MOD1_MASK))
+ {
+ GimpImage *image;
+
+ image = gimp_item_get_image (GIMP_ITEM (layer));
+
+ if ((state & modifiers) == GDK_MOD1_MASK)
+ {
+ /* Alt-click shows/hides a layer mask */
+ gimp_layer_set_show_mask (layer, ! gimp_layer_get_show_mask (layer), TRUE);
+ gimp_image_flush (image);
+ }
+ if ((state & modifiers) == (GDK_MOD1_MASK | GDK_CONTROL_MASK))
+ {
+ /* Alt-Control-click enables/disables a layer mask */
+ gimp_layer_set_apply_mask (layer, ! gimp_layer_get_apply_mask (layer), TRUE);
+ gimp_image_flush (image);
+ }
+ }
else if (! gimp_layer_get_edit_mask (layer))
- gimp_action_group_set_action_active (group,
- "layers-mask-edit", TRUE);
+ {
+ /* Simple click selects the mask for edition. */
+ gimp_action_group_set_action_active (group,
+ "layers-mask-edit", TRUE);
+ }
g_object_unref (renderer);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]