Re: [Gtk-osx-users] accelerator problem with GtkOSXApplication
Status: Beta
Brought to you by:
jralls
|
From: Olivier S. <oli...@gm...> - 2011-02-14 21:58:48
|
2011/2/14 Richard Procter <ric...@gm...>: > Just to jump in here: /if/ you're using the gtk AccelMap for keybindings, > which is a 1:1 mapping from application-specific binding names to key binding > definitions that can be altered at run-time, then you can achieve the > ige-mac-integration effect of converting all <ctrl> to <command> via > (in python; should be straightforward to transliterate into C): > > am = gtk.accel_map_get() > > def translate_control_key_to_meta(accel_path, accel_key, accel_mods, changed): > if accel_mods & gtk.gdk.CONTROL_MASK: > accel_mods &= ~gtk.gdk.CONTROL_MASK > accel_mods |= gtk.gdk.META_MASK > > if not gtk.accel_map_change_entry(accel_path, > accel_key, accel_mods, replace=False): > assert False # as binding conflicts with existing, say > > gtk.accel_map_foreach_unfiltered(translate_control_key_to_meta) great! thanks for this piece of sample code. You might want to to add this example to the GtkOSXApplication documentation because it will make life easier for a lot of programmers. I have everything converted to <command> now. Next I'll look at the <alt> issue. Perhaps I'll just remove all of the accelerators that use <alt>. Is the <fn> key on OSX also usable in combination with regular keys? thanks for your help Olivier |