From a8747478ff6452c8bce106ffc9d889886ab202a8 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 10 Jul 2023 16:24:20 -0700 Subject: bugfix: Windows pushing title bar off screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I'm learning the hard way that resizing the window is a big deal. Only do this when someone explicitly requests it, otherwise follow LÖVE's defaults. Therefore we're also going to stop trying to be smart when showing the log browser. Leave window resizing to manual operations. Now initialization looks a lot more similar for the run and source apps. --- run.lua | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'run.lua') diff --git a/run.lua b/run.lua index 227c34f..59522a5 100644 --- a/run.lua +++ b/run.lua @@ -55,9 +55,8 @@ end function run.load_settings() love.graphics.setFont(love.graphics.newFont(Settings.font_height)) - -- determine default dimensions and flags - App.screen.width, App.screen.height, App.screen.flags = App.screen.size() - -- set up desired window dimensions + -- set up desired window dimensions and make window resizable + _, _, App.screen.flags = App.screen.size() App.screen.flags.resizable = true App.screen.width, App.screen.height = Settings.width, Settings.height App.screen.resize(App.screen.width, App.screen.height, App.screen.flags) @@ -89,19 +88,16 @@ function run.initialize_default_settings() end function run.initialize_window_geometry(em_width) - local os = love.system.getOS() - if os == 'Android' or os == 'iOS' then - -- maximizing on iOS breaks text rendering: https://github.com/deltadaedalus/vudu/issues/7 - -- no point second-guessing window dimensions on mobile - App.screen.width, App.screen.height, App.screen.flags = App.screen.size() - return - end - -- maximize window - App.screen.resize(0, 0) -- maximize + -- Initialize window width/height and make window resizable. + -- + -- I get tempted to have opinions about window dimensions here, but they're + -- non-portable: + -- - maximizing doesn't work on mobile and messes things up + -- - maximizing keeps the title bar on screen in Linux, but off screen on + -- Windows. And there's no way to get the height of the title bar. + -- It seems more robust to just follow LÖVE's default window size until + -- someone overrides it. App.screen.width, App.screen.height, App.screen.flags = App.screen.size() - -- shrink height slightly to account for window decoration - App.screen.height = App.screen.height-100 - App.screen.width = 40*em_width App.screen.flags.resizable = true App.screen.resize(App.screen.width, App.screen.height, App.screen.flags) end -- cgit 1.4.1-2-gfad0