From 12e162beab47842562abd7486721f1e698ac65a3 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sun, 14 Apr 2024 09:38:04 -0700 Subject: [PATCH] DeskTop: Fix initial window size for list views Investigating #792 turned up a glitch in computing the bounding box for list views. Rather than calculating the actual width of all lines, a fixed width is used to ensure long dates fit. But this was applied (1) after the bounding box was inflated and (2) by assigning to a right edge rather than as a width. This ensures that when a window is opened in list view (which happens if the parent window is a list view) then the new window's horizontal scrollbars will be inactive. --- RELEASE-NOTES.md | 1 + desktop/main.s | 8 ++++---- res/notes/testplan.md | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 4ee31857..715a3b98 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -21,6 +21,7 @@ Project Page: https://github.com/a2stuff/a2d * Package now includes ProDOS 2.4.3 and BASIC.system 1.7. * Improve appearance of buttons when clicked. c/o @buserror * Fix corruption issues when replacing files with folders and folders with anything during copy. +* Fix initial window size calculation for list views so scrollbar is not shown. ([#792](https://github.com/a2stuff/a2d/issues/792)) ### Launcher * If starting from a folder, brand it as a system folder. diff --git a/desktop/main.s b/desktop/main.s index 94025976..3ef5016f 100644 --- a/desktop/main.s +++ b/desktop/main.s @@ -8114,15 +8114,15 @@ check_icon: ;; If there are any entries... lda cached_window_entry_count IF_NOT_ZERO - ;; Add padding around bbox - MGTK_CALL MGTK::InflateRect, bbox_pad_iconbb_rect - ;; List view? jsr GetCachedWindowViewBy ; N=0 is icon view, N=1 is list view IF_NEG ;; max.x = kListViewWidth - copy16 #kListViewWidth, iconbb_rect::x2 + add16 iconbb_rect::x1, #kListViewWidth, iconbb_rect::x2 END_IF + + ;; Add padding around bbox + MGTK_CALL MGTK::InflateRect, bbox_pad_iconbb_rect END_IF rts diff --git a/res/notes/testplan.md b/res/notes/testplan.md index cd1dc4ac..fbeb92dc 100644 --- a/res/notes/testplan.md +++ b/res/notes/testplan.md @@ -249,6 +249,7 @@ * Launch DeskTop. Open a volume. File > New Folder..., create A. File > New Folder..., create B. Drag B onto A. File > New folder.... Verify DeskTop doesn't hang. * Launch DeskTop. Open a window with files with dates with long month names (e.g. "February 29, 2020"). View > by Name. Resize the window so the lines are cut off on the right. Move the horizontal scrollbar all the way to the right. Verify that the right edges of all lines are visible. +* Launch DeskTop. Open a window containing a folder. View > by Name. Open the folder. Verify that in the new window, the horizontal scrollbar is inactive. * Launch DeskTop. Double-click on a file that DeskTop can't open (and where no BASIS.SYSTEM is present). Click OK in the "This file cannot be opened." alert. Double-click on the file again. Verify that the alert renders with an opaque background.