diff --git a/src/package.lisp b/src/package.lisp index 9f5b028..e4ac560 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -2081,6 +2081,8 @@ :calculate :draw :aabb + :child-window-exists-p + :remove-child-window :remove-intersecting-window :draw-all :refresh-config-all diff --git a/src/program-events.lisp b/src/program-events.lisp index e6fe7f9..f2a21a8 100644 --- a/src/program-events.lisp +++ b/src/program-events.lisp @@ -429,10 +429,9 @@ (defmethod process-event ((object remove-notify-user-event)) (let ((win (payload object))) - (when (mtree:find-child-if specials:*main-window* - (lambda (node) (eq node win))) + (when (windows:child-window-exists-p specials:*main-window* win) (windows:win-close win) - (mtree:remove-child specials:*main-window* win)))) + (windows:remove-child-window specials:*main-window* win)))) (defclass change-window-title-event (program-event) ((window diff --git a/src/windows.lisp b/src/windows.lisp index 6ac5bd3..2148f56 100644 --- a/src/windows.lisp +++ b/src/windows.lisp @@ -283,6 +283,10 @@ height, position and so on)" (defgeneric aabb (object)) +(defgeneric child-window-exists-p (object child-window)) + +(defgeneric remove-child-window (object child-window)) + (defmethod refresh-config (object) object) @@ -357,6 +361,13 @@ height, position and so on)" (h (win-height object))) (2d-utils:make-iaabb2 x y (1- (+ x w)) (1- (+ y h))))) +(defmethod child-window-exists-p ((object wrapper-window) child-window) + (mtree:find-child-if object + (lambda (node) (eq node child-window)))) + +(defmethod remove-child-window ((object wrapper-window) child-window) + (mtree:remove-child object child-window)) + (defun remove-intersecting-window (&key (discarded-window-type '())) (labels ((copy-subwindows-stack () (let ((copy '()))