widgets: ignore GDK_MOD2_MASK when...
...remapping shortcuts with GDK_META_MASK On macOS, the Command key is GDK_META_MASK. But when setting a shortcut, GDK_MOD2_MASK is added too. This extra modifier makes it hard to check if the shortcut is already in use. GIMP sees it as a different combination, even if it's really the same. Now, when GDK_META_MASK is used, we remove GDK_MOD2_MASK. This helps GIMP detect existing shortcuts correctly and avoid duplicates.
This commit is contained in:
parent
2e12de6747
commit
b65bd2bd4c
1 changed files with 12 additions and 0 deletions
|
|
@ -712,6 +712,18 @@ gimp_action_view_accel_edited (GtkCellRendererAccel *accel,
|
|||
accel_mask == action_accel_mask)
|
||||
return;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
/* On macOS, pressing the Command key (GDK_META_MASK) often results in
|
||||
* GDK_MOD2_MASK being added automatically by the system.
|
||||
* This causes shortcut comparisons to fail because GIMP treats
|
||||
* "Command" and "Command+Mod2" as different combinations.
|
||||
* To avoid false mismatches and detect duplicates correctly,
|
||||
* we remove GDK_MOD2_MASK whenever GDK_META_MASK is present.
|
||||
*/
|
||||
if ((accel_mask & (GDK_META_MASK | GDK_MOD2_MASK)) == (GDK_META_MASK | GDK_MOD2_MASK))
|
||||
accel_mask &= ~GDK_MOD2_MASK;
|
||||
#endif
|
||||
|
||||
if (! accel_key ||
|
||||
|
||||
/* Don't allow arrow keys, they are all swallowed by the canvas
|
||||
|
|
|
|||
Loading…
Reference in a new issue