Complex key bindings in Gtk
- From: Дмитриев Александр <m1n7 yandex ru>
- To: gnome-devel-list gnome org
- Subject: Complex key bindings in Gtk
- Date: Mon, 03 Jun 2019 12:52:24 +0300
Some text editors like sublime or atom support [complex key bindins][1], when you press and release two or more buttons while holding `Ctrl` or any other modifier key depressed.
There seems to be no direct support of such a concept in Gtk. Of course, one can do something like this:
static second_event_happened = FALSE;
ctrl_k_cb ()
{
g_timeout_add (500, ctrl_k_timeout, NULL) // queue watching function
// adjust accels so that until timeout ctrl+t calls ctrl_k_t_cb
}
ctrl_k_timeout ()
{
if (second_event_happened)
ctrl_k_function ();
else
;
// reset accels to their normal state, i.e. ctrl+t calls ctrl_t_cb
}
ctrl_t_cb ()
{
...
}
ctrl_k_t_cb ()
{
second_event_happened = TRUE;
...
}However, this approach is error-prone.
Is there a more simple or GTK-ish solution?
[1]:
http://docs.sublimetext.info/en/latest/customization/key_bindings.html#key-chords
--
Alexander
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]