Fix cursor offset when tiling WM resizes window on first tick
This commit is contained in:
parent
d608909b5d
commit
c0621ff717
1 changed files with 9 additions and 0 deletions
|
|
@ -915,6 +915,15 @@ class Application:
|
||||||
self.gw.post_update()
|
self.gw.post_update()
|
||||||
self.last_time += self.timestep
|
self.last_time += self.timestep
|
||||||
self.updates += 1
|
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()
|
self.frame_update()
|
||||||
|
|
||||||
def frame_update(self):
|
def frame_update(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue