aboutsummaryrefslogtreecommitdiffstats
path: root/community/wacomtablet/0002-turn-off-gesture-support-by-default-and-warn-when-turning-it-on-manually.patch
blob: f738eecc12c290d3b6a5c687457182df2e0319ca (plain) (blame)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
From 8f4660611f435aea860072d741cf506262f56347 Mon Sep 17 00:00:00 2001
From: Nate Graham <nate@kde.org>
Date: Tue, 3 Aug 2021 09:44:05 -0600
Subject: [PATCH 1/3] Turn off gesture support by default and warn when turning
 it on manually

Gesture support has been disabled by default upstream to work around an
inherent incompatibility with Wacom-provided gestures and touch support
in Qt; see https://bugreports.qt.io/browse/QTBUG-84756.

However the KCM still has it on by default, and its KDED module
propagates that change to effectively turn gestore support on
automatically. This results in touchscreen touch being broken for all
Qt software by default when this repo is installed.

This commit turns gesture support off by default to match the new
upstream setting and prevent broken touch support in Qt software, and
also shows a warning message about this if the user turns it on
manually.

BUG: 440556
FIXED-IN: 5.23
---
 src/common/deviceprofiledefaults.cpp |  2 +-
 src/kcmodule/touchpagewidget.cpp     | 23 ++++++++++++++++++++++-
 src/kcmodule/touchpagewidget.ui      | 26 ++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/src/common/deviceprofiledefaults.cpp b/src/common/deviceprofiledefaults.cpp
index 1425b1c..066c3cb 100644
--- a/src/common/deviceprofiledefaults.cpp
+++ b/src/common/deviceprofiledefaults.cpp
@@ -44,7 +44,7 @@ void setupDefaultStylus(DeviceProfile &stylus) {
 }
 
 void setupDefaultTouch(DeviceProfile &touch) {
-    touch.setProperty(Property::Gesture, QLatin1String("on"));
+    touch.setProperty(Property::Gesture, QLatin1String("off"));
     touch.setProperty(Property::InvertScroll, QLatin1String("off"));
     touch.setProperty(Property::Mode, QLatin1String("absolute"));
     touch.setProperty(Property::Rotate, ScreenRotation::AUTO.key());
diff --git a/src/kcmodule/touchpagewidget.cpp b/src/kcmodule/touchpagewidget.cpp
index ffe748b..f2facb0 100644
--- a/src/kcmodule/touchpagewidget.cpp
+++ b/src/kcmodule/touchpagewidget.cpp
@@ -28,6 +28,7 @@
 #include "tabletareaselectiondialog.h"
 #include "x11wacom.h"
 
+#include <QDesktopServices>
 #include <QRegExp>
 #include <QStringList>
 
@@ -115,6 +116,12 @@ void TouchPageWidget::saveToProfile(ProfileManagementInterface &profileManagemen
 
 void TouchPageWidget::onGesturesModeChanged(int state)
 {
+    if (state == 0) {
+        ui->gesturesWarning->animatedHide();
+    } else {
+        ui->gesturesWarning->animatedShow();
+    }
+
     setGesturesSupportEnabled(state == Qt::Checked);
     onProfileChanged();
 }
@@ -148,11 +155,18 @@ void TouchPageWidget::onTabletMappingClicked()
 
 void TouchPageWidget::onTouchModeChanged(int state)
 {
+    // Show/hide the gestures warning as needed, since its UI gets enabled and
+    // disabled dynamically when touch is turned on or off
+    if (state == 0) {
+        ui->gesturesWarning->animatedHide();
+    } else if (ui->gesturesCheckBox->isChecked()) {
+        ui->gesturesWarning->animatedShow();
+    }
+
     setTouchSupportEnabled(state == Qt::Checked);
     onProfileChanged();
 }
 
-
 void TouchPageWidget::onTrackingModeAbsolute(bool activated)
 {
     if (!activated) {
@@ -387,4 +401,11 @@ void TouchPageWidget::setupUi()
     ui->trackingWarningIcon->setPixmap(QIcon::fromTheme(QLatin1String("dialog-warning")).pixmap(QSize(16,16)));
     ui->trackingWarningIcon->setVisible(false);
     ui->trackingWarningLabel->setVisible(false);
+
+    // Set this here instead of in the UI file because the string property in
+    // the UI file will strip out HTML tags and break our link
+    const QString bugReportURL = QStringLiteral("https://bugreports.qt.io/browse/QTBUG-84756");
+    ui->gesturesWarning->setText(i18n("Enabling gestures here is known to break touch input using a touchscreen. See <a href=\"%1\">%2</a> for details.", bugReportURL, bugReportURL));
+    // Open the link when the user clicks on it
+    connect(ui->gesturesWarning, &KMessageWidget::linkActivated, this, [](const QString &str) { QDesktopServices::openUrl(QUrl(str)); } );
 }
diff --git a/src/kcmodule/touchpagewidget.ui b/src/kcmodule/touchpagewidget.ui
index 9b5f8df..19d9537 100644
--- a/src/kcmodule/touchpagewidget.ui
+++ b/src/kcmodule/touchpagewidget.ui
@@ -11,6 +11,24 @@
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_9">
+   <item>
+    <widget class="KMessageWidget" name="gesturesWarning">
+     <property name="visible">
+      <bool>false</bool>
+     </property>
+     <property name="closeButtonVisible">
+      <bool>false</bool>
+     </property>
+     <!-- Text is set in the .cpp file  because it has a link in it and HTML
+     markup doesn't get preserved when we insert it here -->
+     <property name="wordWrap">
+      <bool>true</bool>
+     </property>
+     <property name="messageType">
+      <enum>KMessageWidget::Warning</enum>
+     </property>
+    </widget>
+   </item>
    <item>
     <widget class="QCheckBox" name="touchCheckBox">
      <property name="toolTip">
@@ -362,6 +380,14 @@
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KMessageWidget</class>
+   <extends>QFrame</extends>
+   <header>kmessagewidget.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections>
   <connection>
-- 
GitLab


From a35c2fc5b5e1561e4708fa01925806015082344b Mon Sep 17 00:00:00 2001
From: Nate Graham <nate@kde.org>
Date: Fri, 6 Aug 2021 09:14:14 -0600
Subject: [PATCH 2/3] Remove link; simplify message

---
 src/kcmodule/touchpagewidget.cpp | 8 --------
 src/kcmodule/touchpagewidget.ui  | 5 +++--
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/kcmodule/touchpagewidget.cpp b/src/kcmodule/touchpagewidget.cpp
index f2facb0..880b067 100644
--- a/src/kcmodule/touchpagewidget.cpp
+++ b/src/kcmodule/touchpagewidget.cpp
@@ -28,7 +28,6 @@
 #include "tabletareaselectiondialog.h"
 #include "x11wacom.h"
 
-#include <QDesktopServices>
 #include <QRegExp>
 #include <QStringList>
 
@@ -401,11 +400,4 @@ void TouchPageWidget::setupUi()
     ui->trackingWarningIcon->setPixmap(QIcon::fromTheme(QLatin1String("dialog-warning")).pixmap(QSize(16,16)));
     ui->trackingWarningIcon->setVisible(false);
     ui->trackingWarningLabel->setVisible(false);
-
-    // Set this here instead of in the UI file because the string property in
-    // the UI file will strip out HTML tags and break our link
-    const QString bugReportURL = QStringLiteral("https://bugreports.qt.io/browse/QTBUG-84756");
-    ui->gesturesWarning->setText(i18n("Enabling gestures here is known to break touch input using a touchscreen. See <a href=\"%1\">%2</a> for details.", bugReportURL, bugReportURL));
-    // Open the link when the user clicks on it
-    connect(ui->gesturesWarning, &KMessageWidget::linkActivated, this, [](const QString &str) { QDesktopServices::openUrl(QUrl(str)); } );
 }
diff --git a/src/kcmodule/touchpagewidget.ui b/src/kcmodule/touchpagewidget.ui
index 19d9537..9d79a88 100644
--- a/src/kcmodule/touchpagewidget.ui
+++ b/src/kcmodule/touchpagewidget.ui
@@ -13,14 +13,15 @@
   <layout class="QVBoxLayout" name="verticalLayout_9">
    <item>
     <widget class="KMessageWidget" name="gesturesWarning">
+     <property name="text">
+      <string>Enabling gestures may break touch input using a touchscreen.</string>
+     </property>
      <property name="visible">
       <bool>false</bool>
      </property>
      <property name="closeButtonVisible">
       <bool>false</bool>
      </property>
-     <!-- Text is set in the .cpp file  because it has a link in it and HTML
-     markup doesn't get preserved when we insert it here -->
      <property name="wordWrap">
       <bool>true</bool>
      </property>
-- 
GitLab


From be18f8c9e1e70690e0056a6bce297c71fcca62be Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Fri, 6 Aug 2021 16:21:51 +0000
Subject: [PATCH 3/3] Apply 2 suggestion(s) to 1 file(s)

---
 src/kcmodule/touchpagewidget.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/kcmodule/touchpagewidget.cpp b/src/kcmodule/touchpagewidget.cpp
index 880b067..8801bd0 100644
--- a/src/kcmodule/touchpagewidget.cpp
+++ b/src/kcmodule/touchpagewidget.cpp
@@ -115,7 +115,7 @@ void TouchPageWidget::saveToProfile(ProfileManagementInterface &profileManagemen
 
 void TouchPageWidget::onGesturesModeChanged(int state)
 {
-    if (state == 0) {
+    if (state == Qt::Unchecked) {
         ui->gesturesWarning->animatedHide();
     } else {
         ui->gesturesWarning->animatedShow();
@@ -156,7 +156,7 @@ void TouchPageWidget::onTouchModeChanged(int state)
 {
     // Show/hide the gestures warning as needed, since its UI gets enabled and
     // disabled dynamically when touch is turned on or off
-    if (state == 0) {
+    if (state == Qt::Unchecked) {
         ui->gesturesWarning->animatedHide();
     } else if (ui->gesturesCheckBox->isChecked()) {
         ui->gesturesWarning->animatedShow();
-- 
GitLab