Skip to content

Commit

Permalink
Tree: implement replace-frame for non-tree frames
Browse files Browse the repository at this point in the history
+ Export the method so it can be used elsewhere.
  • Loading branch information
sdilts committed Nov 6, 2024
1 parent a74dee1 commit 1f2babb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lisp/tree/frame.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ REMOVE-FUNC is called with one argument: the view that was removed."
(declare (type frame tree))
(remove-frame-from-parent tree frame cleanup-func)))

(defmethod replace-frame ((root frame) frame &optional (cleanup-func #'identity))
(unless (eql root frame)
(funcall cleanup-func frame)
(%replace-frame frame frame)))

(defmethod replace-frame ((root tree-frame) frame &optional (cleanup-func #'identity))
(let ((stack (tree-children root)))
(iter (for child = (pop stack))
Expand Down
1 change: 1 addition & 0 deletions lisp/tree/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#:find-first-leaf
#:mark-frame-focused
#:unmark-frame-focused
#:replace-frame
;; View-frame functions / objects
#:view-frame
#:frame-view
Expand Down

0 comments on commit 1f2babb

Please sign in to comment.