|
|
14e627 |
From 9a13cc8529189c3b316c7bb7c96ab27e9e56aad2 Mon Sep 17 00:00:00 2001
|
|
|
14e627 |
From: Ondrej Holy <oholy@redhat.com>
|
|
|
14e627 |
Date: Wed, 20 May 2015 15:33:49 +0200
|
|
|
14e627 |
Subject: [PATCH] mouse: Do not disable touchpad buttons
|
|
|
14e627 |
|
|
|
14e627 |
Touchpad buttons are disabled also if touchpad is disabled using
|
|
|
14e627 |
"Device Enabled" property. Unfortunately some touchpads share those
|
|
|
14e627 |
buttons with trackpoint, which is consequently unusable. Disable
|
|
|
14e627 |
touchpad using "Synaptics Off" property instead to avoid disabling
|
|
|
14e627 |
the buttons.
|
|
|
14e627 |
|
|
|
14e627 |
Remove also some redundant calls to enable/disable touchpad and
|
|
|
14e627 |
make sure syndaemon isn't running if the touchpads are disabled.
|
|
|
14e627 |
|
|
|
14e627 |
https://bugzilla.gnome.org/show_bug.cgi?id=747504
|
|
|
14e627 |
---
|
|
|
14e627 |
plugins/common/gsd-input-helper.c | 23 +++++++++++++++++++++++
|
|
|
14e627 |
plugins/common/gsd-input-helper.h | 3 +++
|
|
|
14e627 |
plugins/mouse/gsd-mouse-manager.c | 37 +++++++++++--------------------------
|
|
|
14e627 |
3 files changed, 37 insertions(+), 26 deletions(-)
|
|
|
14e627 |
|
|
|
14e627 |
diff --git a/plugins/common/gsd-input-helper.c b/plugins/common/gsd-input-helper.c
|
|
|
14e627 |
index 4872506..3907c70 100644
|
|
|
14e627 |
--- a/plugins/common/gsd-input-helper.c
|
|
|
14e627 |
+++ b/plugins/common/gsd-input-helper.c
|
|
|
14e627 |
@@ -464,6 +464,29 @@ set_device_enabled (int device_id,
|
|
|
14e627 |
return TRUE;
|
|
|
14e627 |
}
|
|
|
14e627 |
|
|
|
14e627 |
+gboolean
|
|
|
14e627 |
+set_touchpad_device_enabled (int device_id,
|
|
|
14e627 |
+ gboolean enabled)
|
|
|
14e627 |
+{
|
|
|
14e627 |
+ Atom prop;
|
|
|
14e627 |
+ guchar value;
|
|
|
14e627 |
+
|
|
|
14e627 |
+ prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Off", False);
|
|
|
14e627 |
+ if (!prop)
|
|
|
14e627 |
+ return FALSE;
|
|
|
14e627 |
+
|
|
|
14e627 |
+ gdk_error_trap_push ();
|
|
|
14e627 |
+
|
|
|
14e627 |
+ value = enabled ? 0 : 1;
|
|
|
14e627 |
+ XIChangeProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
|
|
14e627 |
+ device_id, prop, XA_INTEGER, 8, PropModeReplace, &value, 1);
|
|
|
14e627 |
+
|
|
|
14e627 |
+ if (gdk_error_trap_pop ())
|
|
|
14e627 |
+ return FALSE;
|
|
|
14e627 |
+
|
|
|
14e627 |
+ return TRUE;
|
|
|
14e627 |
+}
|
|
|
14e627 |
+
|
|
|
14e627 |
static const char *
|
|
|
14e627 |
custom_command_to_string (CustomCommand command)
|
|
|
14e627 |
{
|
|
|
14e627 |
diff --git a/plugins/common/gsd-input-helper.h b/plugins/common/gsd-input-helper.h
|
|
|
14e627 |
index 85e8492..53938bc 100644
|
|
|
14e627 |
--- a/plugins/common/gsd-input-helper.h
|
|
|
14e627 |
+++ b/plugins/common/gsd-input-helper.h
|
|
|
14e627 |
@@ -57,6 +57,9 @@ gboolean supports_xtest (void);
|
|
|
14e627 |
gboolean set_device_enabled (int device_id,
|
|
|
14e627 |
gboolean enabled);
|
|
|
14e627 |
|
|
|
14e627 |
+gboolean set_touchpad_device_enabled (int device_id,
|
|
|
14e627 |
+ gboolean enabled);
|
|
|
14e627 |
+
|
|
|
14e627 |
gboolean device_is_touchpad (XDevice *xdevice);
|
|
|
14e627 |
|
|
|
14e627 |
gboolean device_info_is_touchpad (XDeviceInfo *device_info);
|
|
|
14e627 |
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
|
|
|
14e627 |
index 2cd4257..8b62463 100644
|
|
|
14e627 |
--- a/plugins/mouse/gsd-mouse-manager.c
|
|
|
14e627 |
+++ b/plugins/mouse/gsd-mouse-manager.c
|
|
|
14e627 |
@@ -552,7 +552,10 @@ syndaemon_died (GPid pid, gint status, gpointer user_data)
|
|
|
14e627 |
static int
|
|
|
14e627 |
set_disable_w_typing (GsdMouseManager *manager, gboolean state)
|
|
|
14e627 |
{
|
|
|
14e627 |
- if (state && touchpad_is_present ()) {
|
|
|
14e627 |
+ gboolean touchpad_enabled;
|
|
|
14e627 |
+
|
|
|
14e627 |
+ touchpad_enabled = g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED);
|
|
|
14e627 |
+ if (state && touchpad_enabled && touchpad_is_present ()) {
|
|
|
14e627 |
GError *error = NULL;
|
|
|
14e627 |
GPtrArray *args;
|
|
|
14e627 |
|
|
|
14e627 |
@@ -814,7 +817,7 @@ set_touchpad_disabled (GdkDevice *device)
|
|
|
14e627 |
return;
|
|
|
14e627 |
}
|
|
|
14e627 |
|
|
|
14e627 |
- if (set_device_enabled (id, FALSE) == FALSE)
|
|
|
14e627 |
+ if (set_touchpad_device_enabled (id, FALSE) == FALSE)
|
|
|
14e627 |
g_warning ("Error disabling device \"%s\" (%d)", gdk_device_get_name (device), id);
|
|
|
14e627 |
else
|
|
|
14e627 |
g_debug ("Disabled device \"%s\" (%d)", gdk_device_get_name (device), id);
|
|
|
14e627 |
@@ -839,7 +842,7 @@ set_touchpad_enabled (int id)
|
|
|
14e627 |
return;
|
|
|
14e627 |
}
|
|
|
14e627 |
|
|
|
14e627 |
- if (set_device_enabled (id, TRUE) == FALSE)
|
|
|
14e627 |
+ if (set_touchpad_device_enabled (id, TRUE) == FALSE)
|
|
|
14e627 |
g_warning ("Error enabling device \"%d\"", id);
|
|
|
14e627 |
else
|
|
|
14e627 |
g_debug ("Enabled device %d", id);
|
|
|
14e627 |
@@ -948,6 +951,8 @@ set_mouse_settings (GsdMouseManager *manager,
|
|
|
14e627 |
set_natural_scroll (manager, device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_NATURAL_SCROLL_ENABLED));
|
|
|
14e627 |
if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED) == FALSE)
|
|
|
14e627 |
set_touchpad_disabled (device);
|
|
|
14e627 |
+ else
|
|
|
14e627 |
+ set_touchpad_enabled (gdk_x11_device_get_id (device));
|
|
|
14e627 |
}
|
|
|
14e627 |
|
|
|
14e627 |
static void
|
|
|
14e627 |
@@ -1063,6 +1068,9 @@ touchpad_callback (GSettings *settings,
|
|
|
14e627 |
return;
|
|
|
14e627 |
}
|
|
|
14e627 |
|
|
|
14e627 |
+ if (g_str_equal (key, KEY_TOUCHPAD_ENABLED))
|
|
|
14e627 |
+ set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING));
|
|
|
14e627 |
+
|
|
|
14e627 |
devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE);
|
|
|
14e627 |
|
|
|
14e627 |
for (l = devices; l != NULL; l = l->next) {
|
|
|
14e627 |
@@ -1098,18 +1106,6 @@ touchpad_callback (GSettings *settings,
|
|
|
14e627 |
}
|
|
|
14e627 |
}
|
|
|
14e627 |
g_list_free (devices);
|
|
|
14e627 |
-
|
|
|
14e627 |
- if (g_str_equal (key, KEY_TOUCHPAD_ENABLED) &&
|
|
|
14e627 |
- g_settings_get_boolean (settings, key)) {
|
|
|
14e627 |
- devices = get_disabled_devices (manager->priv->device_manager);
|
|
|
14e627 |
- for (l = devices; l != NULL; l = l->next) {
|
|
|
14e627 |
- int device_id;
|
|
|
14e627 |
-
|
|
|
14e627 |
- device_id = GPOINTER_TO_INT (l->data);
|
|
|
14e627 |
- set_touchpad_enabled (device_id);
|
|
|
14e627 |
- }
|
|
|
14e627 |
- g_list_free (devices);
|
|
|
14e627 |
- }
|
|
|
14e627 |
}
|
|
|
14e627 |
|
|
|
14e627 |
/* Re-enable touchpad when any other pointing device isn't present. */
|
|
|
14e627 |
@@ -1233,17 +1229,6 @@ gsd_mouse_manager_idle_cb (GsdMouseManager *manager)
|
|
|
14e627 |
|
|
|
14e627 |
ensure_touchpad_active (manager);
|
|
|
14e627 |
|
|
|
14e627 |
- if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED)) {
|
|
|
14e627 |
- devices = get_disabled_devices (manager->priv->device_manager);
|
|
|
14e627 |
- for (l = devices; l != NULL; l = l->next) {
|
|
|
14e627 |
- int device_id;
|
|
|
14e627 |
-
|
|
|
14e627 |
- device_id = GPOINTER_TO_INT (l->data);
|
|
|
14e627 |
- set_touchpad_enabled (device_id);
|
|
|
14e627 |
- }
|
|
|
14e627 |
- g_list_free (devices);
|
|
|
14e627 |
- }
|
|
|
14e627 |
-
|
|
|
14e627 |
gnome_settings_profile_end (NULL);
|
|
|
14e627 |
|
|
|
14e627 |
manager->priv->start_idle_id = 0;
|
|
|
14e627 |
--
|
|
|
14e627 |
2.4.1
|
|
|
14e627 |
|