Re: [gtk-osx-users] Switching keyboard layouts with Alt+Cmd+Space

On Jan 19, 2014, at 6:23 AM, Andrius <andriusr yahoo com> wrote:

There is bug filled on Bugzilla about issue when some of globally defined shortcuts like Alt+Cmd+Space or Cmd+` does not work.
I did some investigation how to rectify this problem, so find attached patch for gdk/quartz/gdkkeys-quartz.c that makes above mentioned shortcuts to work again. 
The fix obviously is not perfect, I did made it in similar style like in bug 711019. These shortcuts are hard-coded and user does not have possibility to redefine them. I am not sure if place of such fixes in gdk/quartz; maybe it is better to define some toplevel bindings in OSX application, and process them here, so each application can redefine them as needed. Or make it part of gtk-mac-integration package, and set accelarator for it like it is done for Cmd+H or Cmd+M.
Just few comments how Alt+Cmd+Space works. At first, I should mention, that there is no standard function that would give You list of keyboard inputs that are active, identical to the one we can get by clicking on the flag in app bar (You are getting "flag dropdown" here).
Next, ordering on keyboard inputs depends on ordering of Language Preferences that are accesible from Settings. The higher some language is in preference, the higher it is located in the flag dropdown. Unfortunately, there is one issue that I did not managed to solve. Input modes (like Romaji and Hiragana for Japanese input) does not follow this rule - it seems there is some lookup table with priorities. So, for making this hack complete we would need to add lookup table for input modes.
My testing of keyboard input switching was limited, however, mostly it does the job (except for some configurations of input modes and language preferences when shortcut does not always select next language from the flag dropdown). From the other hand nobody is perfect, and I think this code can be made better.

The patch and most of the commentary belong on the bug, not here. Patches in particular shouldn't be sent to mailing lists, they just get lost.

Note, however, that the patch in 711019 was withdrawn once the author understood how Gdk event handling interacts with the CFRunLoop. 

What specifically are you talking about for CMD-M and CMD-H? I don't recall any special code in gtk-mac-integration for either.

John Ralls

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]