docs: Add a line on explicit use of modifiers on macOS

This commit is contained in:
Arjan Molenaar
2024-05-24 18:56:17 +02:00
parent 3f05b17d37
commit f072ff3861
3 changed files with 15 additions and 5 deletions

View File

@@ -140,6 +140,11 @@ capture phase, and key bindings locally, during the target phase.
Under the hood, all shortcuts are represented as instances of `GtkShortcut`,
and they are managed by `GtkShortcutController`.
Note that GTK does not do anything to map the primary shortcut modifier
to <kbd>Command</kbd> on macOS. If you want to let your application work
on macOS, you explicitly need to provide keyboard shortcuts.
The <kbd>Command</kbd> is named `Meta` (`GDK_META_MASK`) in GTK.
## Text input
When actual text input is needed (i.e. not just keyboard shortcuts),

View File

@@ -455,7 +455,7 @@ In GTK 4, the meaning of modifiers has been fixed, and backends are
expected to map the platform conventions to the existing modifiers.
The expected use of modifiers in GTK 4 is:
`GDK_CONTROL_MASK`
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
: Primary accelerators
`GDK_ALT_MASK`
@@ -464,7 +464,7 @@ The expected use of modifiers in GTK 4 is:
`GDK_SHIFT_MASK`
: Extending selections
`GDK_CONTROL_MASK`
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
: Modifying selections
`GDK_CONTROL_MASK|GDK_ALT_MASK`
@@ -473,6 +473,11 @@ The expected use of modifiers in GTK 4 is:
Consequently, `GdkModifierIntent` and related APIs have been removed,
and `<Control>` is preferred over `<Primary>` in accelerators.
In GTK 3 on macOS, the `<Primary>` modifier mapped to the <kbd>Command</kbd> key.
In GTK 4, this is no longer the case: `<Primary>` is synonym to `<Control>`.
If you want to make your application to feel native on macOS,
you need to add accelerators GD for macOS that use the `<Meta>` modifier.
A related change is that GTK 4 no longer supports the use of archaic
X11 'real' modifiers with the names Mod1,..., Mod5, and `GDK_MOD1_MASK`
has been renamed to `GDK_ALT_MASK`.

View File

@@ -98,9 +98,9 @@ typedef enum
* @GDK_BUTTON3_MASK: the third mouse button.
* @GDK_BUTTON4_MASK: the fourth mouse button.
* @GDK_BUTTON5_MASK: the fifth mouse button.
* @GDK_SUPER_MASK: the Super modifier
* @GDK_HYPER_MASK: the Hyper modifier
* @GDK_META_MASK: the Meta modifier
* @GDK_SUPER_MASK: the Super modifier.
* @GDK_HYPER_MASK: the Hyper modifier.
* @GDK_META_MASK: the Meta modifier. Maps to Command on macOS.
*
* Flags to indicate the state of modifier keys and mouse buttons
* in events.