[Geany-devel] Super modifier in keybindings - Re: Strange Geany behavior
Lex Trotman
elextr at xxxxx
Wed Aug 12 03:48:21 UTC 2009
Hi Nick,
I've got good news and bad? news.
Since the project I'm working on is going to use gtkmm I was able to
spend the day generating "my first gtkmm program" which just happens
to try out accelerator keys . I couldn't use C because then I
wouldn't have been able to charge it to the project training budget
;-).
I've attached a simple program which demonstrates the super modifier
problem, so the good news is, it isn't a Geany problem. I will raise
a GTK bug.
The bad? news is that the program also demonstrates that accelerators
can be removed and new ones added and they update the UI nicely. Each
time you activate the button either by accelerator key or by clicking
the menu the accelerator key is incremented.
Note that I had to keep the accel group around to pass it to the
remove call, I'm not sure Geany creates once and uses the same
accel_group everywhere, that may have been the problem if it didn't
work for you in the past.
Or maybe it was a bug in the past :-) Note the documentation note that
says they can't be changed means that they can't be *changed* like
accel_map entries can, not that they can't be removed and a new one
added.
But this might make the whole keybinding code much simpler :-)
Or change the whole thing to use gtk_accel_map that does its own
loading and saving and all. Or leave it as is, but it is doing extra
work and using nested loops as well. Decisions, decisions ...
Cheers
Lex
2009/8/11 Nick Treleaven <nick.treleaven at btinternet.com>:
> On Tue, 11 Aug 2009 23:37:44 +1000
> Lex Trotman <elextr at gmail.com> wrote:
>
>> >> 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.
>
> Yes, I think this is explained in the manual. Stock icons have a fixed
> accelerator.
What a pain, in that case they shouldn't be in the keybindings menu
and their accelerator shouldn't be available for assignment to another
function.
>
>>
>> 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?
>
> Nope ;-)
Yup, ;-)
>
> Regards,
> Nick
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtk.cpp
Type: text/x-c++src
Size: 1441 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090812/4403efde/attachment.cpp>
More information about the Devel
mailing list