summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--unix/xserver/hw/vnc/Input.c30
-rw-r--r--win/rfb_win32/keymap.h2
2 files changed, 29 insertions, 3 deletions
diff --git a/unix/xserver/hw/vnc/Input.c b/unix/xserver/hw/vnc/Input.c
index 5c458f5d..534e435e 100644
--- a/unix/xserver/hw/vnc/Input.c
+++ b/unix/xserver/hw/vnc/Input.c
@@ -489,6 +489,30 @@ static void vncKeysymKeyboardEvent(KeySym keysym, int down)
keycode = vncKeysymToKeycode(keysym, state, &new_state);
+ /*
+ * Shift+Alt is often mapped to Meta, so try that rather than
+ * allocating a new entry, faking shift, or using the dummy
+ * key entries that many layouts have.
+ */
+ if ((state & ShiftMask) &&
+ ((keysym == XK_Alt_L) || (keysym == XK_Alt_R))) {
+ KeyCode alt, meta;
+
+ if (keysym == XK_Alt_L) {
+ alt = vncKeysymToKeycode(XK_Alt_L, state & ~ShiftMask, NULL);
+ meta = vncKeysymToKeycode(XK_Meta_L, state, NULL);
+ } else {
+ alt = vncKeysymToKeycode(XK_Alt_R, state & ~ShiftMask, NULL);
+ meta = vncKeysymToKeycode(XK_Meta_R, state, NULL);
+ }
+
+ if ((meta != 0) && (alt == meta)) {
+ LOG_DEBUG("Replacing Shift+Alt with Shift+Meta");
+ keycode = meta;
+ new_state = state;
+ }
+ }
+
/* Try some equivalent keysyms if we couldn't find a perfect match */
if (keycode == 0) {
for (i = 0;i < sizeof(altKeysym)/sizeof(altKeysym[0]);i++) {
@@ -537,9 +561,9 @@ static void vncKeysymKeyboardEvent(KeySym keysym, int down)
* get confused when we do a fake shift to get the same effect
* that having NumLock active would produce.
*
- * Until we have proper NumLock synchronisation (so we can
- * avoid faking shift), we try to avoid the fake shifts if we
- * can use an alternative keysym.
+ * Not all clients have proper NumLock synchronisation (so we
+ * can avoid faking shift) so we try to avoid the fake shifts
+ * if we can use an alternative keysym.
*/
if (((state & ShiftMask) != (new_state & ShiftMask)) &&
vncGetAvoidShiftNumLock() && vncIsAffectedByNumLock(keycode)) {
diff --git a/win/rfb_win32/keymap.h b/win/rfb_win32/keymap.h
index 664312a6..b9b6c310 100644
--- a/win/rfb_win32/keymap.h
+++ b/win/rfb_win32/keymap.h
@@ -134,6 +134,8 @@ static keymap_t keymap[] = {
{ XK_Control_R, VK_CONTROL, 1 },
{ XK_Alt_L, VK_MENU, 0 },
{ XK_Alt_R, VK_MENU, 1 },
+ { XK_Meta_L, VK_MENU, 0 },
+ { XK_Meta_R, VK_MENU, 1 },
// Left & Right Windows keys & Windows Menu Key