|
|
b8fc81 |
From 6881c089a00b184358de3e6c80f2711f59ec5e04 Mon Sep 17 00:00:00 2001
|
|
|
57bc60 |
From: Carlos Garnacho <carlosg@gnome.org>
|
|
|
57bc60 |
Date: Mon, 13 Mar 2017 19:58:42 +0100
|
|
|
b8fc81 |
Subject: [PATCH 2/3] mouse: Handle Synaptics devices again
|
|
|
57bc60 |
|
|
|
57bc60 |
If mutter can handle those, so can g-c-c
|
|
|
57bc60 |
---
|
|
|
b8fc81 |
panels/mouse/cc-mouse-caps-helper.c | 85 ++++++++++++++++++++++++++++++++---
|
|
|
b8fc81 |
panels/mouse/gnome-mouse-properties.c | 10 +----
|
|
|
b8fc81 |
2 files changed, 79 insertions(+), 16 deletions(-)
|
|
|
57bc60 |
|
|
|
57bc60 |
diff --git a/panels/mouse/cc-mouse-caps-helper.c b/panels/mouse/cc-mouse-caps-helper.c
|
|
|
a86393 |
index acbe9c94a..456edd817 100644
|
|
|
57bc60 |
--- a/panels/mouse/cc-mouse-caps-helper.c
|
|
|
57bc60 |
+++ b/panels/mouse/cc-mouse-caps-helper.c
|
|
|
57bc60 |
@@ -25,9 +25,72 @@
|
|
|
57bc60 |
#include "cc-mouse-caps-helper.h"
|
|
|
57bc60 |
|
|
|
57bc60 |
static gboolean
|
|
|
57bc60 |
-touchpad_check_capabilities_x11 (gboolean *have_two_finger_scrolling,
|
|
|
57bc60 |
- gboolean *have_edge_scrolling,
|
|
|
57bc60 |
- gboolean *have_tap_to_click)
|
|
|
57bc60 |
+touchpad_check_capabilities_x11_synaptics (gboolean *have_two_finger_scrolling,
|
|
|
57bc60 |
+ gboolean *have_edge_scrolling,
|
|
|
57bc60 |
+ gboolean *have_tap_to_click)
|
|
|
57bc60 |
+{
|
|
|
57bc60 |
+ Display *display;
|
|
|
57bc60 |
+ GList *devicelist, *l;
|
|
|
57bc60 |
+ Atom realtype, prop_two_finger_scroll, prop_edge_scroll, prop_tap_action;
|
|
|
57bc60 |
+ int realformat;
|
|
|
57bc60 |
+ unsigned long nitems, bytes_after;
|
|
|
57bc60 |
+ unsigned char *data;
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
|
|
57bc60 |
+ prop_two_finger_scroll = XInternAtom (display, "Synaptics Two-Finger Scrolling", False);
|
|
|
57bc60 |
+ prop_edge_scroll = XInternAtom (display, "Synaptics Edge Scrolling", False);
|
|
|
57bc60 |
+ prop_tap_action = XInternAtom (display, "Synaptics Tap Action", False);
|
|
|
57bc60 |
+ if (!prop_two_finger_scroll || !prop_edge_scroll || !prop_tap_action)
|
|
|
57bc60 |
+ return FALSE;
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ *have_two_finger_scrolling = FALSE;
|
|
|
57bc60 |
+ *have_edge_scrolling = FALSE;
|
|
|
57bc60 |
+ *have_tap_to_click = FALSE;
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ gdk_error_trap_push ();
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ devicelist = gdk_seat_get_slaves (gdk_display_get_default_seat (gdk_display_get_default ()),
|
|
|
57bc60 |
+ GDK_SEAT_CAPABILITY_ALL_POINTING);
|
|
|
57bc60 |
+ for (l = devicelist; l != NULL; l = l->next) {
|
|
|
57bc60 |
+ GdkDevice *device = l->data;
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ if (gdk_device_get_source (device) != GDK_SOURCE_TOUCHPAD &&
|
|
|
57bc60 |
+ gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
|
|
|
57bc60 |
+ continue;
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ /* xorg-x11-drv-synaptics */
|
|
|
57bc60 |
+ if ((XIGetProperty (display, gdk_x11_device_get_id (device), prop_two_finger_scroll,
|
|
|
57bc60 |
+ 0, 2, False, XA_INTEGER, &realtype, &realformat, &nitems,
|
|
|
57bc60 |
+ &bytes_after, &data) == Success) && (realtype != None)) {
|
|
|
57bc60 |
+ *have_two_finger_scrolling = TRUE;
|
|
|
57bc60 |
+ XFree (data);
|
|
|
57bc60 |
+ }
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ if ((XIGetProperty (display, gdk_x11_device_get_id (device), prop_edge_scroll,
|
|
|
57bc60 |
+ 0, 3, False, XA_INTEGER, &realtype, &realformat, &nitems,
|
|
|
57bc60 |
+ &bytes_after, &data) == Success) && (realtype != None)) {
|
|
|
57bc60 |
+ *have_edge_scrolling = TRUE;
|
|
|
57bc60 |
+ XFree (data);
|
|
|
57bc60 |
+ }
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ if ((XIGetProperty (display, gdk_x11_device_get_id (device), prop_tap_action,
|
|
|
57bc60 |
+ 0, 8, False, XA_INTEGER, &realtype, &realformat, &nitems,
|
|
|
57bc60 |
+ &bytes_after, &data) == Success) && (realtype != None)) {
|
|
|
57bc60 |
+ *have_tap_to_click = TRUE;
|
|
|
57bc60 |
+ XFree (data);
|
|
|
57bc60 |
+ }
|
|
|
57bc60 |
+ }
|
|
|
57bc60 |
+ g_list_free (devicelist);
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ gdk_error_trap_pop_ignored ();
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ return TRUE;
|
|
|
57bc60 |
+}
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+static gboolean
|
|
|
57bc60 |
+touchpad_check_capabilities_x11_libinput (gboolean *have_two_finger_scrolling,
|
|
|
57bc60 |
+ gboolean *have_edge_scrolling,
|
|
|
57bc60 |
+ gboolean *have_tap_to_click)
|
|
|
57bc60 |
{
|
|
|
57bc60 |
Display *display;
|
|
|
a86393 |
g_autoptr(GList) devicelist = NULL;
|
|
|
57bc60 |
@@ -91,10 +154,18 @@ cc_touchpad_check_capabilities (gboolean *have_two_finger_scrolling,
|
|
|
57bc60 |
gboolean *have_edge_scrolling,
|
|
|
57bc60 |
gboolean *have_tap_to_click)
|
|
|
57bc60 |
{
|
|
|
57bc60 |
- if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
|
|
|
57bc60 |
- return touchpad_check_capabilities_x11 (have_two_finger_scrolling,
|
|
|
57bc60 |
- have_edge_scrolling,
|
|
|
57bc60 |
- have_tap_to_click);
|
|
|
57bc60 |
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
|
|
|
57bc60 |
+ if (cc_synaptics_check ()) {
|
|
|
57bc60 |
+ return touchpad_check_capabilities_x11_synaptics (have_two_finger_scrolling,
|
|
|
57bc60 |
+ have_edge_scrolling,
|
|
|
57bc60 |
+ have_tap_to_click);
|
|
|
57bc60 |
+ }
|
|
|
57bc60 |
+
|
|
|
57bc60 |
+ return touchpad_check_capabilities_x11_libinput (have_two_finger_scrolling,
|
|
|
57bc60 |
+ have_edge_scrolling,
|
|
|
57bc60 |
+ have_tap_to_click);
|
|
|
57bc60 |
+ }
|
|
|
57bc60 |
+
|
|
|
57bc60 |
/* else we unconditionally show all touchpad knobs */
|
|
|
57bc60 |
*have_two_finger_scrolling = TRUE;
|
|
|
57bc60 |
*have_edge_scrolling = TRUE;
|
|
|
57bc60 |
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
|
|
|
a86393 |
index 4d0920b2d..b280e863c 100644
|
|
|
57bc60 |
--- a/panels/mouse/gnome-mouse-properties.c
|
|
|
57bc60 |
+++ b/panels/mouse/gnome-mouse-properties.c
|
|
|
57bc60 |
@@ -61,7 +61,6 @@ struct _CcMousePropertiesPrivate
|
|
|
57bc60 |
gboolean have_mouse;
|
|
|
57bc60 |
gboolean have_touchpad;
|
|
|
57bc60 |
gboolean have_touchscreen;
|
|
|
57bc60 |
- gboolean have_synaptics;
|
|
|
57bc60 |
|
|
|
57bc60 |
gboolean left_handed;
|
|
|
57bc60 |
GtkGesture *left_gesture;
|
|
|
57bc60 |
@@ -81,10 +80,6 @@ setup_touchpad_options (CcMousePropertiesPrivate *d)
|
|
|
57bc60 |
gboolean have_edge_scrolling;
|
|
|
57bc60 |
gboolean have_tap_to_click;
|
|
|
57bc60 |
|
|
|
57bc60 |
- gtk_widget_set_visible (WID ("touchpad-frame"), !d->have_synaptics);
|
|
|
57bc60 |
- if (d->have_synaptics)
|
|
|
57bc60 |
- return;
|
|
|
57bc60 |
-
|
|
|
57bc60 |
gtk_widget_set_visible (WID ("touchpad-frame"), d->have_touchpad);
|
|
|
57bc60 |
if (!d->have_touchpad)
|
|
|
57bc60 |
return;
|
|
|
b8fc81 |
@@ -387,11 +382,8 @@ cc_mouse_properties_init (CcMouseProperties *object)
|
|
|
57bc60 |
G_CALLBACK (device_changed), d);
|
|
|
57bc60 |
|
|
|
57bc60 |
d->have_mouse = mouse_is_present ();
|
|
|
57bc60 |
- d->have_touchpad = touchpad_is_present ();
|
|
|
57bc60 |
+ d->have_touchpad = touchpad_is_present () || cc_synaptics_check ();
|
|
|
57bc60 |
d->have_touchscreen = touchscreen_is_present ();
|
|
|
57bc60 |
- d->have_synaptics = cc_synaptics_check ();
|
|
|
57bc60 |
- if (d->have_synaptics)
|
|
|
57bc60 |
- g_warning ("Detected synaptics X driver, please migrate to libinput");
|
|
|
57bc60 |
|
|
|
57bc60 |
d->changing_scroll = FALSE;
|
|
|
57bc60 |
|