mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
When a shortcut is an alternative key, macOS first fires a key event for
the primary key. Then if it is not handled, it fires an event for the
alternative key. For example, we see these two events in a row when we
press cmd and =/+:
NSEvent: type=KeyDown flags=0x100108 chars="=" keyCode=25
NSEvent: type=KeyDown flags=0x100108 chars="+" keyCode=24
For dead key processing, we don't handle these events right away. By the
time we get to doCommandBySelector, when we call [NSApp currentEvent],
we see the following events:
NSEvent: type=KeyDown flags=0x100108 chars="=" keyCode=24
NSEvent: type=AppDefined flags=0
The AppDefined event is internally posted by our event loop. So it seems
we cannot rely on currentEvent being the key-down event we are looking
for.
Instead, we can store the key-down event that we last saw.
|
||
|---|---|---|
| .. | ||
| Autocomplete.h | ||
| Autocomplete.mm | ||
| Event.h | ||
| Event.mm | ||
| InfoBar.h | ||
| InfoBar.mm | ||
| LadybirdWebView.h | ||
| LadybirdWebView.mm | ||
| LadybirdWebViewBridge.cpp | ||
| LadybirdWebViewBridge.h | ||
| LadybirdWebViewWindow.h | ||
| LadybirdWebViewWindow.mm | ||
| Menu.h | ||
| Menu.mm | ||
| Palette.h | ||
| Palette.mm | ||
| SearchPanel.h | ||
| SearchPanel.mm | ||
| Tab.h | ||
| Tab.mm | ||
| TabController.h | ||
| TabController.mm | ||