[gnome-settings-daemon] mouse: Re-enable touchpad when mouse isn't present



commit 72b8df16a626cd6b638f3953b69f28e08bc39e59
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Oct 11 11:04:52 2012 +0200

    mouse: Re-enable touchpad when mouse isn't present
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685941

 plugins/mouse/gsd-mouse-manager.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index 36154fe..2e653e1 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -1124,6 +1124,14 @@ touchpad_callback (GSettings       *settings,
         }
 }
 
+/* Re-enable touchpad when any other pointing device isn't present. */
+static void
+ensure_touchpad_active (GsdMouseManager *manager)
+{
+        if (mouse_is_present () == FALSE && touchscreen_is_present () == FALSE && trackball_is_present () == FALSE && touchpad_is_present ())
+                g_settings_set_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED, TRUE);
+}
+
 static void
 device_added_cb (GdkDeviceManager *device_manager,
                  GdkDevice        *device,
@@ -1162,6 +1170,8 @@ device_removed_cb (GdkDeviceManager *device_manager,
 
                 /* If a touchpad was to disappear... */
                 set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING));
+
+                ensure_touchpad_active (manager);
         }
 }
 
@@ -1233,6 +1243,8 @@ gsd_mouse_manager_idle_cb (GsdMouseManager *manager)
         }
         g_list_free (devices);
 
+        ensure_touchpad_active (manager);
+
         if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED)) {
                 devices = get_disabled_devices (manager->priv->device_manager);
                 for (l = devices; l != NULL; l = l->next) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]