@@ -16,7 +16,7 @@ class VideoWindow: NSWindow, NSWindowDelegate {
1616 var isInFullscreen : Bool = false
1717 var isAnimating : Bool = false
1818 var isMoving : Bool = false
19- // let animationLock = NSCondition()
19+ let animationLock = NSCondition ( )
2020
2121 override var canBecomeKey : Bool { return true }
2222 override var canBecomeMain : Bool { return true }
@@ -143,8 +143,7 @@ class VideoWindow: NSWindow, NSWindowDelegate {
143143 self.cocoaCB.layer.isAsynchronous = false
144144 }*/
145145
146- isAnimating = false
147- //unlockAnimation()
146+ unlockAnimation ( )
148147 }
149148
150149 func windowDidExitFullScreen( _ notification: Notification ) {
@@ -156,49 +155,42 @@ class VideoWindow: NSWindow, NSWindowDelegate {
156155 }*/
157156
158157 contentAspectRatio = unfsContentFrame!. size
159- isAnimating = false
160- //unlockAnimation()
158+ unlockAnimation ( )
161159 }
162160
163161 func windowDidFailToEnterFullScreen( _ window: NSWindow ) {
164162 let newFrame = calculateWindowPosition ( for: targetScreen!, withoutBounds: targetScreen == screen)
165163 setFrame ( newFrame, display: true )
166164 contentAspectRatio = unfsContentFrame!. size
167- isAnimating = false
168- //unlockAnimation()
165+ unlockAnimation ( )
169166 }
170167
171168 func windowDidFailToExitFullScreen( _ window: NSWindow ) {
172169 let newFrame = targetScreen!. frame
173170 setFrame ( newFrame, display: true )
174- isAnimating = false
175- //unlockAnimation()
171+ unlockAnimation ( )
176172 }
177173
178- /*func unlockAnimation() {
179- /*Swift.print("unlockAnimation start")
180- animationLock.lock()*/
174+ func unlockAnimation( ) {
175+ animationLock. lock ( )
181176 isAnimating = false
182- /* animationLock.signal()
177+ animationLock. signal ( )
183178 animationLock. unlock ( )
184- Swift.print("unlockAnimation end")*/
185- }*/
179+ }
186180
187- /*func waitForAnimation() {
188- Swift.print("waitForAnimation start")
181+ func waitForAnimation( ) {
189182 animationLock. lock ( )
190183 while isAnimating {
191- Swift.print("waitForAnimation wait")
192184 animationLock. wait ( )
193185 }
186+ close ( )
194187 animationLock. unlock ( )
195- Swift.print("waitForAnimation end")
196- }*/
188+ }
197189
198190 func setToFullScreen( ) {
199191 NSApp . presentationOptions = [ . autoHideMenuBar, . autoHideDock]
200192 setFrame ( targetScreen!. frame, display: true )
201- isAnimating = false
193+ unlockAnimation ( )
202194 isInFullscreen = true
203195 cocoaCB. flagEvents ( VO_EVENT_FULLSCREEN_STATE)
204196 }
@@ -208,7 +200,7 @@ class VideoWindow: NSWindow, NSWindowDelegate {
208200 NSApp . presentationOptions = [ ]
209201 setFrame ( newFrame, display: true )
210202 contentAspectRatio = unfsContentFrame!. size
211- isAnimating = false
203+ unlockAnimation ( )
212204 isInFullscreen = false
213205 cocoaCB. flagEvents ( VO_EVENT_FULLSCREEN_STATE)
214206 }
0 commit comments