Web lists-archives.com

Disabling accelerators when typing text


I just want to reask a question that was asked on StackOverflow [1] but
didn't receive a satisfactory answer there. Maybe someone on this list
has a better idea:

I want to use ordinary letters *without modifiers* as accelerators in my
GTK+ 3 application, similar to vim's control scheme. For example, the
user could just press 'r' and it would remove an item in a list or
something like that.
So far this works fine, except the accelerators are also enabled while
the user has focused a text editing widget, and as a result it's
impossible to write text without activating a dozen accelerators in the

Is there a standard way to disable accelerators in  text editing
widgets? If not, what would you say is the best approach for a
workaround? E.g. should I try to intercept key presses somehow and check
whether a text editing widget is focused, or should I try to remove
accelerators whenever such a widget is focused and add them again when
it loses focus, or do something else entirely?

I'm using GTK+ 3 and try to adhere to the "new" recommended way of
handling menu items, accelerators and corresponding actions using Gio,
i.e. the way it is described in [2].

Thank you in advance!

[1]: http://stackoverflow.com/q/22782726/2748899

[2]: https://wiki.gnome.org/HowDoI/GAction

gtk-list mailing list