From 2559dd2f05d3bb7d3eba83bb07ff3128126ca766 Mon Sep 17 00:00:00 2001 From: crs Date: Sun, 15 Dec 2002 22:17:18 +0000 Subject: [PATCH] Now ignoring half-duplex keys that are down when deciding if the mouse is locked to the screen. We can't tell if a half- duplex key is physically down and logically down just means it's active so there's no point in letting it lock the mouse to the screen. --- lib/server/CXWindowsPrimaryScreen.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/server/CXWindowsPrimaryScreen.cpp b/lib/server/CXWindowsPrimaryScreen.cpp index 57e0092d..06452696 100644 --- a/lib/server/CXWindowsPrimaryScreen.cpp +++ b/lib/server/CXWindowsPrimaryScreen.cpp @@ -133,6 +133,31 @@ CXWindowsPrimaryScreen::isLockedToScreen() const // locked if any key is down for (unsigned int i = 0; i < sizeof(keyMap); ++i) { if (keyMap[i] != 0) { + // if any key is half-duplex then it'll be down when + // toggled on but shouldn't count as a reason to lock + // to the screen. + if (m_numLockHalfDuplex || m_capsLockHalfDuplex) { + for (unsigned int j = 0; j < 8; ++j) { + if ((keyMap[i] & (1 << j)) != 0) { + const KeyCode keycode = 8 * i + j; + const KeySym keysym = XKeycodeToKeysym(display, + keycode, 0); + if (m_numLockHalfDuplex && keysym == XK_Num_Lock) { + continue; + } + if (m_capsLockHalfDuplex && keysym == XK_Caps_Lock) { + continue; + } + + // non-half-duplex key down + return true; + } + } + + // only half-duplex keys down + continue; + } + return true; } }