windows: Fix ctrl-click open hovered URL (#30574)

Closes #30452

Release Notes:

- N/A
This commit is contained in:
张小白 2025-05-12 22:15:50 +08:00 committed by GitHub
parent 19b6c4444e
commit 33c896c23d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 4 deletions

View file

@ -385,10 +385,6 @@ fn handle_keydown_msg(
return Some(1);
};
let mut lock = state_ptr.state.borrow_mut();
let Some(mut func) = lock.callbacks.input.take() else {
return Some(1);
};
drop(lock);
let event = match keystroke_or_modifier {
KeystrokeOrModifier::Keystroke(keystroke) => PlatformInput::KeyDown(KeyDownEvent {
@ -396,9 +392,19 @@ fn handle_keydown_msg(
is_held: lparam.0 & (0x1 << 30) > 0,
}),
KeystrokeOrModifier::Modifier(modifiers) => {
if let Some(prev_modifiers) = lock.last_reported_modifiers {
if prev_modifiers == modifiers {
return Some(0);
}
}
lock.last_reported_modifiers = Some(modifiers);
PlatformInput::ModifiersChanged(ModifiersChangedEvent { modifiers })
}
};
let Some(mut func) = lock.callbacks.input.take() else {
return Some(1);
};
drop(lock);
let result = if func(event).default_prevented {
Some(0)