summaryrefslogtreecommitdiff
path: root/plugins/power/gpm-common.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-05 21:29:12 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-06 14:27:16 +0200
commitaef54ea441d5c6d27d63dee10c5cd98227d2597c (patch)
tree2b77cc5753107532ed606179713fb8f79cda8484 /plugins/power/gpm-common.c
parentcca624755d90ea294c0f9753b2e1a6de75f85eeb (diff)
downloadgnome-settings-daemon-aef54ea441d5c6d27d63dee10c5cd98227d2597c.tar.gz
power: Stop X from turning our screen off
The default timeouts for DPMS in Xorg were finally applied after about 10 years: http://cgit.freedesktop.org/xorg/xserver/commit/?id=6238bd68bd71323f8b4f1808f34dabe2ae447fe3 So work-around that horror. https://bugzilla.gnome.org/show_bug.cgi?id=709114
Diffstat (limited to 'plugins/power/gpm-common.c')
-rw-r--r--plugins/power/gpm-common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index 7367fa51..54838b69 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -29,6 +29,7 @@
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
#include <X11/extensions/XTest.h>
+#include <X11/extensions/dpms.h>
#include <canberra-gtk.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API
@@ -1150,6 +1151,15 @@ disable_builtin_screensaver (gpointer unused)
guint
gsd_power_enable_screensaver_watchdog (void)
{
+ int dummy;
+
+ /* Make sure that Xorg's DPMS extension never gets in our
+ * way. The defaults are now applied in Fedora 20 from
+ * being "0" by default to being "600" by default */
+ gdk_error_trap_push ();
+ if (DPMSQueryExtension(GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &dummy, &dummy))
+ DPMSSetTimeouts (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), 0, 0, 0);
+ gdk_error_trap_pop_ignored ();
return g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT,
disable_builtin_screensaver,
NULL);