From 9b7e7becc526c53e7de946e99f0095f1e12bc4e2 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Thu, 12 Feb 2026 20:21:26 -0500 Subject: [PATCH] Fix cursor offset when tiling WM resizes window on first tick --- playscii.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/playscii.py b/playscii.py index e43dbc5..a0d698a 100755 --- a/playscii.py +++ b/playscii.py @@ -915,6 +915,15 @@ class Application: self.gw.post_update() self.last_time += self.timestep self.updates += 1 + # On the first update, check if a window manager resized us during + # init (e.g. tiling WMs). The SDL_WINDOWEVENT_RESIZED handler skips + # tick 0 to avoid a spurious resize from resolution detection, so + # any real WM resize on that tick gets dropped. + if self.updates == 1: + w, h = ctypes.c_int(0), ctypes.c_int(0) + sdl2.SDL_GetWindowSize(self.window, ctypes.byref(w), ctypes.byref(h)) + if w.value != self.window_width or h.value != self.window_height: + self.resize_window(w.value, h.value) self.frame_update() def frame_update(self):