depot/third_party/nixpkgs/pkgs/desktops/pantheon/services/elementary-settings-daemon/elementary-dpms.patch

85 lines
3.6 KiB
Diff
Raw Normal View History

diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
index ec805d8a..cf0d6793 100644
--- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
+++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
@@ -11,6 +11,11 @@
<summary>Activation of this plugin</summary>
<description>Whether this plugin would be activated by unity-settings-daemon or not</description>
</key>
+ <key name="manage-dpms-defaults" type="b">
+ <default>false</default>
+ <summary>Reset X DPMS values</summary>
+ <description>Whether DPMS values will be adjusted by gnome-settings-daemon</description>
+ </key>
<key name="idle-brightness" type="i">
<default>30</default>
<summary>The brightness of the screen when idle</summary>
diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index a7ca87fb..a56a7cdc 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -280,6 +280,18 @@ disable_builtin_screensaver (gpointer unused)
return TRUE;
}
+gboolean
+manage_dpms (void)
+{
+ GSettings *settings;
+ gboolean manage_dpms_defaults;
+
+ settings = g_settings_new ("org.gnome.settings-daemon.plugins.power");
+ manage_dpms_defaults = g_settings_get_boolean (settings, "manage-dpms-defaults");
+ g_object_unref (settings);
+ return manage_dpms_defaults;
+}
+
guint
gsd_power_enable_screensaver_watchdog (void)
{
@@ -290,7 +302,7 @@ gsd_power_enable_screensaver_watchdog (void)
* way. The defaults are now applied in Fedora 20 from
* being "0" by default to being "600" by default */
gdk_x11_display_error_trap_push (gdk_display_get_default ());
- if (DPMSQueryExtension(GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &dummy, &dummy))
+ if (manage_dpms () && DPMSQueryExtension(GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &dummy, &dummy))
DPMSSetTimeouts (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), 0, 0, 0);
gdk_x11_display_error_trap_pop_ignored (gdk_display_get_default ());
id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT,
diff --git a/plugins/power/gpm-common.h b/plugins/power/gpm-common.h
index 88a8e00e..af106479 100644
--- a/plugins/power/gpm-common.h
+++ b/plugins/power/gpm-common.h
@@ -34,6 +34,7 @@ gchar *gpm_get_timestring (guint time);
gboolean gsd_power_is_hardware_a_vm (void);
guint gsd_power_enable_screensaver_watchdog (void);
void reset_idletime (void);
+gboolean manage_dpms (void);
/* Backlight helpers */
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index c500fa38..445496ee 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1033,6 +1033,9 @@ backlight_enable (GsdPowerManager *manager)
gboolean ret;
GError *error = NULL;
+ if (!(manage_dpms ()))
+ return;
+
iio_proxy_claim_light (manager, TRUE);
ret = gnome_rr_screen_set_dpms_mode (manager->rr_screen,
GNOME_RR_DPMS_ON,
@@ -1052,6 +1055,9 @@ backlight_disable (GsdPowerManager *manager)
gboolean ret;
GError *error = NULL;
+ if (!(manage_dpms ()))
+ return;
+
iio_proxy_claim_light (manager, FALSE);
ret = gnome_rr_screen_set_dpms_mode (manager->rr_screen,
GNOME_RR_DPMS_OFF,