From 5569be357995a5f66f28bcddc5894599a61160a1 Mon Sep 17 00:00:00 2001 From: pancelor Date: Tue, 27 Jun 2023 02:10:26 -0700 Subject: [PATCH 1/2] fix multiple monitor bug taken from the example at https://love2d.org/wiki/love.window.getDesktopDimensions --- push.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/push.lua b/push.lua index b22f698..5509315 100644 --- a/push.lua +++ b/push.lua @@ -248,16 +248,17 @@ end function push:switchFullscreen(winw, winh) self._fullscreen = not self._fullscreen - local windowWidth, windowHeight = love.window.getDesktopDimensions() + local _, _, flags = love.window.getMode() + local desktopWidth, desktopHeight = love.window.getDesktopDimensions(flags.display) if self._fullscreen then --save windowed dimensions for later self._WINWIDTH, self._WINHEIGHT = self._RWIDTH, self._RHEIGHT elseif not self._WINWIDTH or not self._WINHEIGHT then - self._WINWIDTH, self._WINHEIGHT = windowWidth * .5, windowHeight * .5 + self._WINWIDTH, self._WINHEIGHT = desktopWidth * .5, desktopHeight * .5 end - self._RWIDTH = self._fullscreen and windowWidth or winw or self._WINWIDTH - self._RHEIGHT = self._fullscreen and windowHeight or winh or self._WINHEIGHT + self._RWIDTH = self._fullscreen and desktopWidth or winw or self._WINWIDTH + self._RHEIGHT = self._fullscreen and desktopHeight or winh or self._WINHEIGHT self:initValues() From fae29677184f9e471d3b9776134b1d2c4596d39e Mon Sep 17 00:00:00 2001 From: pancelor Date: Tue, 27 Jun 2023 02:12:23 -0700 Subject: [PATCH 2/2] fix window not resizing when leaving fullscreen when I go fullscreen and click-and-drag downwards from the top of my screen, the game's size stays large when leaving fullscreen mode. (bizarre) this fixes that, by checking what the screen dimensions actually are after leaving fullscreen. I also managed to somehow trigger the bug by pressing F around 6 times --- push.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/push.lua b/push.lua index 5509315..7f9c79b 100644 --- a/push.lua +++ b/push.lua @@ -263,7 +263,9 @@ function push:switchFullscreen(winw, winh) self:initValues() love.window.setFullscreen(self._fullscreen, "desktop") - if not self._fullscreen and (winw or winh) then + + local windowWidth, windowHeight = love.window.getMode() + if not self._fullscreen and (windowWidth~=self._RWIDTH or windowHeight~=self._RHEIGHT) then windowUpdateMode(self._RWIDTH, self._RHEIGHT) --set window dimensions end end