gnome-settings-daemon: add 2 patches for screensaver and using systemd logind.

This commit is contained in:
Juan RP 2012-10-19 09:46:38 +02:00
parent 5de03027b5
commit c3fcf11eb7
4 changed files with 1638 additions and 23 deletions

View File

@ -30,21 +30,6 @@ libwacom.so.2
libXtst.so.6
libcups.so.2
libsystemd-login.so.0
libatk-1.0.so.0
libpangocairo-1.0.so.0
libcairo-gobject.so.2
libpango-1.0.so.0
libcolord.so.1
liblcms2.so.2
libXfixes.so.3
libssl3.so
libsmime3.so
libnssutil3.so
libplds4.so
libdl.so.2
libgssapi_krb5.so.2
libkrb5.so.3
libk5crypto.so.3
libcom_err.so.2
libcrypt.so.1
libz.so.1

View File

@ -0,0 +1,145 @@
From b47e4019a12ac84fba31e1c631d878ce03fa3808 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Wed, 17 Oct 2012 22:44:54 +0000
Subject: power: Add a watchdog to keep X's builtin screen saver disabled
X's builtin screen saver may activate DPMS. Since we want to activate
DPMS ourselves according to our own policy we must make sure that X's
screen saver remains disabled.
This code is a copy of the original found in gs-watcher-x11.c from
gnome-screensaver which stopped being used in GNOME 3.6.
https://bugzilla.gnome.org/show_bug.cgi?id=686339
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 0e06495..070cf32 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <sys/wait.h>
#include <glib/gi18n.h>
+#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <libupower-glib/upower.h>
#include <libnotify/notify.h>
@@ -80,6 +81,8 @@
/* Keep this in sync with gnome-shell */
#define SCREENSAVER_FADE_TIME 10 /* seconds */
+#define XSCREENSAVER_WATCHDOG_TIMEOUT 120 /* seconds */
+
enum {
GSD_POWER_IDLETIME_NULL_ID,
GSD_POWER_IDLETIME_DIM_ID,
@@ -197,6 +200,7 @@ struct GsdPowerManagerPrivate
GsdPowerIdleMode current_idle_mode;
guint lid_close_safety_timer_id;
GtkStatusIcon *status_icon;
+ guint xscreensaver_watchdog_timer_id;
};
enum {
@@ -3621,6 +3625,77 @@ engine_session_active_changed_cb (GnomeSettingsSession *session,
idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL);
}
+/* This timer goes off every few minutes, whether the user is idle or not,
+ to try and clean up anything that has gone wrong.
+
+ It calls disable_builtin_screensaver() so that if xset has been used,
+ or some other program (like xlock) has messed with the XSetScreenSaver()
+ settings, they will be set back to sensible values (if a server extension
+ is in use, messing with xlock can cause the screensaver to never get a wakeup
+ event, and could cause monitor power-saving to occur, and all manner of
+ heinousness.)
+
+ This code was originally part of gnome-screensaver, see
+ http://git.gnome.org/browse/gnome-screensaver/tree/src/gs-watcher-x11.c?id=fec00b12ec46c86334cfd36b37771cc4632f0d4d#n530
+ */
+static gboolean
+disable_builtin_screensaver (gpointer unused)
+{
+ int current_server_timeout, current_server_interval;
+ int current_prefer_blank, current_allow_exp;
+ int desired_server_timeout, desired_server_interval;
+ int desired_prefer_blank, desired_allow_exp;
+
+ XGetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+ &current_server_timeout,
+ &current_server_interval,
+ &current_prefer_blank,
+ &current_allow_exp);
+
+ desired_server_timeout = current_server_timeout;
+ desired_server_interval = current_server_interval;
+ desired_prefer_blank = current_prefer_blank;
+ desired_allow_exp = current_allow_exp;
+
+ desired_server_interval = 0;
+
+ /* I suspect (but am not sure) that DontAllowExposures might have
+ something to do with powering off the monitor as well, at least
+ on some systems that don't support XDPMS? Who know... */
+ desired_allow_exp = AllowExposures;
+
+ /* When we're not using an extension, set the server-side timeout to 0,
+ so that the server never gets involved with screen blanking, and we
+ do it all ourselves. (However, when we *are* using an extension,
+ we tell the server when to notify us, and rather than blanking the
+ screen, the server will send us an X event telling us to blank.)
+ */
+ desired_server_timeout = 0;
+
+ if (desired_server_timeout != current_server_timeout
+ || desired_server_interval != current_server_interval
+ || desired_prefer_blank != current_prefer_blank
+ || desired_allow_exp != current_allow_exp) {
+
+ g_debug ("disabling server builtin screensaver:"
+ " (xset s %d %d; xset s %s; xset s %s)",
+ desired_server_timeout,
+ desired_server_interval,
+ (desired_prefer_blank ? "blank" : "noblank"),
+ (desired_allow_exp ? "expose" : "noexpose"));
+
+ XSetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+ desired_server_timeout,
+ desired_server_interval,
+ desired_prefer_blank,
+ desired_allow_exp);
+
+ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE);
+ }
+
+ return TRUE;
+}
+
gboolean
gsd_power_manager_start (GsdPowerManager *manager,
GError **error)
@@ -3778,6 +3853,9 @@ gsd_power_manager_start (GsdPowerManager *manager,
/* set the initial dim time that can adapt for the user */
refresh_idle_dim_settings (manager);
+ manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT,
+ disable_builtin_screensaver,
+ NULL);
gnome_settings_profile_end (NULL);
return TRUE;
}
@@ -3829,6 +3907,11 @@ gsd_power_manager_stop (GsdPowerManager *manager)
g_clear_object (&manager->priv->idletime);
g_clear_object (&manager->priv->status_icon);
+
+ if (manager->priv->xscreensaver_watchdog_timer_id > 0) {
+ g_source_remove (manager->priv->xscreensaver_watchdog_timer_id);
+ manager->priv->xscreensaver_watchdog_timer_id = 0;
+ }
}
static void
--
cgit v0.9.0.2

View File

@ -1,18 +1,19 @@
# Template file for 'gnome-settings-daemon'
pkgname=gnome-settings-daemon
version=3.6.1
revision=1
revision=2
patch_args="-Np1"
build_style=gnu-configure
subpackages="$pkgname-devel"
configure_args="--disable-static --enable-cups
--disable-schemas-compile --enable-systemd --disable-packagekit"
--disable-schemas-compile --enable-systemd --disable-packagekit"
depends="pulseaudio hicolor-icon-theme"
makedepends="pkg-config intltool libxslt docbook-xsl
colord-devel>=0.1.23_3 libxklavier-devel libnotify-devel
gtk+3-devel>=3.6.0_3 libcanberra-devel pulseaudio-devel nss-devel
startup-notification-devel gnome-desktop-devel>=3.6.0 libgnomekbd-devel
libxkbfile-devel xf86-input-wacom-devel libwacom-devel systemd-devel
ibus-devel>=1.4.99 cups-devel libgudev-devel upower-devel"
makedepends="automake pkg-config intltool libxslt docbook-xsl
colord-devel>=0.1.23_3 libxklavier-devel libnotify-devel
gtk+3-devel>=3.6.0_3 libcanberra-devel pulseaudio-devel nss-devel
startup-notification-devel gnome-desktop-devel>=3.6.0 libgnomekbd-devel
libxkbfile-devel xf86-input-wacom-devel libwacom-devel systemd-devel
ibus-devel>=1.4.99 cups-devel libgudev-devel upower-devel"
fulldepends="gsettings-desktop-schemas"
short_desc="GNOME settings daemon"
maintainer="Juan RP <xtraeme@gmail.com>"
@ -22,3 +23,14 @@ distfiles="${GNOME_SITE}/$pkgname/3.6/$pkgname-$version.tar.xz"
checksum=1fe96e0709d7c618d90cc1bfcddc46eede3c2cdb305f5e7f4cb388d43dd5526a
long_desc="
This package provides a daemon to handle settings on the GNOME desktop."
pre_configure() {
aclocal && automake
}
post_install() {
# Plugins that aren't installed still have schema references
# and cause gsettings errors - remove the references we're not using
sed -i '/org\.gnome\.settings-daemon\.plugins\.updates/d' \
${DESTDIR}/usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.gschema.xml
}