[gimp/wip/Jehan/issue-498-quick-brush-edit: 20/26] app: fix space actions on canvas.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/issue-498-quick-brush-edit: 20/26] app: fix space actions on canvas.
- Date: Wed, 17 Aug 2022 12:20:46 +0000 (UTC)
commit 1ab4661bf2d4804e258c7d6c2d98c4184e1cb0bd
Author: Jehan <jehan girinstud io>
Date: Thu Aug 11 21:07:43 2022 +0200
app: fix space actions on canvas.
Space: panning
Ctrl-space: zooming
Shift-space: rotating
Ctrl-shift-space: constrained rotating
Note that these are still hardcoded, unlike the actions through
modifiers + pointer buttons.
app/display/gimpdisplayshell-tool-events.c | 51 ++++++++++++++++++++++++++----
1 file changed, 45 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 0c4d9cf1a0..06f4deae77 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -838,7 +838,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
gimp_display_shell_proximity_in (shell);
update_sw_cursor = TRUE;
- if (shell->mod_action != GIMP_MODIFIER_ACTION_NONE)
+ if (shell->mod_action != GIMP_MODIFIER_ACTION_NONE ||
+ shell->space_release_pending)
{
gimp_display_shell_handle_scrolling (shell,
state, mevent->x, mevent->y);
@@ -1650,6 +1651,29 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
gint x,
gint y)
{
+ GimpModifierAction mod_action = shell->mod_action;
+
+ if (mod_action == GIMP_MODIFIER_ACTION_NONE && shell->space_release_pending)
+ {
+ /* XXX The space actions are still hard-coded (instead of
+ * customizable throguh GimpModifiersManager). It might be
+ * interesting to make them customizable later.
+ */
+ GdkModifierType state = 0;
+
+ gdk_event_get_state (event, &state);
+ state &= gimp_get_all_modifiers_mask ();
+
+ if (state == 0)
+ mod_action = GIMP_MODIFIER_ACTION_PANNING;
+ else if (state == gimp_get_extend_selection_mask ())
+ mod_action = GIMP_MODIFIER_ACTION_ROTATING;
+ else if (state == (gimp_get_extend_selection_mask () | GDK_CONTROL_MASK))
+ mod_action = GIMP_MODIFIER_ACTION_STEP_ROTATING;
+ else if (state == gimp_get_toggle_behavior_mask ())
+ mod_action = GIMP_MODIFIER_ACTION_ZOOMING;
+ }
+
gimp_display_shell_pointer_grab (shell, event,
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK);
@@ -1660,7 +1684,7 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
shell->scroll_last_y = y;
shell->rotate_drag_angle = shell->rotate_angle;
- switch (shell->mod_action)
+ switch (mod_action)
{
case GIMP_MODIFIER_ACTION_ROTATING:
case GIMP_MODIFIER_ACTION_STEP_ROTATING:
@@ -1776,9 +1800,24 @@ gimp_display_shell_handle_scrolling (GimpDisplayShell *shell,
gint x,
gint y)
{
- gboolean constrain = FALSE;
+ GimpModifierAction mod_action = shell->mod_action;
+ gboolean constrain = FALSE;
- switch (shell->mod_action)
+ if (mod_action == GIMP_MODIFIER_ACTION_NONE && shell->space_release_pending)
+ {
+ state &= gimp_get_all_modifiers_mask ();
+
+ if (state == 0)
+ mod_action = GIMP_MODIFIER_ACTION_PANNING;
+ else if (state == gimp_get_extend_selection_mask ())
+ mod_action = GIMP_MODIFIER_ACTION_ROTATING;
+ else if (state == (gimp_get_extend_selection_mask () | GDK_CONTROL_MASK))
+ mod_action = GIMP_MODIFIER_ACTION_STEP_ROTATING;
+ else if (state == gimp_get_toggle_behavior_mask ())
+ mod_action = GIMP_MODIFIER_ACTION_ZOOMING;
+ }
+
+ switch (mod_action)
{
case GIMP_MODIFIER_ACTION_STEP_ROTATING:
constrain = TRUE;
@@ -1895,6 +1934,8 @@ gimp_display_shell_space_pressed (GimpDisplayShell *shell,
if (shell->space_release_pending || shell->mod_action != GIMP_MODIFIER_ACTION_NONE)
return;
+ shell->space_release_pending = TRUE;
+
switch (shell->display->config->space_bar_action)
{
case GIMP_SPACE_BAR_ACTION_NONE:
@@ -1942,8 +1983,6 @@ gimp_display_shell_space_pressed (GimpDisplayShell *shell,
}
break;
}
-
- shell->space_release_pending = TRUE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]