From 9b165510cb465af2403e014d529925f64c4145a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Mon, 15 May 2023 00:22:58 -0400
Subject: [PATCH] On a ConfigureNotify event, only call handle_resize_event()
 if size changed.

This mirrors commit 0748cc1e about a year ago that optimized window
dragging, and performs basically the same check (removed a week ago
with commit b4ce023c)
---
 src/conio/x_events.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index 7c84ffb2af..1a4a79aa54 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -857,11 +857,18 @@ static int x11_event(XEvent *ev)
 			break;
 		/* Graphics related events */
 		case ConfigureNotify: {
+			bool resize = false;
+
 			if (x11_window_xpos != ev->xconfigure.x || x11_window_ypos != ev->xconfigure.y) {
 				x11_window_xpos=ev->xconfigure.x;
 				x11_window_ypos=ev->xconfigure.y;
 			}
-			handle_resize_event(ev->xconfigure.width, ev->xconfigure.height);
+			pthread_mutex_lock(&vstatlock);
+			if (ev->xconfigure.width != vstat.winwidth || ev->xconfigure.height != vstat.winheight)
+				resize = true;
+			pthread_mutex_unlock(&vstatlock);
+			if (resize)
+				handle_resize_event(ev->xconfigure.width, ev->xconfigure.height);
 			break;
 		}
 		case NoExpose:
-- 
GitLab