From 201849769e15b05b649531d579521b051dec71e4 Mon Sep 17 00:00:00 2001 From: Heiko Behrens Date: Tue, 25 Jun 2013 11:09:24 +0200 Subject: [PATCH] fix: when switching desktops with spaces, check if window is obscured delayed (fixes #19) --- CamHolderApp/CHApplicationDelegate.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CamHolderApp/CHApplicationDelegate.m b/CamHolderApp/CHApplicationDelegate.m index a33217f..7272adb 100644 --- a/CamHolderApp/CHApplicationDelegate.m +++ b/CamHolderApp/CHApplicationDelegate.m @@ -217,8 +217,10 @@ -(void)applicationDidResignActive:(NSNotification *)notification { [self periodicallyTryToReduceRunningCaptureSessionsWhileApplicationIsNotActive]; } --(void)applicationDidBecomeActive:(NSNotification *)notification { - [self tryToReduceRunningCaptureSessions]; +- (void)applicationDidBecomeActive:(NSNotification *)aNotification { + // when using spaces, windows might still be obscured during transition. Hence, wait a bit + // NOTE: is there any callback to determine when exactly? + [self performSelector:@selector(tryToReduceRunningCaptureSessions) withObject:0 afterDelay:0.5]; } -(BOOL)shouldPeriodicallyTryToReduceRunningCaptureSessions {