From 4215206babefa99f23ad98d841b547748d016977 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 14 Apr 2020 19:25:49 +0000
Subject: [PATCH] Resize the window if X and Y aren't scaled the same amount.
 Resize the xim if the window isn't scaled.

---
 src/conio/x_events.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index 4809f04d93..03ee8a5648 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -534,13 +534,19 @@ static void handle_resize_event(int width, int height)
 	old_scaling = x_cvstat.scaling;
 	if(x_cvstat.scaling > 16)
 		x_setscaling(16);
+
 	/*
-	 * We only need to resize if the width/height are not even multiples
+	 * We only need to resize if the width/height are not even multiples,
+	 * or if the two axis don't scale the same way.
 	 * Otherwise, we can simply resend everything
 	 */
-	if((width % (x_cvstat.charwidth * x_cvstat.cols) != 0)
+	if (newFSH != newFSW)
+		resize_window();
+	else if((width % (x_cvstat.charwidth * x_cvstat.cols) != 0)
 			|| (height % (x_cvstat.charheight * x_cvstat.rows) != 0))
 		resize_window();
+	else
+		resize_xim();
 	bitmap_drv_request_pixels();
 }
 
@@ -587,12 +593,12 @@ static int x11_event(XEvent *ev)
 			x11_window_height=ev->xconfigure.height;
 			handle_resize_event(ev->xconfigure.width, ev->xconfigure.height);
 			break;
-        case NoExpose:
-                break;
-        case GraphicsExpose:
+		case NoExpose:
+			break;
+		case GraphicsExpose:
 			expose_rect(ev->xgraphicsexpose.x, ev->xgraphicsexpose.y, ev->xgraphicsexpose.width, ev->xgraphicsexpose.height);
 			break;
-        case Expose:
+		case Expose:
 			expose_rect(ev->xexpose.x, ev->xexpose.y, ev->xexpose.width, ev->xexpose.height);
 			break;
 
-- 
GitLab