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




On Oct 10, 2013, at 12:08 AM, Andrius <andriusr yahoo com> wrote:

John,
do You remember when this was fixed? I tried latest moduleset, indeed, key bindings seems to be OK, but I have got number of other issues (I will write separate message on this). So, probably, for me it would be better to patch old good 3.6.4...
Andrius


No. I wrote on a Gramps bug in early July that I'd found it and backported it to 3.8, but the only commit that fits the date is https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-8&id=c65c2177416719f7769cf4f361fda6bfea50f5c7
and that seems to be in the wrong place.

I think you'll have to re-do the bisect. Sorry.

Regards,
John Ralls



From: John Ralls <jralls ceridwen us>
To: Andrius <andriusr yahoo com>
Cc: "gtk-osx-users-list gnome org" <gtk-osx-users-list gnome org>
Sent: Wednesday, October 9, 2013 10:40 PM
Subject: Re: [gtk-osx-users] Is there a way to override default key bindings?


On Oct 9, 2013, at 12:34 PM, Andrius <andriusr yahoo com> wrote:

> 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?


It was a Gtk bug, since fixed. Rebuilding with the latest modulesets will get you your command-key accelerators and bindings back... with one caveat: Don't set use_quartz_accelerators to TRUE, because then the menu accelerators grab the key binding before gtk can see it, and it gets sent to whatever window has menu focus instead of the one that has keyboard focus.

Regards,
John Ralls







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