[gnome-settings-daemon] power: Disable touchscreens when turning off its screen
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Disable touchscreens when turning off its screen
- Date: Tue, 28 Oct 2014 12:54:21 +0000 (UTC)
commit ab2b808655d0aa949ee22d7fd31d288a1ffc90bf
Author: Bastien Nocera <hadess hadess net>
Date: Fri Jul 25 11:57:08 2014 +0200
power: Disable touchscreens when turning off its screen
For example, turning off a tablet's touchscreen when the screenlock
kicks in.
Note that this is currently broken due to bugs in the kernel.
For the X.org tracking bug, see
https://bugs.freedesktop.org/show_bug.cgi?id=81781
And a possible patch exists at:
https://lkml.org/lkml/2014/9/30/588
https://bugzilla.gnome.org/show_bug.cgi?id=720295
plugins/power/gsd-power-manager.c | 50 +++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index e565d28..0c2469d 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -37,6 +37,7 @@
#include <libgnome-desktop/gnome-idle-monitor.h>
#include <gsd-input-helper.h>
+#include <gsd-device-mapper.h>
#include "gsd-power-constants.h"
#include "gsm-inhibitor-flag.h"
@@ -128,6 +129,7 @@ struct GsdPowerManagerPrivate
/* Screensaver */
GsdScreenSaver *screensaver_proxy;
gboolean screensaver_active;
+ GList *disabled_devices;
/* State */
gboolean lid_is_present;
@@ -915,6 +917,47 @@ action_hibernate (GsdPowerManager *manager)
}
static void
+screen_devices_disable (GsdPowerManager *manager)
+{
+ GsdDeviceMapper *mapper;
+ GdkDeviceManager *device_manager;
+ GList *devices, *l, *to_change;
+
+ 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;
+
+ if (gsd_device_mapper_get_device_output (mapper, device) != NULL) {
+ 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_list_free (devices);
+
+ for (l = to_change; 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;
+}
+
+static void
+screen_devices_enable (GsdPowerManager *manager)
+{
+ GList *l;
+
+ for (l = manager->priv->disabled_devices; l != NULL; l = l->next)
+ set_device_enabled (GPOINTER_TO_INT (l->data), TRUE);
+
+ g_clear_pointer (&manager->priv->disabled_devices, g_list_free);
+}
+
+static void
backlight_enable (GsdPowerManager *manager)
{
gboolean ret;
@@ -929,6 +972,8 @@ backlight_enable (GsdPowerManager *manager)
g_error_free (error);
}
+ screen_devices_enable (manager);
+
g_debug ("TESTSUITE: Unblanked screen");
}
@@ -946,6 +991,9 @@ backlight_disable (GsdPowerManager *manager)
error->message);
g_error_free (error);
}
+
+ screen_devices_disable (manager);
+
g_debug ("TESTSUITE: Blanked screen");
}
@@ -2407,6 +2455,8 @@ gsd_power_manager_stop (GsdPowerManager *manager)
{
g_debug ("Stopping power manager");
+ screen_devices_enable (manager);
+
if (manager->priv->inhibit_lid_switch_timer_id != 0) {
g_source_remove (manager->priv->inhibit_lid_switch_timer_id);
manager->priv->inhibit_lid_switch_timer_id = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]