From 6f4d233062d44bd46b2f03596e72f0bc9709d2b5 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Fri, 2 Sep 2022 12:37:48 +0300 Subject: Fix key mapping changes when moving from macOS to other platform Removes separate `Command` key (use `Meta` instead). Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`). --- doc/classes/@GlobalScope.xml | 268 ++++++++++++++++---------------- doc/classes/InputEventWithModifiers.xml | 21 +-- 2 files changed, 146 insertions(+), 143 deletions(-) (limited to 'doc/classes') diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 41d1ccf2ea..3d01c60aea 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1443,385 +1443,385 @@ Enum value which doesn't correspond to any key. This is used to initialize [enum Key] properties with a generic state. - + Keycodes with this bit applied are non-printable. - + Escape key. - + Tab key. - + Shift + Tab key. - + Backspace key. - + Return key (on the main keyboard). - + Enter key on the numeric keypad. - + Insert key. - + Delete key. - + Pause key. - + Print Screen key. - + System Request key. - + Clear key. - + Home key. - + End key. - + Left arrow key. - + Up arrow key. - + Right arrow key. - + Down arrow key. - + Page Up key. - + Page Down key. - + Shift key. - + Control key. - + Meta key. - + Alt key. - + Caps Lock key. - + Num Lock key. - + Scroll Lock key. - + F1 key. - + F2 key. - + F3 key. - + F4 key. - + F5 key. - + F6 key. - + F7 key. - + F8 key. - + F9 key. - + F10 key. - + F11 key. - + F12 key. - + F13 key. - + F14 key. - + F15 key. - + F16 key. - + F17 key. - + F18 key. - + F19 key. - + F20 key. - + F21 key. - + F22 key. - + F23 key. - + F24 key. - + F25 key. Only supported on macOS and Linux due to a Windows limitation. - + F26 key. Only supported on macOS and Linux due to a Windows limitation. - + F27 key. Only supported on macOS and Linux due to a Windows limitation. - + F28 key. Only supported on macOS and Linux due to a Windows limitation. - + F29 key. Only supported on macOS and Linux due to a Windows limitation. - + F30 key. Only supported on macOS and Linux due to a Windows limitation. - + F31 key. Only supported on macOS and Linux due to a Windows limitation. - + F32 key. Only supported on macOS and Linux due to a Windows limitation. - + F33 key. Only supported on macOS and Linux due to a Windows limitation. - + F34 key. Only supported on macOS and Linux due to a Windows limitation. - + F35 key. Only supported on macOS and Linux due to a Windows limitation. - + Multiply (*) key on the numeric keypad. - + Divide (/) key on the numeric keypad. - + Subtract (-) key on the numeric keypad. - + Period (.) key on the numeric keypad. - + Add (+) key on the numeric keypad. - + Number 0 on the numeric keypad. - + Number 1 on the numeric keypad. - + Number 2 on the numeric keypad. - + Number 3 on the numeric keypad. - + Number 4 on the numeric keypad. - + Number 5 on the numeric keypad. - + Number 6 on the numeric keypad. - + Number 7 on the numeric keypad. - + Number 8 on the numeric keypad. - + Number 9 on the numeric keypad. - + Left Super key (Windows key). - + Right Super key (Windows key). - + Context menu key. - + Left Hyper key. - + Right Hyper key. - + Help key. - + Left Direction key. - + Right Direction key. - + Media back key. Not to be confused with the Back button on an Android device. - + Media forward key. - + Media stop key. - + Media refresh key. - + Volume down key. - + Mute volume key. - + Volume up key. - + Bass Boost key. - + Bass up key. - + Bass down key. - + Treble up key. - + Treble down key. - + Media play key. - + Media stop key. - + Previous song key. - + Next song key. - + Media record key. - + Home page key. - + Favorites key. - + Search key. - + Standby key. - + Open URL / Launch Browser key. - + Launch Mail key. - + Launch Media key. - + Launch Shortcut 0 key. - + Launch Shortcut 1 key. - + Launch Shortcut 2 key. - + Launch Shortcut 3 key. - + Launch Shortcut 4 key. - + Launch Shortcut 5 key. - + Launch Shortcut 6 key. - + Launch Shortcut 7 key. - + Launch Shortcut 8 key. - + Launch Shortcut 9 key. - + Launch Shortcut A key. - + Launch Shortcut B key. - + Launch Shortcut C key. - + Launch Shortcut D key. - + Launch Shortcut E key. - + Launch Shortcut F key. - + Unknown key. @@ -2229,27 +2229,27 @@ ΓΏ key. - + Key Code mask. - + Modifier key mask. + + Automatically remapped to [constant KEY_META] on macOS and [constant KEY_CTRL] on other platforms, this mask is never set in the actual events, and should be used for key mapping only. + Shift key mask. - Alt key mask. + Alt or Option (on macOS) key mask. - Meta key mask. + Command (on macOS) or Meta/Windows key mask. Ctrl key mask. - - Command key mask. On macOS, this is equivalent to [constant KEY_MASK_META]. On other platforms, this is equivalent to [constant KEY_MASK_CTRL]. This mask should be preferred to [constant KEY_MASK_META] or [constant KEY_MASK_CTRL] for system shortcuts as it handles all platforms correctly. - Keypad key mask. diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml index b4a276f6ac..d0453156d5 100644 --- a/doc/classes/InputEventWithModifiers.xml +++ b/doc/classes/InputEventWithModifiers.xml @@ -9,27 +9,30 @@ $DOCS_URL/tutorials/inputs/inputevent.html + + + + + On macOS, returns [code]true[/code] if [kbd]Meta[/kbd] ([kbd]Command[/kbd]) is pressed. + On other platforms, returns [code]true[/code] if [kbd]Ctrl[/kbd] is pressed. + + + State of the [kbd]Alt[/kbd] modifier. - - State of the [kbd]Cmd[/kbd] modifier. On macOS, this is equivalent to [member meta_pressed]. On other platforms, this is equivalent to [member ctrl_pressed]. - This modifier should be preferred to [member ctrl_pressed] or [member meta_pressed] for system shortcuts, as it maintains better cross-platform compatibility. + + Automaticaly use [kbd]Meta[/kbd] ([kbd]Command[/kbd]) on macOS and [kbd]Ctrl[/kbd] on other platforms. If [code]true[/code], [member ctrl_pressed] and [member meta_pressed] cannot be set. State of the [kbd]Ctrl[/kbd] modifier. - State of the [kbd]Meta[/kbd] modifier. On Windows and Linux, this represents the Windows key (sometimes called "meta" or "super" on Linux). On macOS, this represents the Command key, and is equivalent to [member command_pressed]. - For better cross-system compatibility, use [member command_pressed] instead. + State of the [kbd]Meta[/kbd] modifier. On Windows and Linux, this represents the Windows key (sometimes called "meta" or "super" on Linux). On macOS, this represents the Command key. State of the [kbd]Shift[/kbd] modifier. - - If [code]true[/code], pressing [kbd]Cmd[/kbd] on macOS or [kbd]Ctrl[/kbd] on all other platforms will both be serialized as [member command_pressed]. If [code]false[/code], those same keys will be serialized as [member meta_pressed] on macOS and [member ctrl_pressed] on all other platforms. - This aids with cross-platform compatibility when developing e.g. on Windows for macOS, or vice-versa. - -- cgit v1.2.3