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

Lex Trotman elextr at xxxxx
Fri Jul 31 02:07:55 UTC 2009


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

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.

Why does Geany process the accelerators twice? Once in Geany and once
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.

Cheers
Lex

2009/7/30 Lex Trotman <elextr at gmail.com>:
> 2009/7/30 Nick Treleaven <nick.treleaven at btinternet.com>:
>> On Thu, 30 Jul 2009 20:05:01 +1000
>> Lex Trotman <elextr at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have a really strange problem with Geany.
>>>
>>>  Using Geany 0.17 standard install on open suse 11.0, logged in as a
>>> different user to where I was developing Geany so there is no leakage
>>> from development versions.
>>>
>>> When typing 's' the save as dialog pops up??  I have a keybinding
>>> <super>s for save as but undefining it didn't fix the problem but it
>>> did let me check that <super> isn't stuck on.  It seems to depend on
>>> Geany a <super> keybinding existing when Geany is opened.
>>>
>>> I can turn the problem on and off by closing Geany with the <super>s
>>> keybinding defined and next time I open Geany typing s invokes the
>>> keybinding.
>>> If I undefine the keybinding and close and re-open the problem has gone away.
>>> Its like the <super> is permanently defined so when there is a
>>> keybinding using it then typing just the character s is interpreted as
>>> <super>s.
>>> I tried defining several <super><character> keys and all of them react
>>> the same way, when first defining the keybinding all is well, but on
>>> closing and re-opening Geany the strange behavior starts.  Removing
>>> the keybinding does not fix the problem until Geany is closed and
>>> re-started.  So the problem may be in the load of keybindings.
>>> ~/.config/geany/keybindings.conf contains the <Super>s as expected.
>>
>> I'm not clear, does pressing a <Super>s keybinding actually work at
>> first (and s works normally)?
>
> Yes until Geany is closed and re-opened.
> I have had time to stick a couple of printfs in to see what was saved
> and read from the keybindings file, kb->key=115 kb->mods=0x4000000
> written and read and are correct. But  I can't see where the
> accelerators are added after the dialog is finished to see if it is
> different to keybindings.c/apply_kb_accel
>
> What is the exact string shown in the
>> keybinding prefs treeview?
>
> <Super>s  that is, it actually includes the <> characters and the same
> in keybindings.conf
>
> Super by itself shows Super_L with no <> which is correct iaw GDK_ksysyms.h
>
>>
>> On my system I just found I can't even set a <Super>s binding, the
>> dialog just picks up 's'. It understands the Super key on its own, but
>> not as a modifier. (I have GTK 2.12.5, Xfce 4.4).
>
> Mine is GTK 2.12.9 Gnome 2.22.1 x86_64 platform.
>>
>> I had a look at kb_keytype_dialog_response_cb(), perhaps it's a GDK bug?
>
> Maybe, see how & what the prefs dialog is setting it to first since at
> least the kb structure is being set correctly.
>
> Cheers
> Lex
>
>>
>> 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