Re: Disabling accelerators when typing text

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

 



I don't have a GTK+3 answer for you. We wrestled with this in Ardour which uses GTK+2, and cooked up quite a substantial hack to make it work. You can read that and the explanatory comments here:

https://github.com/Ardour/ardour/blob/4.7/gtk2_ardour/utils.cc#L448

SInce that tag (4.7) we've now replaced the entire GTK+2 accelerator mechanism with our own, because we cannot be limited by GTK+ ideas that some accelerators are off-limits. We now use our own system which hooks into the key_press and key_release events for every top level window.

We do use Actions (such as they were in GTK+2) for almost everything, and we continue to push our bindings into GTK+ so that accelerators show up in menu items. I can't recommend this drastic of an approach, just noting that we had to take it.

On Sat, Jun 4, 2016 at 3:34 PM, productivememberofsociety666 <productivememberofsociety666@xxxxxxxxxxxxxxxxx> wrote:
Hello,

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
process.

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
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux