Re: [gtk-osx-users] modifyng Gtk-2 keybinding




On Apr 15, 2014, at 9:47 AM, b m <bermarte hotmail com> wrote:

Going back to my question, I have found a solution for my problem.
My goal was simply being able to use <COMMAND><C> instead of <CONTROL><C> and < COMMAND><V>instead of 
<CONTROL><V> but I had introduced spurious elements when I was formulating my question.
Reading the 'Menu accelerators's part in https://wiki.gnome.org/Projects/GTK%2B/OSX/Integration I was 
confused, I did not know how to search things properly (IMO there should be more emphasis about 
keybindings). I am still not sure what exactly 'automatic conversion' and 'new facility' refer to; 
shouldn't be explained more clearly, maybe?
This is what I have done; I have edited the gtkr file inside my bundle 
(My.app/Contents/Resources/etc/gtk-2.0) to include these lines and now everything works like it should.
Really useful and simple once you know how to do it.

# Mac-like text editing keybindings
binding "gtk-mac-text-entry"
{
   unbind "<ctrl>c"
   unbind "<ctrl>v"
   bind "<meta>c" { "copy-clipboard" () }
   bind "<meta>v" { "paste-clipboard" () }
  #   ...
}
class "GtkEntry" binding "gtk-mac-text-entry"

It’s not really new anymore, but the “new facility” introduced a macro GTK_DEFAULT_ACCEL_MOD_MASK which is 
defined as <meta> for quartz and <ctrl> for everything else. This already in the stock bindings and 
accelerators for gtk+-2.24.8 and later, so unless you’re using a very old version for something there should 
be no need to rebind copy and paste for a GtkEntry.

In Gtk3, the equivalent macro is PRIMARY_MODIFIER, but it’s deprecated along with everything else having to 
do with stock labels.

Note as well that there is a mac key theme distributed with both versions of Gtk; you need only say
  gtk-key-theme-name=“Mac"
in ~/.gtkrc-2.0 or ~/gtk-3.0/settings.ini to invoke it.

Regards,
John Ralls



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