X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=OSX%2FXScreenSaverView.m;h=55c5516b99c9a36d1ca72f2565beb94e2c20d8b5;hp=8c6b5ea4762321c225db7e2f49dc23ef8058d323;hb=c70f94f648d51bb4828193124f325fa52b0e57f3;hpb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe diff --git a/OSX/XScreenSaverView.m b/OSX/XScreenSaverView.m index 8c6b5ea4..55c5516b 100644 --- a/OSX/XScreenSaverView.m +++ b/OSX/XScreenSaverView.m @@ -400,10 +400,12 @@ double_time (void) */ - (void) allSystemsGo: (NSTimer *) timer { - NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; - [prefs setBool:YES forKey:@"wasRunning"]; NSAssert (timer == crash_timer, @"crash timer screwed up"); crash_timer = 0; + + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + [prefs setBool:YES forKey:@"wasRunning"]; + [prefs synchronize]; } #endif // USE_IPHONE @@ -421,6 +423,11 @@ double_time (void) # ifdef USE_IPHONE if (crash_timer) [crash_timer invalidate]; + + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + [prefs removeObjectForKey:@"wasRunning"]; + [prefs synchronize]; + crash_timer = [NSTimer scheduledTimerWithTimeInterval: 5 target:self selector:@selector(allSystemsGo:) @@ -467,6 +474,7 @@ double_time (void) crash_timer = 0; NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; [prefs removeObjectForKey:@"wasRunning"]; + [prefs synchronize]; # endif // USE_IPHONE [super stopAnimation]; @@ -1245,29 +1253,34 @@ double current_device_rotation (void) if (rotation_ratio >= 0) return; // in the midst of rotation animation if (orientation == current) return; // no change + // When transitioning to FaceUp or FaceDown, pretend there was no change. + if (current == UIDeviceOrientationFaceUp || + current == UIDeviceOrientationFaceDown) + return; + new_orientation = current; // current animation target rotation_ratio = 0; // start animating rot_start_time = double_time(); switch (orientation) { - case UIInterfaceOrientationLandscapeRight: angle_from = 90; break; - case UIInterfaceOrientationLandscapeLeft: angle_from = 270; break; - case UIInterfaceOrientationPortraitUpsideDown: angle_from = 180; break; - default: angle_from = 0; break; + case UIDeviceOrientationLandscapeLeft: angle_from = 90; break; + case UIDeviceOrientationLandscapeRight: angle_from = 270; break; + case UIDeviceOrientationPortraitUpsideDown: angle_from = 180; break; + default: angle_from = 0; break; } switch (new_orientation) { - case UIInterfaceOrientationLandscapeRight: angle_to = 90; break; - case UIInterfaceOrientationLandscapeLeft: angle_to = 270; break; - case UIInterfaceOrientationPortraitUpsideDown: angle_to = 180; break; - default: angle_to = 0; break; + case UIDeviceOrientationLandscapeLeft: angle_to = 90; break; + case UIDeviceOrientationLandscapeRight: angle_to = 270; break; + case UIDeviceOrientationPortraitUpsideDown: angle_to = 180; break; + default: angle_to = 0; break; } NSRect ff = [self frame]; switch (orientation) { - case UIInterfaceOrientationLandscapeLeft: // from landscape - case UIInterfaceOrientationLandscapeRight: + case UIDeviceOrientationLandscapeRight: // from landscape + case UIDeviceOrientationLandscapeLeft: rot_from.width = ff.size.height; rot_from.height = ff.size.width; break; @@ -1278,8 +1291,8 @@ double current_device_rotation (void) } switch (new_orientation) { - case UIInterfaceOrientationLandscapeLeft: // to landscape - case UIInterfaceOrientationLandscapeRight: + case UIDeviceOrientationLandscapeRight: // to landscape + case UIDeviceOrientationLandscapeLeft: rot_to.width = ff.size.height; rot_to.height = ff.size.width; break;