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



2011/2/14 Richard Procter <richard n procter gmail com>:
> 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

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Gtk-osx-users mailing list
Gtk-osx-users lists sourceforge net
https://lists.sourceforge.net/lists/listinfo/gtk-osx-users


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