Fixed loss of ctrl+alt+del key releases when the Winlogin desktop

is accessible (was already fixed when inaccessible).  This change
also ignores press and release of virtual key 0, which should never
happen but does according to one user.
This commit is contained in:
crs 2003-05-26 09:46:52 +00:00
parent 3bd3e7a17c
commit 3fc87e7f87
2 changed files with 36 additions and 0 deletions

View File

@ -1501,6 +1501,10 @@ CMSWindowsPrimaryScreen::updateKeys()
// we only care about the modifier key states. other keys and the // we only care about the modifier key states. other keys and the
// mouse buttons should be up. // mouse buttons should be up.
// sometimes these seem to be out of date so, to avoid getting
// locked to a screen unexpectedly, just assume the non-toggle
// modifier keys are up.
/*
m_keys[VK_LSHIFT] = static_cast<BYTE>(GetKeyState(VK_LSHIFT) & 0x80); m_keys[VK_LSHIFT] = static_cast<BYTE>(GetKeyState(VK_LSHIFT) & 0x80);
m_keys[VK_RSHIFT] = static_cast<BYTE>(GetKeyState(VK_RSHIFT) & 0x80); m_keys[VK_RSHIFT] = static_cast<BYTE>(GetKeyState(VK_RSHIFT) & 0x80);
m_keys[VK_SHIFT] = static_cast<BYTE>(GetKeyState(VK_SHIFT) & 0x80); m_keys[VK_SHIFT] = static_cast<BYTE>(GetKeyState(VK_SHIFT) & 0x80);
@ -1513,6 +1517,7 @@ CMSWindowsPrimaryScreen::updateKeys()
m_keys[VK_LWIN] = static_cast<BYTE>(GetKeyState(VK_LWIN) & 0x80); m_keys[VK_LWIN] = static_cast<BYTE>(GetKeyState(VK_LWIN) & 0x80);
m_keys[VK_RWIN] = static_cast<BYTE>(GetKeyState(VK_RWIN) & 0x80); m_keys[VK_RWIN] = static_cast<BYTE>(GetKeyState(VK_RWIN) & 0x80);
m_keys[VK_APPS] = static_cast<BYTE>(GetKeyState(VK_APPS) & 0x80); m_keys[VK_APPS] = static_cast<BYTE>(GetKeyState(VK_APPS) & 0x80);
*/
m_keys[VK_CAPITAL] = static_cast<BYTE>(GetKeyState(VK_CAPITAL)); m_keys[VK_CAPITAL] = static_cast<BYTE>(GetKeyState(VK_CAPITAL));
m_keys[VK_NUMLOCK] = static_cast<BYTE>(GetKeyState(VK_NUMLOCK)); m_keys[VK_NUMLOCK] = static_cast<BYTE>(GetKeyState(VK_NUMLOCK));
m_keys[VK_SCROLL] = static_cast<BYTE>(GetKeyState(VK_SCROLL)); m_keys[VK_SCROLL] = static_cast<BYTE>(GetKeyState(VK_SCROLL));
@ -1523,6 +1528,13 @@ CMSWindowsPrimaryScreen::updateKey(UINT vkCode, bool press)
{ {
if (press) { if (press) {
switch (vkCode) { switch (vkCode) {
case 0:
case VK_LBUTTON:
case VK_MBUTTON:
case VK_RBUTTON:
// ignore bogus key
break;
case VK_LSHIFT: case VK_LSHIFT:
case VK_RSHIFT: case VK_RSHIFT:
case VK_SHIFT: case VK_SHIFT:
@ -1558,9 +1570,31 @@ CMSWindowsPrimaryScreen::updateKey(UINT vkCode, bool press)
m_keys[vkCode] |= 0x80; m_keys[vkCode] |= 0x80;
break; break;
} }
// special case: we detect ctrl+alt+del being pressed on some
// systems but we don't detect the release of those keys. so
// if ctrl, alt, and del are down then mark them up.
if ((m_keys[VK_CONTROL] & 0x80) != 0 &&
(m_keys[VK_MENU] & 0x80) != 0 &&
(m_keys[VK_DELETE] & 0x80) != 0) {
m_keys[VK_LCONTROL] &= ~0x80;
m_keys[VK_RCONTROL] &= ~0x80;
m_keys[VK_CONTROL] &= ~0x80;
m_keys[VK_LMENU] &= ~0x80;
m_keys[VK_RMENU] &= ~0x80;
m_keys[VK_MENU] &= ~0x80;
m_keys[VK_DELETE] &= ~0x80;
}
} }
else { else {
switch (vkCode) { switch (vkCode) {
case 0:
case VK_LBUTTON:
case VK_MBUTTON:
case VK_RBUTTON:
// ignore bogus key
break;
case VK_LSHIFT: case VK_LSHIFT:
case VK_RSHIFT: case VK_RSHIFT:
case VK_SHIFT: case VK_SHIFT:

View File

@ -508,6 +508,7 @@ CMSWindowsScreen::onPreDispatch(const CEvent* event)
// if the desktop was inaccessible then notify the // if the desktop was inaccessible then notify the
// event handler of that. // event handler of that.
if (m_inaccessibleDesktop) { if (m_inaccessibleDesktop) {
LOG((CLOG_INFO "desktop is now accessible"));
m_inaccessibleDesktop = false; m_inaccessibleDesktop = false;
m_eventHandler->onAccessibleDesktop(); m_eventHandler->onAccessibleDesktop();
} }
@ -515,6 +516,7 @@ CMSWindowsScreen::onPreDispatch(const CEvent* event)
else if (!m_inaccessibleDesktop) { else if (!m_inaccessibleDesktop) {
// the desktop has become inaccessible // the desktop has become inaccessible
m_inaccessibleDesktop = true; m_inaccessibleDesktop = true;
LOG((CLOG_INFO "desktop is now inaccessible"));
} }
} }