In an editable GtkTextView, in the context of a mathematical application, I’d like to have Alt+<letter> insert a Greek letter (a → alpha, b → beta and so on). This works fine, using (event->state & GDK_MOD1_MASK) for “Alt”, on Linux and Windows, but on macOS it seems that the combination of “option” (GDK_MOD1_MASK) + letter is already mapped by the OS to a weirdly miscellaneous set of special characters, so my app never sees (for example) GDK_MOD1_MASK along with plain ‘a’ or ‘b’.
My question: has anyone found a way to get the GTK stack to intercept and countermand option-inflected keystrokes on Mac?
Easy enough, it turns out. Put in some debugging to see what keysyms (guints) you actually get when doing option+letter on Mac, for letter = a…z and A…Z. Map those back to GDK_Key_a etc., and then apply the mapping to Greek letters as usual. Here’s the lower case array: