@@ -43,7 +43,7 @@ final class IDEWorkspaceWindowOverlayWindowController {
4343 self . application = application
4444 let contentProviders = contentProviderFactory ( inspector, application)
4545 self . contentProviders = contentProviders
46- self . windowElement = inspector. uiElement
46+ windowElement = inspector. uiElement
4747
4848 let panel = OverlayPanel (
4949 contentRect: . init( x: 0 , y: 0 , width: 200 , height: 200 )
@@ -83,6 +83,8 @@ final class IDEWorkspaceWindowOverlayWindowController {
8383 if windowElement. parent == nil {
8484 windowElement = inspector. uiElement
8585 observeWindowChange ( )
86+ } else {
87+ updateFrame ( )
8688 }
8789 }
8890
@@ -104,27 +106,35 @@ final class IDEWorkspaceWindowOverlayWindowController {
104106
105107 private func observeWindowChange( ) {
106108 axNotificationTask? . cancel ( )
107-
109+
108110 let stream = AXNotificationStream (
109111 app: application,
110112 element: windowElement,
111- notificationNames: kAXMovedNotification, kAXResizedNotification
113+ notificationNames:
114+ kAXMovedNotification,
115+ kAXResizedNotification,
116+ kAXWindowMiniaturizedNotification,
117+ kAXWindowDeminiaturizedNotification
112118 )
113119
114120 axNotificationTask = Task { [ weak self] in
115121 for await notification in stream {
116- guard let panel = self ? . maskPanel else { return }
122+ guard let self else { return }
117123 if Task . isCancelled { return }
118124 switch notification. name {
119125 case kAXMovedNotification, kAXResizedNotification:
120- if let rect = self ? . windowElement . rect {
121- panel . setTopLeftCoordinateFrame ( rect , display : true )
122- }
126+ self . updateFrame ( )
127+ case kAXWindowMiniaturizedNotification :
128+ self . hide ( )
123129 default : continue
124130 }
125131 }
126132 }
127133
134+ updateFrame ( )
135+ }
136+
137+ private func updateFrame( ) {
128138 if let rect = windowElement. rect {
129139 maskPanel. setTopLeftCoordinateFrame ( rect, display: false )
130140 }
0 commit comments