From 9c4267ed115359e052e30665bcbf1b0bc46b1e56 Mon Sep 17 00:00:00 2001 From: crs Date: Wed, 16 Jul 2003 21:40:57 +0000 Subject: [PATCH] Fixed handling of shift/ctrl/alt on special keys on win32 server. --- lib/platform/CMSWindowsPrimaryScreen.cpp | 72 +++++++++++------------- 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/lib/platform/CMSWindowsPrimaryScreen.cpp b/lib/platform/CMSWindowsPrimaryScreen.cpp index 5871f724..d68612dc 100644 --- a/lib/platform/CMSWindowsPrimaryScreen.cpp +++ b/lib/platform/CMSWindowsPrimaryScreen.cpp @@ -1537,48 +1537,44 @@ CMSWindowsPrimaryScreen::mapKey( *altgr = true; } } + } - // map modifier key - KeyModifierMask mask = 0; - if (((m_keys[VK_LSHIFT] | - m_keys[VK_RSHIFT] | - m_keys[VK_SHIFT]) & 0x80) != 0) { - mask |= KeyModifierShift; - } - if (*altgr) { - mask |= KeyModifierModeSwitch; - } - else { - if (((m_keys[VK_LCONTROL] | - m_keys[VK_RCONTROL] | - m_keys[VK_CONTROL]) & 0x80) != 0) { - mask |= KeyModifierControl; - } - if (((m_keys[VK_LMENU] | - m_keys[VK_RMENU] | - m_keys[VK_MENU]) & 0x80) != 0) { - mask |= KeyModifierAlt; - } - } - if (((m_keys[VK_LWIN] | - m_keys[VK_RWIN]) & 0x80) != 0) { - mask |= KeyModifierSuper; - } - if ((m_keys[VK_CAPITAL] & 0x01) != 0) { - mask |= KeyModifierCapsLock; - } - if ((m_keys[VK_NUMLOCK] & 0x01) != 0) { - mask |= KeyModifierNumLock; - } - if ((m_keys[VK_SCROLL] & 0x01) != 0) { - mask |= KeyModifierScrollLock; - } - *maskOut = mask; + // map modifier key + KeyModifierMask mask = 0; + if (((m_keys[VK_LSHIFT] | + m_keys[VK_RSHIFT] | + m_keys[VK_SHIFT]) & 0x80) != 0) { + mask |= KeyModifierShift; + } + if (*altgr) { + mask |= KeyModifierModeSwitch; } else { - // don't care - *maskOut = 0; + if (((m_keys[VK_LCONTROL] | + m_keys[VK_RCONTROL] | + m_keys[VK_CONTROL]) & 0x80) != 0) { + mask |= KeyModifierControl; + } + if (((m_keys[VK_LMENU] | + m_keys[VK_RMENU] | + m_keys[VK_MENU]) & 0x80) != 0) { + mask |= KeyModifierAlt; + } } + if (((m_keys[VK_LWIN] | + m_keys[VK_RWIN]) & 0x80) != 0) { + mask |= KeyModifierSuper; + } + if ((m_keys[VK_CAPITAL] & 0x01) != 0) { + mask |= KeyModifierCapsLock; + } + if ((m_keys[VK_NUMLOCK] & 0x01) != 0) { + mask |= KeyModifierNumLock; + } + if ((m_keys[VK_SCROLL] & 0x01) != 0) { + mask |= KeyModifierScrollLock; + } + *maskOut = mask; return id; }