about summary refs log tree commit diff stats
path: root/run.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-07-10 16:24:20 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-07-10 17:09:09 -0700
commita8747478ff6452c8bce106ffc9d889886ab202a8 (patch)
tree6db8fe89a6274985436b97840f89c1a48342cb84 /run.lua
parent3f52063d026dcdaa299020573761266ab9a8618f (diff)
downloadtext.love-a8747478ff6452c8bce106ffc9d889886ab202a8.tar.gz
bugfix: Windows pushing title bar off screen
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.
Diffstat (limited to 'run.lua')
-rw-r--r--run.lua26
1 files changed, 11 insertions, 15 deletions
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