[Geany-devel] Super modifier in keybindings - Re: Strange Geany behavior

Lex Trotman elextr at xxxxx
Tue Aug 11 13:37:44 UTC 2009


2009/8/11 Nick Treleaven <nick.treleaven at btinternet.com>:
> Hi,
> Sorry for the delay.

No problem

> On Fri, 31 Jul 2009 12:07:55 +1000
> Lex Trotman <elextr at gmail.com> wrote:
>> Ok, it may be a GTK bug, I'll describe whats going on & you can decide
>> and tell GTK, I've had zero success dealing with them in the past.
>> Geany keybindings are captured by keybindings.c/on_key_press_event and
>> don't go to GTK but all other keys go to GTK
>> When a keybinding is first set Geany does NOT set it as a GTK
>> accelerator, but the above callback catches it and it works fine, and
>> if the binding is a key with a modifier the unmodified keys go to GTK
>> and work fine
>> When keybindings are loaded from file (ie when Geany is closed and
>> re-opened) they are set as GTK accelerators but are still caught by
>> on_key_press_event before GTK.  But if the binding is a key with a
>> modifier the unmodified key goes to GTK which appears to erroneously
>> interpret it as an accelerator if the modifier in the
>> gtk_widget_set_accelerator was GDK_SUPER_MASK
> Not quite understanding this, perhaps it's better if you report that ;-)

I'll see if I get time to make a minimal GTK program to show the problem.

>> The reason you can't set super as a modifier may be that the default
>> modifier mask is set to block it.  I don't know what sets it, mine is
>> 1c00000d which allows super at 4000000 and thats the value when the
>> accelerator is set and when the keypress event occurs.
> Mine is 67108864, so should work.
>> Why does Geany process the accelerators twice? Once in Geany and once
> Because we haven't found an easy way to update accelerators during
> runtime.
>> in GTK.  It seems to me that keybindings don't actually need to be set
>> as accelerators since on_key_press_event catches them all first, and
>> that would work around the GTK problem.
> Yes, but this provides handy information to the user so they don't need
> to lookup the keybinding.

Of course, it should update the accelerator on the menu!!!

But it actually doesn't until I close and re-open Geany, and then some
seem to be pretty persistent, if a keybinding of the standard ones eg
Ctrl o for open is re-assigned it actually still says Ctrl o on the
open menu item but executes the re-assigned action even after closing
and re-opening Geany.

As to how to do it at runtime I'm not sure, but can't you just call
gtk_widget_accelerator_remove with the old one and then
gtk_accelerator_add with the new one?

Assuming they work right of course ;-)

> Regards,
> Nick
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

More information about the Devel mailing list