summaryrefslogtreecommitdiffstats
path: root/debian/patches/Expose-touchpad-settings-if-synaptics-is-in-use.patch
blob: 6f106ada9f204e9771cd728f0b9691fc2dcb4d26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
Date: Fri, 16 Mar 2018 13:53:10 -0400
Subject: [PATCH 01/22] Expose touchpad settings if synaptics is in use

Upstream is aggressively pushing for libinput over synaptics. However that
creates a factually incorrect situation where gnome-control-center thinks
there is no touchpad unless you're using the xserver-xorg-input-libinput.
This patch adds support for both drivers, removing the code that would
hide the touchpad settings when xserver-xorg-input-synaptics is in use.

This patch is only useful in the GNOME on Xorg session.
In GNOME on Wayland, libinput is used anyway.

This patch requires a companion patch in mutter which GNOME has rejected.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/37
---
 panels/mouse/cc-mouse-caps-helper.c |  7 +++++++
 panels/mouse/cc-mouse-panel.c       | 16 +++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/panels/mouse/cc-mouse-caps-helper.c b/panels/mouse/cc-mouse-caps-helper.c
index 69546b2..39534b9 100644
--- a/panels/mouse/cc-mouse-caps-helper.c
+++ b/panels/mouse/cc-mouse-caps-helper.c
@@ -38,6 +38,13 @@ touchpad_check_capabilities_x11 (gboolean *have_two_finger_scrolling,
 	unsigned long nitems, bytes_after;
 	unsigned char *data;
 
+	if (cc_synaptics_check ()) {
+		*have_two_finger_scrolling = TRUE;
+		*have_edge_scrolling = TRUE;
+		*have_tap_to_click = TRUE;
+		return TRUE;
+	}
+
         gdisplay = gdk_display_get_default ();
         display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
 	prop_scroll_methods = XInternAtom (display, "libinput Scroll Methods Available", False);
diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c
index a7f018b..08304bf 100644
--- a/panels/mouse/cc-mouse-panel.c
+++ b/panels/mouse/cc-mouse-panel.c
@@ -68,7 +68,6 @@ struct _CcMousePanel
   gboolean           have_mouse;
   gboolean           have_touchpad;
   gboolean           have_touchscreen;
-  gboolean           have_synaptics;
 
   gboolean           left_handed;
   GtkGesture        *left_gesture;
@@ -86,7 +85,7 @@ setup_touchpad_options (CcMousePanel *self)
   gboolean have_edge_scrolling;
   gboolean have_tap_to_click;
 
-  if (self->have_synaptics || !self->have_touchpad) {
+  if (!self->have_touchpad) {
     gtk_widget_hide (GTK_WIDGET (self->touchpad_frame));
     return;
   }
@@ -308,7 +307,10 @@ setup_dialog (CcMousePanel *self)
 static void
 device_changed (CcMousePanel *self)
 {
-  self->have_touchpad = touchpad_is_present ();
+  self->have_touchpad = touchpad_is_present () || cc_synaptics_check ();
+  /*                                              ^^^^^^^^^^^^^^^^^^^^^
+   *            Workaround https://gitlab.gnome.org/GNOME/gtk/issues/97
+   */
 
   setup_touchpad_options (self);
 
@@ -397,11 +399,11 @@ cc_mouse_panel_init (CcMousePanel *self)
                            G_CALLBACK (device_changed), self, G_CONNECT_SWAPPED);
 
   self->have_mouse = mouse_is_present ();
-  self->have_touchpad = touchpad_is_present ();
+  self->have_touchpad = touchpad_is_present () || cc_synaptics_check ();
+  /*                                              ^^^^^^^^^^^^^^^^^^^^^
+   *            Workaround https://gitlab.gnome.org/GNOME/gtk/issues/97
+   */
   self->have_touchscreen = touchscreen_is_present ();
-  self->have_synaptics = cc_synaptics_check ();
-  if (self->have_synaptics)
-    g_warning ("Detected synaptics X driver, please migrate to libinput");
 
   setup_dialog (self);
 }