From 492ed00401aabfdd084b6ffa23711ced6d480542 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 8 Oct 2022 13:06:32 +0300
Subject: [PATCH 37/37] gtk: Don't gobble <ctrl> + <shift> modified keys in
 edit mode

See osdn #45802

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/gui-gtk-3.0/editgui.c  | 10 ++++++----
 client/gui-gtk-3.22/editgui.c | 10 ++++++----
 client/gui-gtk-4.0/editgui.c  | 10 ++++++----
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/client/gui-gtk-3.0/editgui.c b/client/gui-gtk-3.0/editgui.c
index e9a2f1d7c0..c14a4df06a 100644
--- a/client/gui-gtk-3.0/editgui.c
+++ b/client/gui-gtk-3.0/editgui.c
@@ -1662,14 +1662,16 @@ gboolean handle_edit_key_press(GdkEventKey *ev)
 {
   enum editor_tool_type ett, new_ett = NUM_EDITOR_TOOL_TYPES;
 
-  if (ev->state & GDK_SHIFT_MASK) {
-    return handle_edit_key_press_with_shift(ev);
-  }
-
+  /* Check ctrl before shift - this is correct also for the case where
+   * they are both active. */
   if (ev->state & GDK_CONTROL_MASK) {
     return handle_edit_key_press_with_ctrl(ev);
   }
 
+  if (ev->state & GDK_SHIFT_MASK) {
+    return handle_edit_key_press_with_shift(ev);
+  }
+
   ett = editor_get_tool();
 
   switch (ev->keyval) {
diff --git a/client/gui-gtk-3.22/editgui.c b/client/gui-gtk-3.22/editgui.c
index 0a787e1297..7e5402fe4a 100644
--- a/client/gui-gtk-3.22/editgui.c
+++ b/client/gui-gtk-3.22/editgui.c
@@ -1661,14 +1661,16 @@ gboolean handle_edit_key_press(GdkEventKey *ev)
 {
   enum editor_tool_type ett, new_ett = NUM_EDITOR_TOOL_TYPES;
 
-  if (ev->state & GDK_SHIFT_MASK) {
-    return handle_edit_key_press_with_shift(ev);
-  }
-
+  /* Check ctrl before shift - this is correct also for the case where
+   * they are both active. */
   if (ev->state & GDK_CONTROL_MASK) {
     return handle_edit_key_press_with_ctrl(ev);
   }
 
+  if (ev->state & GDK_SHIFT_MASK) {
+    return handle_edit_key_press_with_shift(ev);
+  }
+
   ett = editor_get_tool();
 
   switch (ev->keyval) {
diff --git a/client/gui-gtk-4.0/editgui.c b/client/gui-gtk-4.0/editgui.c
index ef2c11b084..953cbb277a 100644
--- a/client/gui-gtk-4.0/editgui.c
+++ b/client/gui-gtk-4.0/editgui.c
@@ -1682,14 +1682,16 @@ gboolean handle_edit_key_press(guint keyval, GdkModifierType state)
 {
   enum editor_tool_type ett, new_ett = NUM_EDITOR_TOOL_TYPES;
 
-  if (state & GDK_SHIFT_MASK) {
-    return handle_edit_key_press_with_shift(keyval);
-  }
-
+  /* Check ctrl before shift - this is correct also for the case where
+   * they are both active. */
   if (state & GDK_CONTROL_MASK) {
     return handle_edit_key_press_with_ctrl(keyval);
   }
 
+  if (state & GDK_SHIFT_MASK) {
+    return handle_edit_key_press_with_shift(keyval);
+  }
+
   ett = editor_get_tool();
 
   switch (keyval) {
-- 
2.35.1