bugfix: Windows pushing title bar off screen
[?]
Jul 10, 2023, 11:24 PM
W5WCQNMPEJVINPX3ELFMBYUEGNXSPMZIR5KRT2YUZZGSWISZ3R2QCDependencies
- [2]
MLXDXFO6isolate some tests from settings - [3]
APX2PY6Gstop tracking wallclock time - [4]
ORRSP7FVdeduce test names on failures - [5]
5RDWSYK2consistently use App names for methods everywhere - [6]
4J4TX7ISget typed in keystrokes to show on screen on iPad - [7]
QJISOCHJsome temporary logging to catch a bug - [8]
S3PNFXTBhandle missing cursors in settings - [9]
UUTUPEOJextract a function - [10]
CQYKYJJUremember window positions across restart/ctrl+e - [11]
2CK5QI7Wmake love event names consistent - [12]
5SM6DRHKport inscript's bugfix to source editor - [13]
A23MMLJHmigrate old settings, attempt #3 - [14]
PE7QD5GRsource editor: clear logs - [15]
43WA37TUdelete flags that have never been exercised - [16]
4VQGE7RAnew test - [17]
ENENSZLKbugfix: source margins when toggling log browser - [18]
SDO4DHNUsource: load cursor position from settings - [19]
KKMFQDR4editing source code from within the app - [20]
JMUD7T3Oget rid of ugly side-effects in tests - [21]
6SMGKYDR. - [22]
HCFDBUXHfix stale comment
Change contents
- edit in source_tests.lua at line 22
Display_width = App.screen.width - replacement in source_tests.lua at line 36[7.148162]→[7.44:115](∅→∅),[7.191]→[7.191:945](∅→∅),[7.945]→[3.45:81](∅→∅),[3.81]→[7.971:1032](∅→∅),[7.971]→[7.971:1032](∅→∅),[7.1032]→[4.46783:46834](∅→∅),[4.46834]→[7.1147:1184](∅→∅),[7.1147]→[7.1147:1184](∅→∅),[7.1184]→[4.46835:46954](∅→∅),[4.46954]→[7.1431:1469](∅→∅),[7.1431]→[7.1431:1469](∅→∅),[7.1469]→[4.46955:47118](∅→∅),[4.47118]→[7.1760:1852](∅→∅),[7.1760]→[7.1760:1852](∅→∅)
function test_show_log_browser_side_doubles_window_width_if_possible()-- initialize screen dimensions to half widthApp.screen.init{width=300, height=300}Display_width = App.screen.width*2-- initialize source app with left side occupying entire window (half the display)Current_app = 'source'Editor_state = edit.initialize_test_state()Editor_state.filename = 'foo'Editor_state.left = Margin_leftEditor_state.right = App.screen.width - Margin_rightlocal old_editor_right = Editor_state.rightText.redraw_all(Editor_state)Log_browser_state = edit.initialize_test_state()-- log browser has some arbitrary marginsLog_browser_state.left = 200 + Margin_leftLog_browser_state.right = 400Text.redraw_all(Log_browser_state)log_browser.parse(Log_browser_state)-- display log browserCurrent_time = Current_time + 0.1App.run_after_keychord('C-l')-- window width is doubledcheck_eq(App.screen.width, 600, 'display:width')-- left side margins are unchangedcheck_eq(Editor_state.left, Margin_left, 'edit:left')check_eq(Editor_state.right, old_editor_right, 'edit:right')-- log browser margins are adjustedcheck_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'log:left')check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'log:right')endfunction test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width()function test_show_log_browser_side_splits_window_width() - edit in source_tests.lua at line 39
Display_width = 300 - replacement in source.lua at line 124[7.168537]→[7.12:59](∅→∅),[7.59]→[7.169140:169226](∅→∅),[7.197]→[7.169140:169226](∅→∅),[7.169140]→[7.169140:169226](∅→∅)
source.resize_window_from_settings(settings)--? print('loading source position', settings.x, settings.y, settings.displayindex)-- set up desired window dimensions and make window resizable_, _, App.screen.flags = App.screen.size()App.screen.flags.resizable = trueApp.screen.width, App.screen.height = settings.width, settings.heightApp.screen.resize(App.screen.width, App.screen.height, App.screen.flags) - edit in source.lua at line 146
endendfunction source.resize_window_from_settings(settings)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 mobileApp.screen.width, App.screen.height, App.screen.flags = App.screen.size()return - edit in source.lua at line 147
-- maximize window to determine maximum allowable dimensionsApp.screen.resize(0, 0) -- maximizeDisplay_width, Display_height, App.screen.flags = App.screen.size()-- set up desired window dimensionsApp.screen.flags.resizable = trueApp.screen.width, App.screen.height = settings.width, settings.height--? print('setting window from settings:', App.screen.width, App.screen.height)App.screen.resize(App.screen.width, App.screen.height, App.screen.flags) - replacement in source.lua at line 170[7.170462]→[6.337:661](∅→∅),[6.661]→[7.170462:170483](∅→∅),[7.170462]→[7.170462:170483](∅→∅),[7.170483]→[7.198:307](∅→∅),[7.307]→[7.170598:170733](∅→∅),[7.170598]→[7.170598:170733](∅→∅)
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 mobileApp.screen.width, App.screen.height, App.screen.flags = App.screen.size()returnend-- maximize windowApp.screen.resize(0, 0) -- maximizeDisplay_width, Display_height, App.screen.flags = App.screen.size()-- shrink height slightly to account for window decorationApp.screen.height = Display_height-100App.screen.width = 40*em_width-- 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() - edit in source.lua at line 363
App.screen.width = math.min(Display_width, App.screen.width*2) - edit in source.lua at line 364
Editor_state.width = Editor_state.right-Editor_state.leftText.redraw_all(Editor_state) - replacement in source.lua at line 369
App.screen.width = Editor_state.right + Margin_rightEditor_state.right = App.screen.width - Margin_rightEditor_state.width = Editor_state.right-Editor_state.leftText.redraw_all(Editor_state) - edit in source.lua at line 373[7.176529]→[7.176529:176599](∅→∅),[7.176599]→[7.574:651](∅→∅),[7.651]→[7.176678:176830](∅→∅),[7.176678]→[7.176678:176830](∅→∅),[7.176830]→[2.12:114](∅→∅)
--? print('setting window:', App.screen.width, App.screen.height)App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)--? print('done setting window')-- try to restore position if possible-- if the window gets wider the window manager may not respect thisif not App.run_tests thensource.set_window_position_from_settings(Settings.source)end - replacement in run.lua at line 58[7.179444]→[7.16:60](∅→∅),[7.60]→[5.169:245](∅→∅),[5.245]→[7.179587:179625](∅→∅),[7.179587]→[7.179587:179625](∅→∅)
-- determine default dimensions and flagsApp.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() - replacement in run.lua at line 91[7.180832]→[6.666:990](∅→∅),[6.990]→[7.180832:180853](∅→∅),[7.180832]→[7.180832:180853](∅→∅),[7.180853]→[5.387:426](∅→∅)
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 mobileApp.screen.width, App.screen.height, App.screen.flags = App.screen.size()returnend-- maximize windowApp.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. - edit in run.lua at line 101
-- shrink height slightly to account for window decorationApp.screen.height = App.screen.height-100App.screen.width = 40*em_width