mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Define a helper constant for the platform ctrl-ish key
For all intents and purposes, the cmd (super) key on macOS should be treated as the ctrl key.
This commit is contained in:
parent
ee00730225
commit
71b25e3e5a
Notes:
github-actions[bot]
2024-08-02 06:08:11 +00:00
Author: https://github.com/trflynn89
Commit: 71b25e3e5a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/925
2 changed files with 16 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/EnumBits.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
namespace Web::UIEvents {
|
||||
|
@ -169,6 +170,12 @@ enum KeyModifier {
|
|||
Mod_Mask = Mod_Alt | Mod_Ctrl | Mod_Shift | Mod_Super | Mod_AltGr | Mod_Keypad,
|
||||
|
||||
Is_Press = 0x80,
|
||||
|
||||
#if defined(AK_OS_MACOS)
|
||||
Mod_PlatformCtrl = Mod_Super,
|
||||
#else
|
||||
Mod_PlatformCtrl = Mod_Ctrl,
|
||||
#endif
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(KeyModifier);
|
||||
|
|
|
@ -56,6 +56,15 @@ public:
|
|||
bool alt_key() const { return m_alt_key; }
|
||||
bool meta_key() const { return m_meta_key; }
|
||||
|
||||
bool platform_ctrl_key() const
|
||||
{
|
||||
#if defined(AK_OS_MACOS)
|
||||
return meta_key();
|
||||
#else
|
||||
return ctrl_key();
|
||||
#endif
|
||||
}
|
||||
|
||||
double movement_x() const { return m_movement_x; }
|
||||
double movement_y() const { return m_movement_y; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue