From 37c79a65585b06197c2196970822bb0d4e03b04a Mon Sep 17 00:00:00 2001
From: Deuce <shurd@sasktel.net>
Date: Wed, 21 Feb 2024 15:14:50 -0500
Subject: [PATCH] Count flushes to disable resize hack.

Instead of strictly using "first resize", also count flushes and
assume the hack isn't needed after five.  Experimentation on my
ChromeBook shows 3 to be sufficient, so I'm sing five for now.

Odds are that this will still mess with tiling WMs, but I don't use
one, so I don't mind yet.  I expect this will be better, but likely
still not great.
---
 src/conio/x_events.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index f2b0b41065..5bb241cb20 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -2203,6 +2203,7 @@ void x11_event_thread(void *args)
 	XEvent ev;
 	static struct timeval tv;
 	int mode = (int)(intptr_t)args;
+	int flush_count = 0;
 
 	SetThreadName("X11 Events");
 	if (mode == CIOLIB_MODE_X_FULLSCREEN)
@@ -2321,6 +2322,10 @@ void x11_event_thread(void *args)
 							break;
 						case X11_LOCAL_FLUSH:
 							x11.XFlush(dpy);
+							if (!got_first_resize) {
+								if (++flush_count > 5)
+									got_first_resize = true;
+							}
 							break;
 						case X11_LOCAL_BEEP:
 							x11.XBell(dpy, 100);
-- 
GitLab