From 1bd227922e2ef1e9e7eb1772316ed43f07db6aa3 Mon Sep 17 00:00:00 2001 From: crs Date: Wed, 26 Jan 2005 19:01:53 +0000 Subject: [PATCH] Integrated some changes from 1.2 branch. --- doc/news.html | 20 +++++++++++++++++ lib/platform/COSXKeyState.cpp | 13 +++++++++-- lib/platform/CXWindowsKeyState.cpp | 35 ++++++++++++++++++++++++++++-- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/doc/news.html b/doc/news.html index f888c1f6..fac5f2a8 100644 --- a/doc/news.html +++ b/doc/news.html @@ -7,6 +7,26 @@

Synergy News

+Jan-26-2005 - Synergy 1.2.2 released + +

+Made following changes: +

+ + +Jan-04-2005 - Synergy 1.2.1 released + +

+Made following changes: +

+ + Dec-30-2004 - Synergy 1.2.0 released

diff --git a/lib/platform/COSXKeyState.cpp b/lib/platform/COSXKeyState.cpp index c5c27e8f..035a0468 100644 --- a/lib/platform/COSXKeyState.cpp +++ b/lib/platform/COSXKeyState.cpp @@ -315,8 +315,17 @@ COSXKeyState::mapKey(Keystrokes& keys, KeyID id, // if the desired mask includes Alt or Control then match the // desired mask. this ensures that combinations like // Command+Shift+S use the Command and Shift modifiers and - // those like Command+S do not use the shift modifier. - if ((desiredMask & (KeyModifierControl | KeyModifierAlt)) != 0) { + // those like Command+S do not use the shift modifier. do not + // do this if the key to synthesize is a modifier key, otherwise + // we'd apply modifiers to modifiers which breaks things (by + // say, putting a Control press and release around a Control + // press). + if ((desiredMask & (KeyModifierControl | KeyModifierAlt)) != 0 && + id != kKeyShift_L && id != kKeyShift_R && + id != kKeyControl_L && id != kKeyControl_R && + id != kKeyAlt_L && id != kKeyAlt_R && + id != kKeySuper_L && id != kKeySuper_R && + id != kKeyMeta_L && id != kKeyMeta_R) { return addKeystrokes(keys, sequence.back().m_button, desiredMask, KeyModifierShift | KeyModifierSuper | diff --git a/lib/platform/CXWindowsKeyState.cpp b/lib/platform/CXWindowsKeyState.cpp index fbcc53c2..8e303e2e 100644 --- a/lib/platform/CXWindowsKeyState.cpp +++ b/lib/platform/CXWindowsKeyState.cpp @@ -414,10 +414,41 @@ CXWindowsKeyState::updateKeysymMap() } // get keysym and get/create key mapping - const int keycodeIndex = keycode - minKeycode; - const KeySym keysym = keysyms[keycodeIndex * + int keycodeIndex = keycode - minKeycode; + KeySym keysym = keysyms[keycodeIndex * keysymsPerKeycode + 0]; + // prefer XK_ISO_Level3_Shift over XK_Mode_switch. newer + // versions of X use the former only. we assume here that + // if you have XK_ISO_Level3_Shift mapped then that's what + // you want to use even if XK_Mode_switch is also mapped. + if (j == 0 && keysym == XK_Mode_switch) { + // sort modifiers->modifiermap for this modifier so + // that a keycode mapped to XK_ISO_Level3_Shift appears + // before those mapped to anything else. this one keycode + // is enough so long as it's first because mapModifier in + // CKeyState uses the first keycode in modifierKeys to + // generate the key event for this modifier. + KeyCode* keycodes = modifiers->modifiermap + + i * keysPerModifier + j; + for (unsigned int k = j + 1; k < keysPerModifier; ++k) { + KeySym keysym2 = keysyms[(keycodes[k] - minKeycode) * + keysymsPerKeycode + 0]; + if (keysym2 == XK_ISO_Level3_Shift) { + // found an XK_ISO_Level3_Shift. swap it with + // the keycode in index j. + keycodes[j] = keycodes[k]; + keycodes[k] = keycode; + + // now use the new first keycode + keycode = keycodes[j]; + keycodeIndex = keycode - minKeycode; + keysym = keysym2; + break; + } + } + } + // get modifier mask if we haven't yet. this has the side // effect of setting the m_*Mask members. if (mask == 0) {