fix: stuck modifiers after screen unlock on windows

Fix stuck modifiers (like the windows key) after unlock on Windows
by updating keyboard state after every desk switch.
This commit is contained in:
Matti Hiljanen 2025-10-21 16:35:35 +03:00 committed by Nick Bolton
parent 4a0e2c492c
commit 2016ce887b

View file

@ -798,20 +798,15 @@ void MSWindowsDesks::checkDesk()
sendMessage(DESKFLOW_MSG_ENTER, 0, 0); sendMessage(DESKFLOW_MSG_ENTER, 0, 0);
} }
// check for desk accessibility change. we don't get events // always sync keys when switching desks to ensure keyboard modifier
// from an inaccessible desktop so when we switch from an // states are correct.
// inaccessible desktop to an accessible one we have to
// update the keyboard state.
LOG_DEBUG("switched to desk \"%ls\"", name.c_str()); LOG_DEBUG("switched to desk \"%ls\"", name.c_str());
bool syncKeys = false; bool syncKeys = false;
bool isAccessible = isDeskAccessible(desk); if (isDeskAccessible(desk)) {
if (isDeskAccessible(m_activeDesk) != isAccessible) { LOG_DEBUG("desktop is accessible - syncing keyboard state after desk switch");
if (isAccessible) { syncKeys = true;
LOG_DEBUG("desktop is now accessible"); } else {
syncKeys = true; LOG_DEBUG("desktop is inaccessible");
} else {
LOG_DEBUG("desktop is now inaccessible");
}
} }
// switch desk // switch desk