From b42f08cb791dcd1c2dc1c6dc442d375a89976e75 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 10 Jul 2023 16:08:18 -0700 Subject: [PATCH] bugfix: preserve window position I just noticed we hadn't got this bugfix for Linux on the main app. How had we not noticed this issue before? Answer: lines.love windows tend to be tall and skinny, and resize must keep the window entirely within the screen. So the window was staying in place just because it happened to be running up against the bottom. --- run.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/run.lua b/run.lua index f0482e0..378279c 100644 --- a/run.lua +++ b/run.lua @@ -63,13 +63,23 @@ function run.load_settings() App.screen.flags.minheight = math.min(App.screen.height, 200) App.screen.width, App.screen.height = Settings.width, Settings.height App.screen.resize(App.screen.width, App.screen.height, App.screen.flags) - App.screen.move(Settings.x, Settings.y, Settings.displayindex) + run.set_window_position_from_settings(Settings) Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, Settings.font_height, math.floor(Settings.font_height*1.3)) Editor_state.filename = Settings.filename Editor_state.screen_top1 = Settings.screen_top Editor_state.cursor1 = Settings.cursor end +function run.set_window_position_from_settings(settings) + local os = love.system.getOS() + if os == 'Linux' then + -- love.window.setPosition doesn't quite seem to do what is asked of it on Linux. + App.screen.move(settings.x, settings.y-37, settings.displayindex) + else + App.screen.move(settings.x, settings.y, settings.displayindex) + end +end + function run.initialize_default_settings() local font_height = 20 love.graphics.setFont(love.graphics.newFont(font_height))