Re: Disabling accelerators when typing text



Thank you very much, Paul Davis and Andrew E. Markeev, for your
responses - now I have reference implementations of both workarounds I
mentioned in my question (intercepting key press to suppress accelerator
/ removing accelerator on widget focus), so this should help a lot no
matter which route I end up taking.

When I was writing the question, I was trying something similar to
Andrew's approach, as it is felt less radical, i.e. you don't have to
basically replace any standard GTK+ key handling code with your own - of
course this also means it's less powerful if you do want to make radical
changes.
I think in the new "actions/menus/accelerators via Gio" paradigm of GTK+
3 [1]  it still works very similar to how Andrew described it, except
you have to use gtk_application_set_accels_for_action for everything
(there are other methods but they are declared obsolete). I wrote
something up in [2] for people who come across this discussion in the
future.

One thing I don't like is that there are things in GTK+ such as
AccelGroups and AccelMaps which should allow you to add and remove all
accelerators in one batch, except there aren't any methods for doing so
- the method I mentioned seems to be the only one for modifying
accelerators. In general the new GTK+ 3 paradigm seems to be pretty
closed-off, I will probably ask another question regarding this later.

In any case, thanks for your help, if someone has a better idea still,
they can post it here.

Cheers

[1]: https://wiki.gnome.org/HowDoI/GAction
[2]:
https://gist.github.com/productivememberofsociety666/495ccf2e3679e37423ddd834307d3d1a


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