gtk_accelerator_get_default_mod_mask() behaves differently on OS X under GTK 3 when compared to GTK 2. On GTK 2 it used to clear the GDK_MOD2_MASK bit while on GTK 3 it's preserved. We need to clear it ourselves otherwise e.g. <Command>S leads to <Commands><Mod2>S and none of the keybindings work under GTK 3. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1636
-- Commit Summary --
* Make sure GDK_MOD2_MASK is cleared when getting modifiers
-- File Changes --
M src/keybindings.c (3)
-- Patch Links --
https://github.com/geany/geany/pull/1636.patch https://github.com/geany/geany/pull/1636.diff
b4n approved this pull request.
Looks sensible
mods |= GEANY_PRIMARY_MOD_MASK;
+ mods &= ~GDK_MOD2_MASK;
You could do (not sure if it's better though) ```c mods = mods ^ GDK_MOD2_MASK | GEANY_PRIMARY_MOD_MASK; ```
techee commented on this pull request.
mods |= GEANY_PRIMARY_MOD_MASK;
+ mods &= ~GDK_MOD2_MASK;
I slightly prefer my version - it's a bit easier to understand (at least by my poor brain) and it's guaranteed to set/clear the bits while the XOR depends on the actual value of mods (but it probably won't contain GEANY_PRIMARY_MOD_MASK bit and is guaranteed to have GDK_MOD2_MASK set).
b4n commented on this pull request.
mods |= GEANY_PRIMARY_MOD_MASK;
+ mods &= ~GDK_MOD2_MASK;
Unless I'm mistaken, in the expression above `^` has priority over `|` so it's the same as `(mods ^ GDK_MOD2_MASK) | GEANY_PRIMARY_MOD_MASK`. But the simple fact you said what you did makes your version better, as it's then less confusing.
Merged #1636.
techee commented on this pull request.
mods |= GEANY_PRIMARY_MOD_MASK;
+ mods &= ~GDK_MOD2_MASK;
Yep, the original version is better so dummies like me who don't know priorities don't get confused :-).
github-comments@lists.geany.org