Multiple accelerators for one action

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

 



Hi,

I have an action (zooming in, for example) that needs multiple
keyboard accelerators ("plus", "equal", "KP_Add"). I'm using a
Gio::Action (gtkmm), with the accelerator added separately to the
Gtk::Application. Intuitively, I'd expect multiple calls to
Gtk::Application::add_accelerator() to add multiple accelerators for a
single action, but instead it replaces the last one.

One solution I've seen involves adding multiple GtkActions with
different accelerators and the same callback. But Gio::Actions don't
know about accelerators, so in the window code, it'd look like
multiple identical actions were added, with the different accelerators
set in another part of the code. That seems to go against the loose
coupling between actions and accelerators that Gio::Actions provide
over Gtk::Actions.

Another solution is to handle the key-press-event signal and manually
check if the key press should trigger an action. This also feels
hacky, like I'm adding a custom accelerator system on top of GTK's
existing one.

Is there a clean solution for this problem? Thanks.
_______________________________________________
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