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.
This commit is contained in:
crs 2002-12-15 22:17:18 +00:00
parent 7649afa00a
commit 2559dd2f05
1 changed files with 25 additions and 0 deletions

View File

@ -133,6 +133,31 @@ CXWindowsPrimaryScreen::isLockedToScreen() const
// locked if any key is down // locked if any key is down
for (unsigned int i = 0; i < sizeof(keyMap); ++i) { for (unsigned int i = 0; i < sizeof(keyMap); ++i) {
if (keyMap[i] != 0) { 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; return true;
} }
} }