mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
LibWeb+UI: Detect and handle left vs. right modifier keys
Our handling of left vs. right modifiers keys (shift, ctrl, etc.) was largely not to spec. This patch adds explicit UIEvents::KeyCode values for these keys, and updates the UI to match native key events to these keys (as best as we are able).
This commit is contained in:
parent
448754d95d
commit
4fcaeabe1a
Notes:
github-actions[bot]
2024-10-09 17:10:55 +00:00
Author: https://github.com/trflynn89
Commit: 4fcaeabe1a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1699
9 changed files with 103 additions and 60 deletions
|
@ -1072,7 +1072,7 @@ EventResult EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u
|
|||
return EventResult::Handled;
|
||||
case UIEvents::KeyCode::Key_Left:
|
||||
case UIEvents::KeyCode::Key_Right:
|
||||
if (modifiers > UIEvents::KeyModifier::Mod_Alt && modifiers != (UIEvents::KeyModifier::Mod_Alt | UIEvents::KeyModifier::Mod_AltGr))
|
||||
if (modifiers && modifiers != UIEvents::KeyModifier::Mod_Alt)
|
||||
break;
|
||||
if (modifiers)
|
||||
document->page().traverse_the_history_by_delta(key == UIEvents::KeyCode::Key_Left ? -1 : 1);
|
||||
|
@ -1081,7 +1081,7 @@ EventResult EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u
|
|||
return EventResult::Handled;
|
||||
case UIEvents::KeyCode::Key_PageUp:
|
||||
case UIEvents::KeyCode::Key_PageDown:
|
||||
if (modifiers > UIEvents::KeyModifier::Mod_None)
|
||||
if (modifiers != UIEvents::KeyModifier::Mod_None)
|
||||
break;
|
||||
document->window()->scroll_by(0, key == UIEvents::KeyCode::Key_PageUp ? -page_scroll_distance : page_scroll_distance);
|
||||
return EventResult::Handled;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue