diff options
author | marha <marha@users.sourceforge.net> | 2010-12-07 15:49:06 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-12-07 15:49:06 +0000 |
commit | 25b9dbb15f0dc98cfc6b5585e7efebf3250f64d3 (patch) | |
tree | 93007a6f77999699b0077f448c08b3d505662f55 /xorg-server/hw/xquartz/quartz.c | |
parent | c82036153f9273a6041426fb98e69fff0806680e (diff) | |
download | vcxsrv-25b9dbb15f0dc98cfc6b5585e7efebf3250f64d3.tar.gz vcxsrv-25b9dbb15f0dc98cfc6b5585e7efebf3250f64d3.tar.bz2 vcxsrv-25b9dbb15f0dc98cfc6b5585e7efebf3250f64d3.zip |
xserver pixman git update 7-12-2010
Diffstat (limited to 'xorg-server/hw/xquartz/quartz.c')
-rw-r--r-- | xorg-server/hw/xquartz/quartz.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c index 7a92755c7..aed063489 100644 --- a/xorg-server/hw/xquartz/quartz.c +++ b/xorg-server/hw/xquartz/quartz.c @@ -62,6 +62,7 @@ #include <sys/stat.h>
#include <fcntl.h>
#include <IOKit/pwr_mgt/IOPMLib.h>
+#include <pthread.h>
#include <rootlessCommon.h>
#include <Xplugin.h>
@@ -246,6 +247,40 @@ void QuartzUpdateScreens(void) { quartzProcs->UpdateScreen(pScreen);
}
+static void pokeActivityCallback(CFRunLoopTimerRef timer, void *info) {
+ UpdateSystemActivity(OverallAct);
+}
+
+static void QuartzScreenSaver(int state) {
+ static CFRunLoopTimerRef pokeActivityTimer = NULL;
+ static CFRunLoopTimerContext pokeActivityContext = { 0, NULL, NULL, NULL, NULL };
+ static pthread_mutex_t pokeActivityMutex = PTHREAD_MUTEX_INITIALIZER;
+
+ pthread_mutex_lock(&pokeActivityMutex);
+
+ if(state) {
+ if(pokeActivityTimer == NULL)
+ goto QuartzScreenSaverEnd;
+
+ CFRunLoopTimerInvalidate(pokeActivityTimer);
+ CFRelease(pokeActivityTimer);
+ pokeActivityTimer = NULL;
+ } else {
+ if(pokeActivityTimer != NULL)
+ goto QuartzScreenSaverEnd;
+
+ pokeActivityTimer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 30, 0, 0, pokeActivityCallback, &pokeActivityContext);
+ if(pokeActivityTimer == NULL) {
+ ErrorF("Unable to create pokeActivityTimer.\n");
+ goto QuartzScreenSaverEnd;
+ }
+
+ CFRunLoopAddTimer(CFRunLoopGetMain(), pokeActivityTimer, kCFRunLoopCommonModes);
+ }
+QuartzScreenSaverEnd:
+ pthread_mutex_unlock(&pokeActivityMutex);
+}
+
void QuartzShowFullscreen(int state) {
int i;
@@ -256,6 +291,8 @@ void QuartzShowFullscreen(int state) { return;
}
+ QuartzScreenSaver(!state);
+
if(XQuartzFullscreenVisible == state)
return;
|