[gtk-osx-users] Is there a way to override default key bindings?



Hi all,
I have one interesting issue that could not figure out how to solve. Using gtk+3.6.4 on MacOSX 10.8.4.
I want to override default key bindings for some widgets, most important are GtkEntry and GtkTextView. I did search on forums, but nothing useful was found. Tried several things that are described in gtk+3 docs, but it seems that nothing from these works on MacOSX:
1. Tried to but into gtk-keys.css following code:
@binding-set gtk-mac-cmd-c
{
  bind "<meta>x" { "cut-clipboard" () };
  bind "<meta>c" { "copy-clipboard" () };
  bind "<meta>v" { "paste-clipboard" () };
  unbind "<ctrl>x";
  unbind "<ctrl>c";
  unbind "<ctrl>v";
}
GtkEntry {
  gtk-key-bindings: gtk-mac-cmd-c;
}
No effect, all actions on GtkEntry still are done with ctrl+...
2. Tried loading binding_set into program with GtkCssProvider like in this pseudocode:
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_path (provider, filename, &error)) ;   
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_USER);
The css file I am loading has binding-set like in #1. Again, binding did not changed, although styles that were in css file were applied successfully. It looks that @binding-set rule is not processed for some reason on MacOSX.
3. The only way that works is to connect key-press-event signal to the GtkEntry and handle cmd+... combinations in signal callback manually. But this way I am having both ctrl+v and cmd+v doing the same thing - pasting text, for example. And having to handle this for each widget separately is not something that one would be wanting to do.
I am wondering if anybody knows solution to this problem... or is it know bug?
Andrius


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