Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-misc/wacomtablet/files/, kde-misc/wacomtablet/
Date: Sun, 27 Nov 2022 15:12:43
Message-Id: 1669561937.faad1df7c8ed2a690c3d4e32dc12b00f2f06775e.asturm@gentoo
1 commit: faad1df7c8ed2a690c3d4e32dc12b00f2f06775e
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 27 15:08:13 2022 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 27 15:12:17 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=faad1df7
7
8 kde-misc/wacomtablet: Fix incorrect xsetwacom call
9
10 Tested-by: Tomasz Lemiech <szpajder <AT> gmail.com>
11 Closes: https://bugs.gentoo.org/850652
12 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
13
14 ...tablet-3.2.0-fix-incorrect-xsetwacom-call.patch | 41 ++++++
15 ...omtablet-3.2.0-port-to-QRegularExpression.patch | 143 +++++++++++++++++++++
16 kde-misc/wacomtablet/wacomtablet-3.2.0-r3.ebuild | 72 +++++++++++
17 3 files changed, 256 insertions(+)
18
19 diff --git a/kde-misc/wacomtablet/files/wacomtablet-3.2.0-fix-incorrect-xsetwacom-call.patch b/kde-misc/wacomtablet/files/wacomtablet-3.2.0-fix-incorrect-xsetwacom-call.patch
20 new file mode 100644
21 index 000000000000..9434b0082569
22 --- /dev/null
23 +++ b/kde-misc/wacomtablet/files/wacomtablet-3.2.0-fix-incorrect-xsetwacom-call.patch
24 @@ -0,0 +1,41 @@
25 +From 32c78782b3061bab2a3b1457133faf77b6d9ed2a Mon Sep 17 00:00:00 2001
26 +From: Nicolas Fella <nicolas.fella@×××.de>
27 +Date: Mon, 14 Nov 2022 02:57:07 +0100
28 +Subject: [PATCH] Fix incorrect xsetwacom call
29 +
30 +When param is e.g. 'Button 1' the 'Button' and '1' need to be passed as separate arguments
31 +
32 +BUG: 454947
33 +---
34 + src/kded/xsetwacomadaptor.cpp | 14 +++++++++++---
35 + 1 file changed, 11 insertions(+), 3 deletions(-)
36 +
37 +diff --git a/src/kded/xsetwacomadaptor.cpp b/src/kded/xsetwacomadaptor.cpp
38 +index 934fa8b..fc1bcac 100644
39 +--- a/src/kded/xsetwacomadaptor.cpp
40 ++++ b/src/kded/xsetwacomadaptor.cpp
41 +@@ -245,10 +245,18 @@ bool XsetwacomAdaptor::setRotation(const QString& value)
42 + bool XsetwacomAdaptor::setParameter(const QString &device, const QString &param, const QString &value) const
43 + {
44 + QProcess setConf;
45 +- if (!value.isEmpty()) {
46 +- setConf.start(QString::fromLatin1("xsetwacom"), QStringList() << QString::fromLatin1("set") << device << param << value);
47 ++
48 ++ // https://bugs.kde.org/show_bug.cgi?id=454947
49 ++ static const QRegularExpression buttonWithNumber(QStringLiteral("^Button \\d+$"));
50 ++ if (param.contains(buttonWithNumber)) {
51 ++ const QStringList splitted = param.split(QLatin1Char(' '));
52 ++ setConf.start(QString::fromLatin1("xsetwacom"), QStringList() << QString::fromLatin1("set") << device << splitted[0] << splitted[1] << value);
53 + } else {
54 +- setConf.start(QString::fromLatin1("xsetwacom"), QStringList() << QString::fromLatin1("set") << device << param);
55 ++ if (!value.isEmpty()) {
56 ++ setConf.start(QString::fromLatin1("xsetwacom"), QStringList() << QString::fromLatin1("set") << device << param << value);
57 ++ } else {
58 ++ setConf.start(QString::fromLatin1("xsetwacom"), QStringList() << QString::fromLatin1("set") << device << param);
59 ++ }
60 + }
61 +
62 + if (!setConf.waitForStarted() || !setConf.waitForFinished()) {
63 +--
64 +GitLab
65 +
66
67 diff --git a/kde-misc/wacomtablet/files/wacomtablet-3.2.0-port-to-QRegularExpression.patch b/kde-misc/wacomtablet/files/wacomtablet-3.2.0-port-to-QRegularExpression.patch
68 new file mode 100644
69 index 000000000000..e86f97cfaef4
70 --- /dev/null
71 +++ b/kde-misc/wacomtablet/files/wacomtablet-3.2.0-port-to-QRegularExpression.patch
72 @@ -0,0 +1,143 @@
73 +From 9c2f133ee400562ca9813e329f6e2bdae24a5ac5 Mon Sep 17 00:00:00 2001
74 +From: Nicolas Fella <nicolas.fella@×××.de>
75 +Date: Thu, 4 Aug 2022 22:43:07 +0200
76 +Subject: [PATCH] Port from QRegExp to QRegularExpression
77 +
78 +---
79 + src/common/buttonshortcut.cpp | 33 ++++++++++++++++++++-------------
80 + src/kded/xsetwacomadaptor.cpp | 17 +++++++++++------
81 + 2 files changed, 31 insertions(+), 19 deletions(-)
82 +
83 +diff --git a/src/common/buttonshortcut.cpp b/src/common/buttonshortcut.cpp
84 +index e11784f..32bf842 100644
85 +--- a/src/common/buttonshortcut.cpp
86 ++++ b/src/common/buttonshortcut.cpp
87 +@@ -19,7 +19,7 @@
88 +
89 + #include "buttonshortcut.h"
90 +
91 +-#include <QRegExp>
92 ++#include <QRegularExpression>
93 + #include <QKeySequence>
94 +
95 + #include <KLocalizedString>
96 +@@ -266,8 +266,8 @@ bool ButtonShortcut::set(const QString& sequence)
97 + return true;
98 + }
99 +
100 +- QRegExp modifierRx (QLatin1String("^(?:key )?(?:\\s*\\+?(?:alt|ctrl|meta|shift|super))+$"), Qt::CaseInsensitive);
101 +- QRegExp buttonRx (QLatin1String ("^(?:button\\s+)?\\+?\\d+$"), Qt::CaseInsensitive);
102 ++ static const QRegularExpression modifierRx (QLatin1String("^(?:key )?(?:\\s*\\+?(?:alt|ctrl|meta|shift|super))+$"), QRegularExpression::CaseInsensitiveOption);
103 ++ static const QRegularExpression buttonRx (QLatin1String ("^(?:button\\s+)?\\+?\\d+$"), QRegularExpression::CaseInsensitiveOption);
104 +
105 + if (seq.contains(buttonRx)) {
106 + // this is a button
107 +@@ -388,7 +388,8 @@ void ButtonShortcut::convertToNormalizedKeySequence(QString& sequence, bool from
108 + {
109 + normalizeKeySequence(sequence);
110 +
111 +- QStringList keyList = sequence.split (QRegExp (QLatin1String ("\\s+")), Qt::SkipEmptyParts);
112 ++ static const QRegularExpression rx(QStringLiteral("\\s+"));
113 ++ QStringList keyList = sequence.split (rx, Qt::SkipEmptyParts);
114 + bool isFirstKey = true;
115 +
116 + sequence.clear();
117 +@@ -460,28 +461,33 @@ void ButtonShortcut::normalizeKeySequence(QString& sequence) const
118 + {
119 + // When setting a shortcut like "ctrl+x", xsetwacom will convert it to "key +ctrl +x -x"
120 + // therefore we just truncate the string on the first "-key" we find.
121 +- QRegExp minusKeyRx (QLatin1String ("(^|\\s)-\\S"));
122 +- int pos = 0;
123 ++ static const QRegularExpression minusKeyRx (QLatin1String ("(^|\\s)-\\S"));
124 +
125 +- if ((pos = minusKeyRx.indexIn(sequence, 0)) != -1) {
126 +- sequence = sequence.left(pos);
127 ++ const QRegularExpressionMatch minusKeyRxMatch = minusKeyRx.match(sequence);
128 ++
129 ++ if (minusKeyRxMatch.hasMatch()) {
130 ++ sequence = sequence.left(minusKeyRxMatch.capturedStart());
131 + }
132 +
133 + // cleanup leading "key " identifier from xsetwacom sequences
134 +- sequence.remove(QRegExp (QLatin1String ("^\\s*key\\s+"), Qt::CaseInsensitive));
135 ++ static const QRegularExpression leadingKey(QStringLiteral("^\\s*key\\s+"), QRegularExpression::CaseInsensitiveOption);
136 ++ sequence.remove(leadingKey);
137 +
138 + // Remove all '+' prefixes from keys.
139 + // This will convert shortcuts like "+ctrl +alt" to "ctrl alt", but not
140 + // shortcuts like "ctrl +" which is required to keep compatibility to older
141 + // (buggy) configuration files.
142 +- sequence.replace(QRegExp (QLatin1String ("(^|\\s)\\+(\\S)")), QLatin1String ("\\1\\2"));
143 ++ static const QRegularExpression plusPrefixes(QStringLiteral("(^|\\s)\\+(\\S)"), QRegularExpression::CaseInsensitiveOption);
144 ++ sequence.replace(plusPrefixes, QLatin1String ("\\1\\2"));
145 +
146 + // Cleanup plus signs between keys.
147 + // This will convert shortcuts like "ctrl+alt+shift" or "Ctrl++" to "ctrl alt shift" or "Ctrl +".
148 +- sequence.replace (QRegExp (QLatin1String ("(\\S)\\+(\\S)")), QLatin1String ("\\1 \\2"));
149 ++ static const QRegularExpression cleanupPlus(QStringLiteral("(\\S)\\+(\\S)"), QRegularExpression::CaseInsensitiveOption);
150 ++ sequence.replace (cleanupPlus, QLatin1String ("\\1 \\2"));
151 +
152 + // replace multiple whitespaces with one
153 +- sequence.replace (QRegExp (QLatin1String ("\\s{2,}")), QLatin1String (" "));
154 ++ static const QRegularExpression whitespaces(QStringLiteral("\\s{2,}"), QRegularExpression::CaseInsensitiveOption);
155 ++ sequence.replace (whitespaces, QLatin1String (" "));
156 +
157 + // trim the string
158 + sequence = sequence.trimmed();
159 +@@ -500,7 +506,8 @@ void ButtonShortcut::prettifyKey(QString& key) const
160 + bool ButtonShortcut::setButtonSequence(const QString& buttonSequence)
161 + {
162 + QString buttonNumber = buttonSequence;
163 +- buttonNumber.remove(QRegExp (QLatin1String ("^\\s*button\\s+"), Qt::CaseInsensitive));
164 ++ static const QRegularExpression rx(QStringLiteral("^\\s*button\\s+"), QRegularExpression::CaseInsensitiveOption);
165 ++ buttonNumber.remove(rx);
166 +
167 + bool ok = false;
168 + int button = buttonNumber.toInt(&ok);
169 +diff --git a/src/kded/xsetwacomadaptor.cpp b/src/kded/xsetwacomadaptor.cpp
170 +index a39f307..934fa8b 100644
171 +--- a/src/kded/xsetwacomadaptor.cpp
172 ++++ b/src/kded/xsetwacomadaptor.cpp
173 +@@ -27,7 +27,7 @@
174 + #include "tabletarea.h"
175 +
176 + #include <QProcess>
177 +-#include <QRegExp>
178 ++#include <QRegularExpression>
179 +
180 + using namespace Wacom;
181 +
182 +@@ -142,10 +142,13 @@ const QString XsetwacomAdaptor::convertParameter(const XsetwacomProperty& param)
183 + QString modifiedParam = param.key();
184 +
185 + // convert tablet button number to hardware button number
186 +- QRegExp rx(QLatin1String("^Button\\s*([0-9]+)$"), Qt::CaseInsensitive);
187 ++ static const QRegularExpression rx(QLatin1String("^Button\\s*([0-9]+)$"), QRegularExpression::CaseInsensitiveOption);
188 ++
189 ++ const QRegularExpressionMatch match = rx.match(modifiedParam);
190 ++
191 ++ if (match.hasMatch()) {
192 ++ QString hwButtonNumber = match.captured(1);
193 +
194 +- if (rx.indexIn(modifiedParam, 0) != -1) {
195 +- QString hwButtonNumber = rx.cap(1);
196 + QString kernelButtonNumber;
197 +
198 + if (!d->buttonMap.isEmpty()) {
199 +@@ -167,9 +170,11 @@ const QString XsetwacomAdaptor::convertParameter(const XsetwacomProperty& param)
200 +
201 + void XsetwacomAdaptor::convertButtonShortcut (const XsetwacomProperty& property, QString& value) const
202 + {
203 +- QRegExp rx (QLatin1String("^Button\\s*[0-9]+$"), Qt::CaseInsensitive);
204 ++ static const QRegularExpression rx(QLatin1String("^Button\\s*[0-9]+$"), QRegularExpression::CaseInsensitiveOption);
205 ++
206 ++ const QRegularExpressionMatch match = rx.match(property.key());
207 +
208 +- if (rx.indexIn(property.key(), 0) != -1) {
209 ++ if (match.hasMatch()) {
210 + ButtonShortcut buttonshortcut(value);
211 + value = buttonshortcut.toString();
212 + }
213 +--
214 +GitLab
215 +
216
217 diff --git a/kde-misc/wacomtablet/wacomtablet-3.2.0-r3.ebuild b/kde-misc/wacomtablet/wacomtablet-3.2.0-r3.ebuild
218 new file mode 100644
219 index 000000000000..61cad0cb4037
220 --- /dev/null
221 +++ b/kde-misc/wacomtablet/wacomtablet-3.2.0-r3.ebuild
222 @@ -0,0 +1,72 @@
223 +# Copyright 1999-2022 Gentoo Authors
224 +# Distributed under the terms of the GNU General Public License v2
225 +
226 +EAPI=8
227 +
228 +ECM_HANDBOOK="forceoptional"
229 +KFMIN=5.82.0
230 +QTMIN=5.15.2
231 +VIRTUALX_REQUIRED="test"
232 +inherit ecm kde.org
233 +
234 +DESCRIPTION="System settings module for Wacom tablets"
235 +HOMEPAGE="https://apps.kde.org/wacomtablet/
236 +https://userbase.kde.org/Wacomtablet"
237 +SRC_URI="mirror://kde/stable/${PN}/${PV}/${P}.tar.xz
238 +https://dev.gentoo.org/~asturm/distfiles/${P}-patchset-1.tar.xz"
239 +
240 +LICENSE="GPL-2"
241 +SLOT="5"
242 +KEYWORDS="amd64 x86"
243 +
244 +RDEPEND="
245 + >=dev-libs/libwacom-0.30:=
246 + >=dev-qt/qtdbus-${QTMIN}:5
247 + >=dev-qt/qtdeclarative-${QTMIN}:5
248 + >=dev-qt/qtgui-${QTMIN}:5
249 + >=dev-qt/qtwidgets-${QTMIN}:5
250 + >=dev-qt/qtx11extras-${QTMIN}:5
251 + >=kde-frameworks/kconfig-${KFMIN}:5
252 + >=kde-frameworks/kconfigwidgets-${KFMIN}:5
253 + >=kde-frameworks/kcoreaddons-${KFMIN}:5
254 + >=kde-frameworks/kdbusaddons-${KFMIN}:5
255 + >=kde-frameworks/kglobalaccel-${KFMIN}:5
256 + >=kde-frameworks/ki18n-${KFMIN}:5
257 + >=kde-frameworks/knotifications-${KFMIN}:5
258 + >=kde-frameworks/kwidgetsaddons-${KFMIN}:5
259 + >=kde-frameworks/kwindowsystem-${KFMIN}:5
260 + >=kde-frameworks/kxmlgui-${KFMIN}:5
261 + >=kde-frameworks/plasma-${KFMIN}:5
262 + >=x11-drivers/xf86-input-wacom-0.20.0
263 + x11-libs/libXi
264 + x11-libs/libxcb
265 +"
266 +DEPEND="${RDEPEND}
267 + x11-base/xorg-proto
268 + x11-libs/libX11
269 +"
270 +BDEPEND="sys-devel/gettext"
271 +
272 +PATCHES=(
273 + "${WORKDIR}/${P}-qt-5.15.patch"
274 + "${WORKDIR}/${P}-qt-5.15-obsoletions.patch"
275 + "${WORKDIR}/${P}-no-override-screenspace-w-missing-screen.patch" # KDE-bug 419392
276 + "${WORKDIR}/${P}-fix-xsetwacom-adapter.patch"
277 + "${WORKDIR}/${P}-Intuos-M-bluetooth.patch" # KDE-bug 418827
278 + "${WORKDIR}/${P}-correct-icons.patch"
279 + "${WORKDIR}/${P}-drop-empty-X-KDE-PluginInfo-Depends.patch"
280 + "${WORKDIR}/${P}-fix-QProcess-invocation.patch"
281 + "${WORKDIR}/${P}-turn-off-gesture-support-by-default.patch" # KDE-bug 440556
282 + "${WORKDIR}/${P}-only-show-on-X11.patch"
283 + "${FILESDIR}/${P}-port-to-QRegularExpression.patch" # pre-requisite for below:
284 + "${FILESDIR}/${P}-fix-incorrect-xsetwacom-call.patch" # bug 850652, KDE-bug 454947
285 +)
286 +
287 +src_test() {
288 + # test needs DBus, bug 675548
289 + local myctestargs=(
290 + -E "(Test.KDED.DBusTabletService)"
291 + )
292 +
293 + ecm_src_test
294 +}