about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-30 22:58:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-30 23:02:24 -0700
commit37c5ab87ece90f9f64b3726fcfdf20240aa7d55f (patch)
tree1d616aab31cc1f1579dd671d6d440deaf7398543
parent429a42eb1c5b771fbc95aee7d58acdbedadb8e71 (diff)
downloadview.love-37c5ab87ece90f9f64b3726fcfdf20240aa7d55f.tar.gz
bugfix: enable resize when loading settings
-rw-r--r--main.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index ca8b725..e822ce4 100644
--- a/main.lua
+++ b/main.lua
@@ -147,10 +147,18 @@ function App.initialize(arg)
 end
 
 function load_settings()
+  -- maximize window to determine maximum allowable dimensions
+  love.window.setMode(0, 0)  -- maximize
+  App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
+  --
   local settings = json.decode(love.filesystem.read('config'))
   love.window.setPosition(settings.x, settings.y, settings.displayindex)
+  App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
+  App.screen.flags.resizable = true
+  App.screen.flags.minwidth = math.min(App.screen.width, 200)
+  App.screen.flags.minheight = math.min(App.screen.width, 200)
   App.screen.width, App.screen.height = settings.width, settings.height
-  love.window.setMode(App.screen.width, App.screen.height)
+  love.window.setMode(App.screen.width, App.screen.height, App.screen.flags)
   Filename = settings.filename
   initialize_font_settings(settings.font_height)
   Screen_top1 = settings.screen_top
@@ -172,7 +180,7 @@ function initialize_window_geometry()
   App.screen.flags.resizable = true
   App.screen.flags.minwidth = math.min(App.screen.width, 200)
   App.screen.flags.minheight = math.min(App.screen.width, 200)
-  love.window.updateMode(App.screen.width, App.screen.height, App.screen.flags)
+  love.window.setMode(App.screen.width, App.screen.height, App.screen.flags)
 end
 
 function App.resize(w, h)