summaryrefslogtreecommitdiffstats
path: root/x11vnc/pm.c
diff options
context:
space:
mode:
authorrunge <runge>2007-02-12 02:42:28 +0000
committerrunge <runge>2007-02-12 02:42:28 +0000
commit0016cd4280ee9a0d088454a508a9c7f6bde33f62 (patch)
tree41614a1dfbd8bba02f35a588e8cc87d4e7692173 /x11vnc/pm.c
parent90d96b971f04b11fe1902091a94be94697738766 (diff)
downloadlibtdevnc-0016cd4280ee9a0d088454a508a9c7f6bde33f62.tar.gz
libtdevnc-0016cd4280ee9a0d088454a508a9c7f6bde33f62.zip
x11vnc: -grabalways, -forcedpms, -clientdpms, -noserverdpms, -loopbg, -svc, -xdmsvc
Diffstat (limited to 'x11vnc/pm.c')
-rw-r--r--x11vnc/pm.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/x11vnc/pm.c b/x11vnc/pm.c
index 50fb49c..b730c1f 100644
--- a/x11vnc/pm.c
+++ b/x11vnc/pm.c
@@ -123,16 +123,22 @@ void set_dpms_mode(char *mode) {
want = DPMSModeStandby;
} else if (!strcmp(mode, "suspend")) {
want = DPMSModeSuspend;
+ } else if (!strcmp(mode, "enable")) {
+ DPMSEnable(dpy);
+ return;
+ } else if (!strcmp(mode, "disable")) {
+ DPMSDisable(dpy);
+ return;
} else {
return;
}
if (DPMSInfo(dpy, &level, &enabled)) {
char *from;
- fprintf(stderr, "DPMSInfo level: %d enabled: %d\n", level, enabled);
if (enabled && level != want) {
XErrorHandler old_handler = XSetErrorHandler(trap_xerror);
trapped_xerror = 0;
+ rfbLog("DPMSInfo level: %d enabled: %d\n", level, enabled);
if (level == DPMSModeStandby) {
from = "DPMSModeStandby";
} else if (level == DPMSModeSuspend) {
@@ -188,6 +194,14 @@ static void check_dpms(void) {
init_dpms = 1;
}
+ if (force_dpms || (client_dpms && client_count)) {
+ static int last_enable = 0;
+ if (time(NULL) > last_enable) {
+ set_dpms_mode("enable");
+ last_enable = time(NULL);
+ }
+ set_dpms_mode("off");
+ }
if (! watch_dpms) {
return;
}