From 78305bcaf7e72beaded5cfb87a37f8b3b8943489 Mon Sep 17 00:00:00 2001 From: Xiaoguang Wang Date: Sun, 8 Apr 2018 17:05:34 +0800 Subject: [PATCH] power: Add touch screen input switch Use this switch to disable or enable touch screen input when screen is off. https://bugzilla.gnome.org/show_bug.cgi?id=778961#c4 --- data/org.gnome.settings-daemon.plugins.power.gschema.xml.in | 5 +++++ plugins/power/gsd-power-manager.c | 6 ++++++ 2 files changed, 11 insertions(+) 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 93c704e9..a6aee267 100644 --- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in +++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in @@ -41,5 +41,10 @@ Power button action The action to take when the system power button is pressed. This action is hard-coded (and the setting ignored) on virtual machines (power off) and tablets (suspend). + + true + <_summary>Disable touch screen input when screen is off + <_description>Disable touch screen input when screen is off + diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c index 82d81e96..37f8fa94 100644 --- a/plugins/power/gsd-power-manager.c +++ b/plugins/power/gsd-power-manager.c @@ -937,6 +937,9 @@ screen_devices_disable (GsdPowerManager *manager) GdkDeviceManager *device_manager; GList *devices, *l; + if (!g_settings_get_boolean (manager->priv->settings, "disable-touch-screen")) + return; + /* This will be managed by the compositor eventually on X11 too: * https://bugzilla.gnome.org/show_bug.cgi?id=742598 */ @@ -975,6 +978,9 @@ screen_devices_enable (GsdPowerManager *manager) { GList *l, *disabled_devices; + if (!g_settings_get_boolean (manager->priv->settings, "disable-touch-screen")) + return; + if (gnome_settings_is_wayland ()) return; -- 2.12.3