Re: [Gtk-osx-users] accelerator problem with GtkOSXApplication

On Feb 14, 2011, at 11:15 AM, Olivier Sessink wrote:

> On 02/14/2011 04:03 PM, John Ralls wrote:
>> On Feb 14, 2011, at 4:14 AM, Olivier Sessink wrote:
>>>> Accelerator mapping in GtkOSXApplication is handled the Gtk way, with GtkAccelMaps. This is mentioned in the GtkOSXApplication documentation.
>>>> Option/Alt is handled a bit too generically in gdk-quartz, where it's used for i18n regardless of context and consequently ignored when used as an accelerator. Ideally this handling should only occur in the input method, but I haven't figured out how to do that yet and Kristian Reitveld doesn't think it's important enough to do anything about. If anyone knows enough about the simple input method to write a patch to fix this it would be most welcome. Post it to
>>> so what are my options if I do not know the details about input
>>> methods? I can go back to ige-mac-integration and try to get my menu
>>> problem solved, but that seems to be a step backwards.. Are there
>>> other options? Converting the shortcuts in the application code
>>> somehow?
>> Like I said, GtkAccelMaps:
>> There's even an example in test-integration.
> sorry perhaps I've not understand you correctly. GtkAccelMaps as shown 
> in test-integration.c can be used to modify the accelerator for an entry 
> in the menu. But from your email I understood that this will not help to 
> fix the problem with the <alt> key. Is that correct or not?
> Futhermore, why I really would like to get the 'magic' behavior of 
> ige-mac-integration: I have about 295 menu entries in Bluefish (that's 
> why I really need <alt> to maximise the number of entries that have an 
> accelerator). In the old ige-mac-integration code all entries were 
> automatically converted from <control> to <command>. With the new 
> GtkOSXApplication code it seems I need something like 600 lines of extra 
> code to replace all accelerators, and I should try to keep these in 
> sync. Or is this again a misunderstanding and can I get the 'magic' 
> behavior with a few lines of code?
> forgive me for my ignorance on this subject, I'm not a fulltime gtk 
> programmer and it's sometimes hard to keep track of all the 
> possibilities in gtk.

1. No, your map has to use something other than the alt key on OSX. The example in test-integration uses one line of code to modify ALL of the accelerators. Go RTFM.

2. I'm not going back to the automatic thing. Get a accelmap file, do sed -i '' s/alt/meta/i mapfile,
and add it to your bundle. Add a call to load it somewhere (you should have that already if you've done a good job on the Gtk side). That's effectively what the automatic conversion in ige-mac-integration did.

Rest assured that your non-english-speaking users would rather have the option key for typing non-ascii text than for accelerators, but if you want to turn that off, use the local copy of gtk-osx.modules (it's installed in ~/Source/jhbuild/modulesets by and comment out the keymap patches.

Aside: In what HIG does it say that you should have an accelerator for every menu item? Are you trying to compete with Emacs?

No, no forgiveness. I am absolutely not going to teach you to use Gtk -- for one thing, I'm not good enough at it myself to do any teaching. Go study the documentation.

John Ralls

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