From 50679b111d10b21dae655123b219d51e5f5b17ef Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 15 Oct 2021 04:46:46 +0300 Subject: Gtk: solve the key-repeat problem once and for all (or improved on it at least) * Keeping a key pressed could still result in missing graphics updates and thus visual feedback. * Now try to process all Gdk events after thawing the window. It no longer appears to happen. * On the downside, key processing is much slower now which may result in keys being queued up and processed some time even after releasing it. There may be workarounds for that as well... --- src/interface-gtk/interface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/interface-gtk/interface.c') diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index a6369f1..154c950 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -1189,7 +1189,8 @@ teco_interface_key_pressed_cb(GtkWidget *widget, GdkEventKey *event, gpointer us * This should give the UI a chance to update after every keypress. * Would also be possible but tricky to implement with an idle watcher. */ - gtk_main_iteration_do(FALSE); + while (gtk_events_pending()) + gtk_main_iteration_do(FALSE); } while (!g_queue_is_empty(teco_interface.event_queue)); recursed = FALSE; -- cgit v1.2.3