Fix disabled touchscreens when resuming from suspend (#1173849)

This commit is contained in:
Bastien Nocera 2015-01-20 17:16:33 +01:00
parent 7fc7db046d
commit c6abb7e4cc
2 changed files with 109 additions and 1 deletions

View File

@ -0,0 +1,101 @@
From 456ce166b43e11edd900d43ec76879b93659d60a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 20 Jan 2015 16:58:16 +0100
Subject: [PATCH] power: Don't forget about disabled touchscreens
When blanking the screen twice, which can happen when suspending,
don't forget about previously disabled touchscreens.
See https://bugzilla.redhat.com/show_bug.cgi?id=1173849
https://bugzilla.gnome.org/show_bug.cgi?id=743252
---
plugins/power/gsd-power-manager.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 0c2469d..b31ec6d 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -129,7 +129,7 @@ struct GsdPowerManagerPrivate
/* Screensaver */
GsdScreenSaver *screensaver_proxy;
gboolean screensaver_active;
- GList *disabled_devices;
+ GHashTable *disabled_devices;
/* State */
gboolean lid_is_present;
@@ -921,12 +921,11 @@ screen_devices_disable (GsdPowerManager *manager)
{
GsdDeviceMapper *mapper;
GdkDeviceManager *device_manager;
- GList *devices, *l, *to_change;
+ GList *devices, *l;
mapper = gsd_device_mapper_get ();
device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_SLAVE);
- to_change = NULL;
for (l = devices; l != NULL; l = l->next ) {
GdkDevice *device = l->data;
@@ -934,27 +933,30 @@ screen_devices_disable (GsdPowerManager *manager)
int device_id;
g_object_get (device, "device-id", &device_id, NULL);
- to_change = g_list_prepend (to_change, GINT_TO_POINTER (device_id));
+ g_hash_table_insert (manager->priv->disabled_devices,
+ GINT_TO_POINTER (device_id),
+ GINT_TO_POINTER (TRUE));
}
}
g_list_free (devices);
- for (l = to_change; l != NULL; l = l->next)
+ devices = g_hash_table_get_keys (manager->priv->disabled_devices);
+ for (l = devices; l != NULL; l = l->next)
set_device_enabled (GPOINTER_TO_INT (l->data), FALSE);
-
- g_clear_pointer (&manager->priv->disabled_devices, g_list_free);
- manager->priv->disabled_devices = to_change;
+ g_list_free (devices);
}
static void
screen_devices_enable (GsdPowerManager *manager)
{
- GList *l;
+ GList *l, *disabled_devices;
- for (l = manager->priv->disabled_devices; l != NULL; l = l->next)
+ disabled_devices = g_hash_table_get_keys (manager->priv->disabled_devices);
+ for (l = disabled_devices; l != NULL; l = l->next)
set_device_enabled (GPOINTER_TO_INT (l->data), TRUE);
+ g_list_free (disabled_devices);
- g_clear_pointer (&manager->priv->disabled_devices, g_list_free);
+ g_hash_table_remove_all (manager->priv->disabled_devices);
}
static void
@@ -1828,6 +1830,8 @@ gsd_power_manager_finalize (GObject *object)
gsd_power_manager_stop (manager);
+ g_clear_pointer (&manager->priv->disabled_devices, g_hash_table_unref);
+
g_clear_object (&manager->priv->connection);
if (manager->priv->name_id != 0)
@@ -2521,6 +2525,7 @@ gsd_power_manager_init (GsdPowerManager *manager)
manager->priv->inhibit_lid_switch_fd = -1;
manager->priv->inhibit_suspend_fd = -1;
manager->priv->bus_cancellable = g_cancellable_new ();
+ manager->priv->disabled_devices = g_hash_table_new (g_direct_hash, g_direct_equal);
}
/* returns new level */
--
2.1.0

View File

@ -7,7 +7,7 @@
Name: gnome-settings-daemon
Version: 3.14.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -18,6 +18,8 @@ Source: http://download.gnome.org/sources/%{name}/3.14/%{name}-%{version
# disable wacom for ppc/ppc64 (used on RHEL)
Patch0: %{name}-3.5.4-ppc-no-wacom.patch
Patch1: 0001-power-Don-t-forget-about-disabled-touchscreens.patch
BuildRequires: gtk3-devel >= %{gtk3_version}
BuildRequires: gnome-desktop3-devel >= %{gnome_desktop_version}
BuildRequires: xorg-x11-proto-devel libXxf86misc-devel
@ -93,6 +95,8 @@ developing applications that use %{name}.
autoreconf -i -f
%patch1 -p1
%build
%configure --disable-static \
%if 0%{?rhel}
@ -261,6 +265,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_libexecdir}/gsd-test-xsettings
%changelog
* Tue Jan 20 2015 Bastien Nocera <bnocera@redhat.com> 3.14.2-2
- Fix disabled touchscreens when resuming from suspend (#1173849)
* Tue Nov 11 2014 Kalev Lember <kalevlember@gmail.com> - 3.14.2-1
- Update to 3.14.2