Skip to content

Commit

Permalink
add a probably unnecessary dynamic-wind
Browse files Browse the repository at this point in the history
  • Loading branch information
rfindler committed Jan 26, 2024
1 parent f7be366 commit 93bf26f
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions gui-lib/framework/private/color-prefs.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1038,22 +1038,27 @@
(if new-wob
(white-on-black)
(black-on-white)))
(define style-lists-begun
(for*/list ([(color-name fns+sls) (in-hash color-change-callbacks)]
[fn+sl (in-list fns+sls)])
(define sl/b (cdr fn+sl))
(define sl (if (weak-box? sl/b)
(weak-box-value sl/b)
sl/b))
(and sl (send sl begin-style-change-sequence) sl)))
(for ([(color-name fns+sls) (in-hash color-change-callbacks)])
(for ([fn/b (in-list (map car fns+sls))])
(define fn (if (weak-box? fn/b) (weak-box-value fn/b) fn/b))
(when fn
(fn (lookup-in-color-scheme color-name)))))
(for ([style-list (in-list style-lists-begun)])
(when style-list
(send style-list end-style-change-sequence)))))
(define style-lists-begun '())
(dynamic-wind
(λ ()
(set! style-lists-begun
(for*/list ([(color-name fns+sls) (in-hash color-change-callbacks)]
[fn+sl (in-list fns+sls)])
(define sl/b (cdr fn+sl))
(define sl (if (weak-box? sl/b)
(weak-box-value sl/b)
sl/b))
(and sl (send sl begin-style-change-sequence) sl))))
(λ ()
(for ([(color-name fns+sls) (in-hash color-change-callbacks)])
(for ([fn/b (in-list (map car fns+sls))])
(define fn (if (weak-box? fn/b) (weak-box-value fn/b) fn/b))
(when fn
(fn (lookup-in-color-scheme color-name))))))
(λ ()
(for ([style-list (in-list style-lists-begun)])
(when style-list
(send style-list end-style-change-sequence)))))))

(define (get-available-color-schemes)
(for/list ([(name a-color-scheme) (in-hash known-color-schemes)])
Expand Down

0 comments on commit 93bf26f

Please sign in to comment.