Revision: 5647
http://skim-app.svn.sourceforge.net/skim-app/?rev=5647&view=rev
Author: hofman
Date: 2009-09-03 21:50:05 +0000 (Thu, 03 Sep 2009)
Log Message:
-----------
Use IOKit power management functions to prevent sleep
Modified Paths:
--------------
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2009-09-03 21:20:23 UTC (rev 5646)
+++ trunk/SKMainWindowController.h 2009-09-03 21:50:05 UTC (rev 5647)
@@ -37,6 +37,7 @@
*/
#import <Cocoa/Cocoa.h>
+#import <IOKit/pwr_mgt/IOPMLib.h>
enum {
SKThumbnailSidePaneState,
@@ -206,7 +207,7 @@
NSMutableArray *lastViewedPages;
- NSTimer *activityTimer;
+ IOPMAssertionID activityAssertionID;
NSMutableDictionary *savedNormalSetup;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2009-09-03 21:20:23 UTC (rev 5646)
+++ trunk/SKMainWindowController.m 2009-09-03 21:50:05 UTC (rev 5647)
@@ -236,6 +236,7 @@
mwcFlags.updatingFont = 0;
mwcFlags.updatingLine = 0;
mwcFlags.usesDrawers = [[NSUserDefaults standardUserDefaults]
boolForKey:SKUsesDrawersKey];
+ activityAssertionID = 0;
}
return self;
@@ -1453,10 +1454,6 @@
[savedNormalSetup setObject:[NSNumber numberWithBool:[scrollView
autohidesScrollers]] forKey:AUTOHIDESSCROLLERS_KEY];
}
-- (void)activityTimerFired:(NSTimer *)timer {
- UpdateSystemActivity(1); // UsrActivity = 1, but that's not defined for 64
bits
-}
-
- (void)enterPresentationMode {
NSScrollView *scrollView = [[pdfView documentView] enclosingScrollView];
if ([self isFullScreen] == NO)
@@ -1484,16 +1481,16 @@
if (notesPdfView)
[notesPdfView goToPage:[[notesPdfView document] pageAtIndex:[[pdfView
currentPage] pageIndex]]];
- // periodically send a 'user activity' to prevent sleep mode and
screensaver from being activated
- activityTimer = [[NSTimer scheduledTimerWithTimeInterval:30 target:self
selector:@selector(activityTimerFired:) userInfo:NULL repeats:YES] retain];
+ // prevent sleep
+ if (activityAssertionID == 0 && kIOReturnSuccess !=
IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
kIOPMAssertionLevelOn, CFSTR("Skim Presentation"), &activityAssertionID))
+ activityAssertionID = 0;
mwcFlags.isPresentation = 1;
}
- (void)exitPresentationMode {
- [activityTimer invalidate];
- [activityTimer release];
- activityTimer = nil;
+ if (activityAssertionID != 0)
+ IOPMAssertionRelease(activityAssertionID);
NSScrollView *scrollView = [[pdfView documentView] enclosingScrollView];
[self applyPDFSettings:savedNormalSetup];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit