Skip to content

Commit

Permalink
DeskTop: Untangle menu state update for windows and shortcuts
Browse files Browse the repository at this point in the history
* Update DeskTop's main loop to not check window validity and update
  menu item states on just a mouse move, since that can't change the
  application state. This allows the following changes without
  compromising performance.
* Back to the MouseDesk code, DeskTop had logic to conditionally
  refresh the "Selector" (now "Shortcut") menu item enable/disable
  states when the contents were modified, with a global flag. Since
  overall logic and performance has improved, just do this
  unconditionally.
* Update menu item states that require a window (e.g. "Close") and the
  View menu checkbox in the main loop, rather than requiring all
  places that might modify the state (e.g. window open, window close,
  view menu action) to make the right calls.

... and consolidate all of the updating logic into one proc, to ease
maintenance. The simplification saves ~100 bytes.

No functional changes - I hope!
  • Loading branch information
inexorabletash committed Jan 19, 2025
1 parent 3d5804d commit 567c04b
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 299 deletions.
2 changes: 1 addition & 1 deletion desktop/desktop.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
DEFSEG SegmentLoader, $2000, $0200
DEFSEG SegmentDeskTopAux, $4000, $8000
DEFSEG SegmentDeskTopLC, $D000, $2100
DEFSEG SegmentDeskTopMain, $4000, $7900
DEFSEG SegmentDeskTopMain, $4000, $7800
DEFSEG SegmentInitializer, $0800, $0900
DEFSEG SegmentInvoker, $0290, $0160

Expand Down
9 changes: 1 addition & 8 deletions desktop/init.s
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,6 @@ done:
adc selector_list_data_buf + kSelectorListNumSecondaryRunListOffset
sta num_selector_list_items

copy #0, selector_menu_items_updated_flag

lda selector_list_data_buf
sta count
L0A3B: lda index
Expand Down Expand Up @@ -997,12 +995,7 @@ unit_num:
;; Final MGTK configuration
MGTK_CALL MGTK::CheckEvents
MGTK_CALL MGTK::SetCursor, MGTK::SystemCursor::pointer
lda #0
sta active_window_id
jsr main::UpdateWindowMenuItems
jsr main::DisableMenuItemsRequiringVolumeSelection
jsr main::DisableMenuItemsRequiringFileSelection
jsr main::DisableMenuItemsRequiringSelection
copy #0, active_window_id

;; Add desktop icons
ldx #0
Expand Down
Loading

0 comments on commit 567c04b

Please sign in to comment.