Fix capslock on windows (#33093)
The new feature doesn't work well on windows Release Notes: - N/A
This commit is contained in:
parent
d97a58b20e
commit
f8a0eb5a8c
2 changed files with 17 additions and 1 deletions
|
@ -1227,7 +1227,6 @@ where
|
||||||
{
|
{
|
||||||
let virtual_key = VIRTUAL_KEY(wparam.loword());
|
let virtual_key = VIRTUAL_KEY(wparam.loword());
|
||||||
let mut modifiers = current_modifiers();
|
let mut modifiers = current_modifiers();
|
||||||
let capslock = current_capslock();
|
|
||||||
|
|
||||||
match virtual_key {
|
match virtual_key {
|
||||||
VK_SHIFT | VK_CONTROL | VK_MENU | VK_LWIN | VK_RWIN => {
|
VK_SHIFT | VK_CONTROL | VK_MENU | VK_LWIN | VK_RWIN => {
|
||||||
|
@ -1238,6 +1237,20 @@ where
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
state.last_reported_modifiers = Some(modifiers);
|
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 {
|
Some(PlatformInput::ModifiersChanged(ModifiersChangedEvent {
|
||||||
modifiers,
|
modifiers,
|
||||||
capslock,
|
capslock,
|
||||||
|
|
|
@ -43,6 +43,7 @@ pub struct WindowsWindowState {
|
||||||
pub callbacks: Callbacks,
|
pub callbacks: Callbacks,
|
||||||
pub input_handler: Option<PlatformInputHandler>,
|
pub input_handler: Option<PlatformInputHandler>,
|
||||||
pub last_reported_modifiers: Option<Modifiers>,
|
pub last_reported_modifiers: Option<Modifiers>,
|
||||||
|
pub last_reported_capslock: Option<Capslock>,
|
||||||
pub system_key_handled: bool,
|
pub system_key_handled: bool,
|
||||||
pub hovered: bool,
|
pub hovered: bool,
|
||||||
|
|
||||||
|
@ -102,6 +103,7 @@ impl WindowsWindowState {
|
||||||
let callbacks = Callbacks::default();
|
let callbacks = Callbacks::default();
|
||||||
let input_handler = None;
|
let input_handler = None;
|
||||||
let last_reported_modifiers = None;
|
let last_reported_modifiers = None;
|
||||||
|
let last_reported_capslock = None;
|
||||||
let system_key_handled = false;
|
let system_key_handled = false;
|
||||||
let hovered = false;
|
let hovered = false;
|
||||||
let click_state = ClickState::new();
|
let click_state = ClickState::new();
|
||||||
|
@ -121,6 +123,7 @@ impl WindowsWindowState {
|
||||||
callbacks,
|
callbacks,
|
||||||
input_handler,
|
input_handler,
|
||||||
last_reported_modifiers,
|
last_reported_modifiers,
|
||||||
|
last_reported_capslock,
|
||||||
system_key_handled,
|
system_key_handled,
|
||||||
hovered,
|
hovered,
|
||||||
renderer,
|
renderer,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue