From 510187a733218b3e290b87106e8f9918be7c8632 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 3 Apr 2018 18:57:00 +0100 Subject: [PATCH] Ignore spurious configure_area events. Colin Watson reports that on pre-releases of Ubuntu 18.04, configure events which don't actually involve a change of window size show up annoyingly often. Our handling of configure events involves throwing away the backing Cairo surface, making a fresh blank one, and scheduling a top-level callback to get terminal.c to do a repaint and populate the new surface; so a draw event before that callback occurs causes the window contents to flicker off and on again, not to mention wasting a lot of time. The simplest solution is to spot spurious configures, and respond by not throwing away the previous Cairo surface in the first place. --- unix/gtkwin.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 314db770..b058db27 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -91,6 +91,7 @@ struct clipboard_state { struct gui_data { GtkWidget *window, *area, *sbar; gboolean sbar_visible; + gboolean area_configured; GtkBox *hbox; GtkAdjustment *sbar_adjust; GtkWidget *menu, *specialsmenu, *specialsitem1, *specialsitem2, @@ -645,6 +646,16 @@ gint configure_area(GtkWidget *widget, GdkEventConfigure *event, gpointer data) need_size = 1; } + /* + * If the terminal size hasn't changed since the previous call to + * this function (in particular, if there has at least _been_ a + * previous call to this function), then, we can assume this event + * is spurious and do nothing further. + */ + if (!need_size && inst->area_configured) + return TRUE; + inst->area_configured = TRUE; + { int backing_w = w * inst->font_width + 2*inst->window_border; int backing_h = h * inst->font_height + 2*inst->window_border;