summaryrefslogtreecommitdiffstats
path: root/x11vnc/pm.c
diff options
context:
space:
mode:
authorrunge <runge>2007-02-10 21:52:26 +0000
committerrunge <runge>2007-02-10 21:52:26 +0000
commit90d96b971f04b11fe1902091a94be94697738766 (patch)
tree8331ed14521fd8e7b997465d6f482d521f4537cb /x11vnc/pm.c
parent76720eb71bb18ec452ec1782af9f8b8d09e77efc (diff)
downloadlibvncserver-90d96b971f04b11fe1902091a94be94697738766.zip
libvncserver-90d96b971f04b11fe1902091a94be94697738766.tar.gz
x11vnc: watch textchat, etc in unixpw, implement kbdReleaseAllKeys, setSingleWindow, setServerInput. watch for OpenGL apps breaking XDAMAGE.
Diffstat (limited to 'x11vnc/pm.c')
-rw-r--r--x11vnc/pm.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/x11vnc/pm.c b/x11vnc/pm.c
index cb13ab1..50fb49c 100644
--- a/x11vnc/pm.c
+++ b/x11vnc/pm.c
@@ -3,6 +3,7 @@
#include "cleanup.h"
void check_pm(void);
+void set_dpms_mode(char *mode);
static void check_fbpm(void);
static void check_dpms(void);
@@ -104,6 +105,57 @@ static void check_fbpm(void) {
#endif
}
+void set_dpms_mode(char *mode) {
+#if NO_X11
+ return;
+#else
+ RAWFB_RET_VOID
+#if LIBVNCSERVER_HAVE_DPMS
+ if (dpy && DPMSCapable(dpy)) {
+ CARD16 level;
+ CARD16 want;
+ BOOL enabled;
+ if (!strcmp(mode, "off")) {
+ want = DPMSModeOff;
+ } else if (!strcmp(mode, "on")) {
+ want = DPMSModeOn;
+ } else if (!strcmp(mode, "standby")) {
+ want = DPMSModeStandby;
+ } else if (!strcmp(mode, "suspend")) {
+ want = DPMSModeSuspend;
+ } 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;
+
+ if (level == DPMSModeStandby) {
+ from = "DPMSModeStandby";
+ } else if (level == DPMSModeSuspend) {
+ from = "DPMSModeSuspend";
+ } else if (level == DPMSModeOff) {
+ from = "DPMSModeOff";
+ } else if (level == DPMSModeOn) {
+ from = "DPMSModeOn";
+ }
+
+ rfbLog("switching DPMS state from %s to %s\n", from, mode);
+
+ DPMSForceLevel(dpy, want);
+
+ XSetErrorHandler(old_handler);
+ trapped_xerror = 0;
+ }
+ }
+ }
+#endif
+#endif
+}
+
static void check_dpms(void) {
static int init_dpms = 0;
#if LIBVNCSERVER_HAVE_DPMS
OpenPOWER on IntegriCloud