Commit c220d9dd for guacamole.apache.org
commit c220d9ddaf2369f5159ae8aabbe943eb0d92a738
Author: Michael Jumper <mjumper@apache.org>
Date: Mon Aug 3 01:38:13 2026 -0700
GUACAMOLE-2313: Handle macOS Option keypresses in RDP as equivalent to AltGr.
diff --git a/src/protocols/rdp/keyboard.c b/src/protocols/rdp/keyboard.c
index 3e749bc7..c2f1fbbe 100644
--- a/src/protocols/rdp/keyboard.c
+++ b/src/protocols/rdp/keyboard.c
@@ -482,9 +482,11 @@ unsigned int guac_rdp_keyboard_get_modifier_flags(guac_rdp_keyboard* keyboard) {
|| guac_rdp_keyboard_is_pressed(keyboard, GUAC_RDP_KEYSYM_RSHIFT))
modifier_flags |= GUAC_RDP_KEYMAP_MODIFIER_SHIFT;
- /* Dedicated AltGr key */
+ /* Dedicated AltGr/Option keys */
if (guac_rdp_keyboard_is_pressed(keyboard, GUAC_RDP_KEYSYM_RALT)
- || guac_rdp_keyboard_is_pressed(keyboard, GUAC_RDP_KEYSYM_ALTGR))
+ || guac_rdp_keyboard_is_pressed(keyboard, GUAC_RDP_KEYSYM_ALTGR)
+ || guac_rdp_keyboard_is_pressed(keyboard, GUAC_RDP_KEYSYM_LOPTION)
+ || guac_rdp_keyboard_is_pressed(keyboard, GUAC_RDP_KEYSYM_ROPTION))
modifier_flags |= GUAC_RDP_KEYMAP_MODIFIER_ALTGR;
/* AltGr via Ctrl+Alt */
@@ -634,6 +636,8 @@ void guac_rdp_keyboard_update_modifiers(guac_rdp_keyboard* keyboard,
guac_rdp_keyboard_update_keysym(keyboard, GUAC_RDP_KEYSYM_RALT, 0, GUAC_RDP_KEY_SOURCE_SYNTHETIC);
guac_rdp_keyboard_update_keysym(keyboard, GUAC_RDP_KEYSYM_LCTRL, 0, GUAC_RDP_KEY_SOURCE_SYNTHETIC);
guac_rdp_keyboard_update_keysym(keyboard, GUAC_RDP_KEYSYM_RCTRL, 0, GUAC_RDP_KEY_SOURCE_SYNTHETIC);
+ guac_rdp_keyboard_update_keysym(keyboard, GUAC_RDP_KEYSYM_LOPTION, 0, GUAC_RDP_KEY_SOURCE_SYNTHETIC);
+ guac_rdp_keyboard_update_keysym(keyboard, GUAC_RDP_KEYSYM_ROPTION, 0, GUAC_RDP_KEY_SOURCE_SYNTHETIC);
}
}
diff --git a/src/protocols/rdp/keymap.h b/src/protocols/rdp/keymap.h
index 121b85f3..a14ce511 100644
--- a/src/protocols/rdp/keymap.h
+++ b/src/protocols/rdp/keymap.h
@@ -72,6 +72,17 @@
*/
#define GUAC_RDP_KEYSYM_RALT 0xFFEA
+/**
+ * The X11 keysym used by Guacamole for Left Option.
+ */
+#define GUAC_RDP_KEYSYM_LOPTION 0xFFED
+
+/**
+ * The X11 keysym used by Guacamole for Right Option.
+ */
+#define GUAC_RDP_KEYSYM_ROPTION 0xFFEE
+
+
/**
* The X11 keysym for AltGr.
*/
diff --git a/src/protocols/rdp/keymaps/base.keymap b/src/protocols/rdp/keymaps/base.keymap
index 4d6cb01d..5001fcfd 100644
--- a/src/protocols/rdp/keymaps/base.keymap
+++ b/src/protocols/rdp/keymaps/base.keymap
@@ -84,9 +84,14 @@ map 0x1D ~ 0xffe3 # Control_L
map +ext 0x1D ~ 0xffe4 # Control_R
map 0x38 ~ 0xffe9 # Alt_L
map +ext 0x38 ~ 0xffea # Alt_R
-map +ext 0x5B ~ 0xffe7 # Meta_L
-map +ext 0x5C ~ 0xffe8 # Meta_R
-map +ext 0x5B ~ 0xffeb # Super_L
-map +ext 0x5C ~ 0xffec # Super_R
+map +ext 0x5B ~ 0xffe7 # Command_L
+map +ext 0x5C ~ 0xffe8 # Command_R
+map +ext 0x5B ~ 0xffeb # Super_L (Left "Windows" key)
+map +ext 0x5C ~ 0xffec # Super_R (Right "Windows" key)
map +ext 0x5D ~ 0xff67 # Menu
+# NOTE: Option_L and Option_R are intentionally unmapped for the same reason
+# that AltGr is unmapped - mapping directly would mean mapping to Alt, which
+# may be interpreted by the RDP server as part of a keyboard shortcut instead
+# of normal typing (see base_altgr.keymap).
+
diff --git a/src/protocols/rdp/keymaps/base_altgr.keymap b/src/protocols/rdp/keymaps/base_altgr.keymap
index 5c4691d0..bc8d0a98 100644
--- a/src/protocols/rdp/keymaps/base_altgr.keymap
+++ b/src/protocols/rdp/keymaps/base_altgr.keymap
@@ -22,4 +22,6 @@ name "base_altgr"
# Modifiers
map +ext 0x38 ~ 0xfe03 # AltGr
+map +ext 0x38 ~ 0xffed # Option_L
+map +ext 0x38 ~ 0xffee # Option_R