Fix capslock on windows (#33093)

The new feature doesn't work well on windows

Release Notes:

- N/A
This commit is contained in:
张小白 2025-06-20 18:57:00 +08:00 committed by GitHub
parent d97a58b20e
commit f8a0eb5a8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View file

@ -1227,7 +1227,6 @@ where
{
let virtual_key = VIRTUAL_KEY(wparam.loword());
let mut modifiers = current_modifiers();
let capslock = current_capslock();
match virtual_key {
VK_SHIFT | VK_CONTROL | VK_MENU | VK_LWIN | VK_RWIN => {
@ -1238,6 +1237,20 @@ where
return None;
}
state.last_reported_modifiers = Some(modifiers);
Some(PlatformInput::ModifiersChanged(ModifiersChangedEvent {
modifiers,
capslock: current_capslock(),
}))
}
VK_CAPITAL => {
let capslock = current_capslock();
if state
.last_reported_capslock
.is_some_and(|prev_capslock| prev_capslock == capslock)
{
return None;
}
state.last_reported_capslock = Some(capslock);
Some(PlatformInput::ModifiersChanged(ModifiersChangedEvent {
modifiers,
capslock,