summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/input')
-rw-r--r--src/platformsupport/input/CMakeLists.txt103
-rw-r--r--src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri11
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h41
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp90
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h44
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp50
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h40
-rw-r--r--src/platformsupport/input/evdevmouse/evdevmouse.pri11
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp100
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h44
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp52
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h40
-rw-r--r--src/platformsupport/input/evdevtablet/evdevtablet.pri10
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp57
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h40
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp45
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h40
-rw-r--r--src/platformsupport/input/evdevtouch/evdevtouch.pri16
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h44
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp260
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h55
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp47
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h40
-rw-r--r--src/platformsupport/input/input-support.pro35
-rw-r--r--src/platformsupport/input/input.pro8
-rw-r--r--src/platformsupport/input/integrityhid/integrityhid.pri7
-rw-r--r--src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp40
-rw-r--r--src/platformsupport/input/integrityhid/qintegrityhidmanager.h42
-rw-r--r--src/platformsupport/input/libinput/libinput.pri20
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler.cpp46
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler_p.h41
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard.cpp45
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard_p.h40
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp56
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer_p.h41
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch.cpp151
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch_p.h44
-rw-r--r--src/platformsupport/input/shared/devicehandlerlist_p.h41
-rw-r--r--src/platformsupport/input/shared/qevdevutil.cpp50
-rw-r--r--src/platformsupport/input/shared/qevdevutil_p.h47
-rw-r--r--src/platformsupport/input/shared/qoutputmapping.cpp95
-rw-r--r--src/platformsupport/input/shared/qoutputmapping_p.h53
-rw-r--r--src/platformsupport/input/shared/qtouchoutputmapping.cpp91
-rw-r--r--src/platformsupport/input/shared/qtouchoutputmapping_p.h71
-rw-r--r--src/platformsupport/input/shared/shared.pri8
-rw-r--r--src/platformsupport/input/tslib/qtslib.cpp57
-rw-r--r--src/platformsupport/input/tslib/qtslib_p.h43
-rw-r--r--src/platformsupport/input/tslib/tslib.pri7
-rw-r--r--src/platformsupport/input/xkbcommon/qxkbcommon.cpp828
-rw-r--r--src/platformsupport/input/xkbcommon/qxkbcommon_3rdparty.cpp219
-rw-r--r--src/platformsupport/input/xkbcommon/qxkbcommon_p.h122
-rw-r--r--src/platformsupport/input/xkbcommon/xkbcommon.pro23
52 files changed, 718 insertions, 2933 deletions
diff --git a/src/platformsupport/input/CMakeLists.txt b/src/platformsupport/input/CMakeLists.txt
new file mode 100644
index 0000000000..b7ff09d827
--- /dev/null
+++ b/src/platformsupport/input/CMakeLists.txt
@@ -0,0 +1,103 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_find_package(Libinput)
+qt_find_package(XKB)
+qt_find_package(Tslib)
+qt_find_package(Mtdev)
+
+#####################################################################
+## InputSupportPrivate Module:
+#####################################################################
+
+qt_internal_add_module(InputSupportPrivate
+ CONFIG_MODULE_NAME input_support
+ STATIC
+ INTERNAL_MODULE
+ DEFINES
+ QT_NO_CAST_FROM_ASCII
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::DeviceDiscoverySupportPrivate
+ Qt::GuiPrivate
+ PRECOMPILED_HEADER
+ "../../corelib/global/qt_pch.h"
+ NO_GENERATE_CPP_EXPORTS
+)
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_evdev
+ SOURCES
+ evdevkeyboard/qevdevkeyboard_defaultmap_p.h
+ evdevkeyboard/qevdevkeyboardhandler.cpp evdevkeyboard/qevdevkeyboardhandler_p.h
+ evdevkeyboard/qevdevkeyboardmanager.cpp evdevkeyboard/qevdevkeyboardmanager_p.h
+ evdevmouse/qevdevmousehandler.cpp evdevmouse/qevdevmousehandler_p.h
+ evdevmouse/qevdevmousemanager.cpp evdevmouse/qevdevmousemanager_p.h
+ evdevtouch/qevdevtouchhandler.cpp evdevtouch/qevdevtouchhandler_p.h
+ evdevtouch/qevdevtouchfilter_p.h
+ evdevtouch/qevdevtouchmanager.cpp evdevtouch/qevdevtouchmanager_p.h
+ INCLUDE_DIRECTORIES
+ evdevtouch/../shared
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_evdev AND QT_FEATURE_tabletevent
+ SOURCES
+ evdevtablet/qevdevtablethandler.cpp evdevtablet/qevdevtablethandler_p.h
+ evdevtablet/qevdevtabletmanager.cpp evdevtablet/qevdevtabletmanager_p.h
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_evdev AND QT_FEATURE_libudev AND QT_FEATURE_tabletevent
+ LIBRARIES
+ PkgConfig::Libudev
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_evdev AND QT_FEATURE_libudev
+ LIBRARIES
+ PkgConfig::Libudev
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_evdev AND QT_FEATURE_mtdev
+ LIBRARIES
+ PkgConfig::Mtdev
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_tslib
+ SOURCES
+ tslib/qtslib.cpp tslib/qtslib_p.h
+ PUBLIC_LIBRARIES
+ PkgConfig::Tslib
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_libinput
+ SOURCES
+ libinput/qlibinputhandler.cpp libinput/qlibinputhandler_p.h
+ libinput/qlibinputkeyboard.cpp libinput/qlibinputkeyboard_p.h
+ libinput/qlibinputpointer.cpp libinput/qlibinputpointer_p.h
+ libinput/qlibinputtouch.cpp libinput/qlibinputtouch_p.h
+ INCLUDE_DIRECTORIES
+ libinput/../shared
+ LIBRARIES
+ Libinput::Libinput
+ PkgConfig::Libudev
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_libinput AND QT_FEATURE_xkbcommon
+ LIBRARIES
+ XKB::XKB
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_evdev OR QT_FEATURE_libinput
+ SOURCES
+ shared/devicehandlerlist_p.h
+ shared/qevdevutil.cpp shared/qevdevutil_p.h
+ shared/qoutputmapping.cpp shared/qoutputmapping_p.h
+)
+
+qt_internal_extend_target(InputSupportPrivate CONDITION QT_FEATURE_integrityhid
+ SOURCES
+ integrityhid/qintegrityhidmanager.cpp integrityhid/qintegrityhidmanager.h
+ LIBRARIES
+ integrityhid
+)
diff --git a/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri b/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri
deleted file mode 100644
index 445f230fa5..0000000000
--- a/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-HEADERS += \
- $$PWD/qevdevkeyboard_defaultmap_p.h \
- $$PWD/qevdevkeyboardhandler_p.h \
- $$PWD/qevdevkeyboardmanager_p.h
-
-SOURCES += \
- $$PWD/qevdevkeyboardhandler.cpp \
- $$PWD/qevdevkeyboardmanager.cpp
-
-qtConfig(libudev): \
- QMAKE_USE_PRIVATE += libudev
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h
index 17bf0fb797..02ed8463e3 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVKEYBOARDHANDLER_DEFAULTMAP_P_H
#define QEVDEVKEYBOARDHANDLER_DEFAULTMAP_P_H
@@ -52,6 +16,7 @@
//
#include "qnamespace.h"
+#include "private/qglobal_p.h"
#ifdef Q_OS_FREEBSD
#include <dev/evdev/input.h>
#else
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index 3555763b89..48fba79958 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -1,43 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevkeyboardhandler_p.h"
+#include "qoutputmapping_p.h"
#include <qplatformdefs.h>
@@ -58,8 +23,18 @@
#include <linux/input.h>
#endif
+#ifndef input_event_sec
+#define input_event_sec time.tv_sec
+#endif
+
+#ifndef input_event_usec
+#define input_event_usec time.tv_usec
+#endif
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(qLcEvdevKey, "qt.qpa.input")
Q_LOGGING_CATEGORY(qLcEvdevKeyMap, "qt.qpa.input.keymap")
@@ -81,7 +56,7 @@ QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer
{
qCDebug(qLcEvdevKey) << "Create keyboard handler with for device" << device;
- setObjectName(QLatin1String("LinuxInput Keyboard Handler"));
+ setObjectName("LinuxInput Keyboard Handler"_L1);
memset(m_locks, 0, sizeof(m_locks));
@@ -112,25 +87,29 @@ std::unique_ptr<QEvdevKeyboardHandler> QEvdevKeyboardHandler::create(const QStri
bool enableCompose = false;
int grab = 0;
- const auto args = specification.splitRef(QLatin1Char(':'));
- for (const QStringRef &arg : args) {
- if (arg.startsWith(QLatin1String("keymap=")))
+ const auto args = QStringView{specification}.split(u':');
+ for (const auto &arg : args) {
+ if (arg.startsWith("keymap="_L1))
keymapFile = arg.mid(7).toString();
- else if (arg == QLatin1String("disable-zap"))
+ else if (arg == "disable-zap"_L1)
disableZap = true;
- else if (arg == QLatin1String("enable-compose"))
+ else if (arg == "enable-compose"_L1)
enableCompose = true;
- else if (arg.startsWith(QLatin1String("repeat-delay=")))
+ else if (arg.startsWith("repeat-delay="_L1))
repeatDelay = arg.mid(13).toInt();
- else if (arg.startsWith(QLatin1String("repeat-rate=")))
+ else if (arg.startsWith("repeat-rate="_L1))
repeatRate = arg.mid(12).toInt();
- else if (arg.startsWith(QLatin1String("grab=")))
+ else if (arg.startsWith("grab="_L1))
grab = arg.mid(5).toInt();
}
qCDebug(qLcEvdevKey, "Opening keyboard at %ls", qUtf16Printable(device));
- QFdContainer fd(qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0));
+ QFdContainer fd(qt_safe_open(device.toLocal8Bit().constData(), O_RDWR | O_NDELAY, 0));
+ if (fd.get() < 0) {
+ qCDebug(qLcEvdevKey, "Keyboard device could not be opened as read-write, trying read-only");
+ fd.reset(qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0));
+ }
if (fd.get() >= 0) {
::ioctl(fd.get(), EVIOCGRAB, grab);
if (repeatDelay > 0 && repeatRate > 0) {
@@ -149,8 +128,11 @@ void QEvdevKeyboardHandler::switchLed(int led, bool state)
{
qCDebug(qLcEvdevKey, "switchLed %d %d", led, int(state));
+ struct timeval tv;
+ ::gettimeofday(&tv, 0);
struct ::input_event led_ie;
- ::gettimeofday(&led_ie.time, 0);
+ led_ie.input_event_sec = tv.tv_sec;
+ led_ie.input_event_usec = tv.tv_usec;
led_ie.type = EV_LED;
led_ie.code = led;
led_ie.value = state;
@@ -229,7 +211,11 @@ void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtc
if (!autoRepeat)
QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(QEvdevKeyboardHandler::toQtModifiers(m_modifiers));
- QWindowSystemInterface::handleExtendedKeyEvent(0, (isPress ? QEvent::KeyPress : QEvent::KeyRelease),
+ QWindow *window = nullptr;
+#ifdef Q_OS_WEBOS
+ window = QOutputMapping::get()->windowForDeviceNode(m_device);
+#endif
+ QWindowSystemInterface::handleExtendedKeyEvent(window, (isPress ? QEvent::KeyPress : QEvent::KeyRelease),
qtcode, modifiers, nativecode + 8, 0, int(modifiers),
(unicode != 0xffff ) ? QString(QChar(unicode)) : QString(), autoRepeat);
}
@@ -239,8 +225,8 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
KeycodeAction result = None;
bool first_press = pressed && !autorepeat;
- const QEvdevKeyboardMap::Mapping *map_plain = 0;
- const QEvdevKeyboardMap::Mapping *map_withmod = 0;
+ const QEvdevKeyboardMap::Mapping *map_plain = nullptr;
+ const QEvdevKeyboardMap::Mapping *map_withmod = nullptr;
quint8 modifiers = m_modifiers;
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
index f92a2bf704..1d991e2ba5 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVKEYBOARDHANDLER_P_H
#define QEVDEVKEYBOARDHANDLER_P_H
@@ -54,6 +18,7 @@
#include <qobject.h>
#include <QTimer>
#include <QDataStream>
+#include <private/qglobal_p.h>
#include <memory>
@@ -136,13 +101,14 @@ class QFdContainer
int m_fd;
Q_DISABLE_COPY_MOVE(QFdContainer);
public:
- explicit QFdContainer(int fd = -1) noexcept : m_fd(fd) {}
+ Q_NODISCARD_CTOR explicit QFdContainer(int fd = -1) noexcept : m_fd(fd) {}
~QFdContainer() { reset(); }
int get() const noexcept { return m_fd; }
int release() noexcept { int result = m_fd; m_fd = -1; return result; }
void reset() noexcept;
+ void reset(int fd) { reset(); m_fd = fd; }
};
class QEvdevKeyboardHandler : public QObject
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
index 52d9c34b1c..43717c4e81 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevkeyboardmanager_p.h"
@@ -50,6 +14,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_DECLARE_LOGGING_CATEGORY(qLcEvdevKey)
QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent)
@@ -67,7 +33,7 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
m_spec = std::move(parsed.spec);
// add all keyboards for devices specified in the argument list
- for (const QString &device : qAsConst(parsed.devices))
+ for (const QString &device : std::as_const(parsed.devices))
addKeyboard(device);
if (parsed.devices.isEmpty()) {
@@ -124,9 +90,9 @@ void QEvdevKeyboardManager::loadKeymap(const QString &file)
// Restore the default, which is either the built-in keymap or
// the one given in the plugin spec.
QString keymapFromSpec;
- const auto specs = m_spec.splitRef(QLatin1Char(':'));
- for (const QStringRef &arg : specs) {
- if (arg.startsWith(QLatin1String("keymap=")))
+ const auto specs = QStringView{m_spec}.split(u':');
+ for (const auto &arg : specs) {
+ if (arg.startsWith("keymap="_L1))
keymapFromSpec = arg.mid(7).toString();
}
for (const auto &keyboard : m_keyboards) {
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
index d91da330c3..d3f75f8367 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVKEYBOARDMANAGER_P_H
#define QEVDEVKEYBOARDMANAGER_P_H
diff --git a/src/platformsupport/input/evdevmouse/evdevmouse.pri b/src/platformsupport/input/evdevmouse/evdevmouse.pri
deleted file mode 100644
index a8c9c663f3..0000000000
--- a/src/platformsupport/input/evdevmouse/evdevmouse.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-HEADERS += \
- $$PWD/qevdevmousehandler_p.h \
- $$PWD/qevdevmousemanager_p.h
-
-SOURCES += \
- $$PWD/qevdevmousehandler.cpp \
- $$PWD/qevdevmousemanager.cpp
-
-qtConfig(libudev): \
- QMAKE_USE_PRIVATE += libudev
-
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
index a729eeb851..8d98cb1e8c 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevmousehandler_p.h"
@@ -64,6 +28,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(qLcEvdevMouse, "qt.qpa.input")
std::unique_ptr<QEvdevMouseHandler> QEvdevMouseHandler::create(const QString &device, const QString &specification)
@@ -75,15 +41,15 @@ std::unique_ptr<QEvdevMouseHandler> QEvdevMouseHandler::create(const QString &de
int grab = 0;
bool abs = false;
- const auto args = specification.splitRef(QLatin1Char(':'));
- for (const QStringRef &arg : args) {
- if (arg == QLatin1String("nocompress"))
+ const auto args = QStringView{specification}.split(u':');
+ for (const auto &arg : args) {
+ if (arg == "nocompress"_L1)
compression = false;
- else if (arg.startsWith(QLatin1String("dejitter=")))
+ else if (arg.startsWith("dejitter="_L1))
jitterLimit = arg.mid(9).toInt();
- else if (arg.startsWith(QLatin1String("grab=")))
+ else if (arg.startsWith("grab="_L1))
grab = arg.mid(5).toInt();
- else if (arg == QLatin1String("abs"))
+ else if (arg == "abs"_L1)
abs = true;
}
@@ -101,7 +67,7 @@ std::unique_ptr<QEvdevMouseHandler> QEvdevMouseHandler::create(const QString &de
QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs, bool compression, int jitterLimit)
: m_device(device), m_fd(fd), m_abs(abs), m_compression(compression)
{
- setObjectName(QLatin1String("Evdev Mouse Handler"));
+ setObjectName("Evdev Mouse Handler"_L1);
m_jitterLimitSquared = jitterLimit * jitterLimit;
@@ -113,6 +79,8 @@ QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs,
if (m_abs)
m_abs = getHardwareMaximum();
+ detectHiResWheelSupport();
+
// socket notifier for events on the mouse device
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
connect(m_notify, &QSocketNotifier::activated,
@@ -125,6 +93,25 @@ QEvdevMouseHandler::~QEvdevMouseHandler()
qt_safe_close(m_fd);
}
+void QEvdevMouseHandler::detectHiResWheelSupport()
+{
+#if defined(REL_WHEEL_HI_RES) || defined(REL_HWHEEL_HI_RES)
+ // Check if we can expect hires events as we will get both
+ // legacy and hires event and needs to know if we should
+ // ignore the legacy events.
+ unsigned char relFeatures[(REL_MAX / 8) + 1]{};
+ if (ioctl(m_fd, EVIOCGBIT(EV_REL, sizeof (relFeatures)), relFeatures) == -1)
+ return;
+
+#if defined(REL_WHEEL_HI_RES)
+ m_hiResWheel = TEST_BIT(relFeatures, REL_WHEEL_HI_RES);
+#endif
+#if defined(REL_HWHEEL_HI_RES)
+ m_hiResHWheel = TEST_BIT(relFeatures, REL_HWHEEL_HI_RES);
+#endif
+#endif
+}
+
// Ask touch screen hardware for information on coordinate maximums
// If any ioctls fail, revert to non abs mode
bool QEvdevMouseHandler::getHardwareMaximum()
@@ -183,7 +170,10 @@ void QEvdevMouseHandler::sendMouseEvent()
m_prevInvalid = false;
}
- emit handleMouseEvent(x, y, m_abs, m_buttons, m_button, m_eventType);
+ if (m_eventType == QEvent::MouseMove)
+ emit handleMouseEvent(x, y, m_abs, m_buttons, Qt::NoButton, m_eventType);
+ else
+ emit handleMouseEvent(x, y, m_abs, m_buttons, m_button, m_eventType);
m_prevx = m_x;
m_prevy = m_y;
@@ -195,7 +185,6 @@ void QEvdevMouseHandler::readMouseData()
int n = 0;
bool posChanged = false, btnChanged = false;
bool pendingMouseEvent = false;
- int eventCompressCount = 0;
forever {
int result = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
@@ -243,14 +232,24 @@ void QEvdevMouseHandler::readMouseData()
} else if (data->code == REL_Y) {
m_y += data->value;
posChanged = true;
- } else if (data->code == ABS_WHEEL) { // vertical scroll
+ } else if (!m_hiResWheel && data->code == REL_WHEEL) {
// data->value: positive == up, negative == down
delta.setY(120 * data->value);
emit handleWheelEvent(delta);
- } else if (data->code == ABS_THROTTLE) { // horizontal scroll
+#ifdef REL_WHEEL_HI_RES
+ } else if (data->code == REL_WHEEL_HI_RES) {
+ delta.setY(data->value);
+ emit handleWheelEvent(delta);
+#endif
+ } else if (!m_hiResHWheel && data->code == REL_HWHEEL) {
// data->value: positive == right, negative == left
delta.setX(-120 * data->value);
emit handleWheelEvent(delta);
+#ifdef REL_HWHEEL_HI_RES
+ } else if (data->code == REL_HWHEEL_HI_RES) {
+ delta.setX(-data->value);
+ emit handleWheelEvent(delta);
+#endif
}
} else if (data->type == EV_KEY && data->code == BTN_TOUCH) {
// We care about touchpads only, not touchscreens -> don't map to button press.
@@ -292,7 +291,6 @@ void QEvdevMouseHandler::readMouseData()
posChanged = false;
if (m_compression) {
pendingMouseEvent = true;
- eventCompressCount++;
} else {
sendMouseEvent();
}
@@ -310,3 +308,5 @@ void QEvdevMouseHandler::readMouseData()
}
QT_END_NAMESPACE
+
+#include "moc_qevdevmousehandler_p.cpp"
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
index 93314e885f..a49ff10256 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVMOUSEHANDLER_P_H
#define QEVDEVMOUSEHANDLER_P_H
@@ -55,6 +19,7 @@
#include <QString>
#include <QPoint>
#include <QEvent>
+#include <private/qglobal_p.h>
#include <memory>
@@ -81,6 +46,7 @@ private:
void sendMouseEvent();
bool getHardwareMaximum();
+ void detectHiResWheelSupport();
QString m_device;
int m_fd;
@@ -89,6 +55,8 @@ private:
int m_prevx = 0, m_prevy = 0;
bool m_abs;
bool m_compression;
+ bool m_hiResWheel = false;
+ bool m_hiResHWheel = false;
Qt::MouseButtons m_buttons;
Qt::MouseButton m_button;
QEvent::Type m_eventType;
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
index daa52d690e..55b127ef17 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevmousemanager_p.h"
@@ -53,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_DECLARE_LOGGING_CATEGORY(qLcEvdevMouse)
QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent)
@@ -68,16 +34,16 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
auto parsed = QEvdevUtil::parseSpecification(spec);
m_spec = std::move(parsed.spec);
- for (const QStringRef &arg : qAsConst(parsed.args)) {
- if (arg.startsWith(QLatin1String("xoffset="))) {
+ for (const auto &arg : std::as_const(parsed.args)) {
+ if (arg.startsWith("xoffset="_L1)) {
m_xoffset = arg.mid(8).toInt();
- } else if (arg.startsWith(QLatin1String("yoffset="))) {
+ } else if (arg.startsWith("yoffset="_L1)) {
m_yoffset = arg.mid(8).toInt();
}
}
// add all mice for devices specified in the argument list
- for (const QString &device : qAsConst(parsed.devices))
+ for (const QString &device : std::as_const(parsed.devices))
addMouse(device);
if (parsed.devices.isEmpty()) {
@@ -96,7 +62,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
}
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
- connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [this](const QPoint &pos) {
+ connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, this, [this](const QPoint &pos) {
m_x = pos.x();
m_y = pos.y();
clampPosition();
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
index f5c32ed8b5..5467513cd4 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVMOUSEMANAGER_P_H
#define QEVDEVMOUSEMANAGER_P_H
diff --git a/src/platformsupport/input/evdevtablet/evdevtablet.pri b/src/platformsupport/input/evdevtablet/evdevtablet.pri
deleted file mode 100644
index ea1712ad2f..0000000000
--- a/src/platformsupport/input/evdevtablet/evdevtablet.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-HEADERS += \
- $$PWD/qevdevtablethandler_p.h \
- $$PWD/qevdevtabletmanager_p.h
-
-SOURCES += \
- $$PWD/qevdevtablethandler.cpp \
- $$PWD/qevdevtabletmanager.cpp
-
-qtConfig(libudev): \
- QMAKE_USE_PRIVATE += libudev
diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
index c86840b76c..109ab0f212 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
+++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
@@ -1,47 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevtablethandler_p.h"
#include <QStringList>
#include <QSocketNotifier>
#include <QGuiApplication>
+#include <QPointingDevice>
#include <QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
#include <qpa/qwindowsysteminterface.h>
@@ -53,6 +18,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(qLcEvdevTablet, "qt.qpa.input")
class QEvdevTabletData
@@ -114,10 +81,10 @@ void QEvdevTabletData::processInputEvent(input_event *ev)
state.down = ev->value != 0;
break;
case BTN_TOOL_PEN:
- state.tool = ev->value ? QTabletEvent::Pen : 0;
+ state.tool = ev->value ? int(QPointingDevice::PointerType::Pen) : 0;
break;
case BTN_TOOL_RUBBER:
- state.tool = ev->value ? QTabletEvent::Eraser : 0;
+ state.tool = ev->value ? int(QPointingDevice::PointerType::Eraser) : 0;
break;
default:
break;
@@ -131,7 +98,7 @@ void QEvdevTabletData::processInputEvent(input_event *ev)
void QEvdevTabletData::report()
{
if (!state.lastReportTool && state.tool)
- QWindowSystemInterface::handleTabletEnterProximityEvent(QTabletEvent::Stylus, state.tool, q->deviceId());
+ QWindowSystemInterface::handleTabletEnterProximityEvent(int(QInputDevice::DeviceType::Stylus), state.tool, q->deviceId());
qreal nx = (state.x - minValues.x) / qreal(maxValues.x - minValues.x);
qreal ny = (state.y - minValues.y) / qreal(maxValues.y - minValues.y);
@@ -150,14 +117,14 @@ void QEvdevTabletData::report()
if (state.down || state.lastReportDown) {
QWindowSystemInterface::handleTabletEvent(0, QPointF(), globalPos,
- QTabletEvent::Stylus, pointer,
+ int(QInputDevice::DeviceType::Stylus), pointer,
state.down ? Qt::LeftButton : Qt::NoButton,
pressure, 0, 0, 0, 0, 0, q->deviceId(),
qGuiApp->keyboardModifiers());
}
if (state.lastReportTool && !state.tool)
- QWindowSystemInterface::handleTabletLeaveProximityEvent(QTabletEvent::Stylus, state.tool, q->deviceId());
+ QWindowSystemInterface::handleTabletLeaveProximityEvent(int(QInputDevice::DeviceType::Stylus), state.tool, q->deviceId());
state.lastReportDown = state.down;
state.lastReportTool = state.tool;
@@ -168,9 +135,9 @@ void QEvdevTabletData::report()
QEvdevTabletHandler::QEvdevTabletHandler(const QString &device, const QString &spec, QObject *parent)
: QObject(parent), m_fd(-1), m_device(device), m_notifier(0), d(0)
{
- Q_UNUSED(spec)
+ Q_UNUSED(spec);
- setObjectName(QLatin1String("Evdev Tablet Handler"));
+ setObjectName("Evdev Tablet Handler"_L1);
qCDebug(qLcEvdevTablet, "evdevtablet: using %ls", qUtf16Printable(device));
diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
index b83bb21258..205d629397 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
+++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVTABLETHANDLER_P_H
#define QEVDEVTABLETHANDLER_P_H
diff --git a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
index d9888c5b97..a270f9700d 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
+++ b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevtabletmanager_p.h"
#include "qevdevtablethandler_p.h"
@@ -48,7 +12,6 @@
#include <QtDeviceDiscoverySupport/private/qdevicediscovery_p.h>
#include <private/qguiapplication_p.h>
#include <private/qinputdevicemanager_p_p.h>
-#include <private/qmemory_p.h>
QT_BEGIN_NAMESPACE
@@ -70,7 +33,7 @@ QEvdevTabletManager::QEvdevTabletManager(const QString &key, const QString &spec
auto parsed = QEvdevUtil::parseSpecification(spec);
m_spec = std::move(parsed.spec);
- for (const QString &device : qAsConst(parsed.devices))
+ for (const QString &device : std::as_const(parsed.devices))
addDevice(device);
// when no devices specified, use device discovery to scan and monitor
@@ -96,7 +59,7 @@ QEvdevTabletManager::~QEvdevTabletManager()
void QEvdevTabletManager::addDevice(const QString &deviceNode)
{
qCDebug(qLcEvdevTablet, "Adding device at %ls", qUtf16Printable(deviceNode));
- auto handler = qt_make_unique<QEvdevTabletHandlerThread>(deviceNode, m_spec);
+ auto handler = std::make_unique<QEvdevTabletHandlerThread>(deviceNode, m_spec);
if (handler) {
m_activeDevices.add(deviceNode, std::move(handler));
updateDeviceCount();
diff --git a/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h b/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h
index bb18ffba04..08bc2cfaa4 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h
+++ b/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVTABLETMANAGER_P_H
#define QEVDEVTABLETMANAGER_P_H
diff --git a/src/platformsupport/input/evdevtouch/evdevtouch.pri b/src/platformsupport/input/evdevtouch/evdevtouch.pri
deleted file mode 100644
index 0ad236e882..0000000000
--- a/src/platformsupport/input/evdevtouch/evdevtouch.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-HEADERS += \
- $$PWD/qevdevtouchhandler_p.h \
- $$PWD/qevdevtouchmanager_p.h
-
-SOURCES += \
- $$PWD/qevdevtouchhandler.cpp \
- $$PWD/qevdevtouchmanager.cpp
-
-INCLUDEPATH += $$PWD/../shared
-
-qtConfig(libudev): \
- QMAKE_USE_PRIVATE += libudev
-
-qtConfig(mtdev) {
- QMAKE_USE_PRIVATE += mtdev
-}
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h
index ff6085d725..9d181dc651 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchfilter_p.h
@@ -1,43 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qglobal.h>
+// Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <private/qglobal_p.h>
//
// W A R N I N G
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 78728ef4ce..1b0da6297b 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -1,54 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevtouchhandler_p.h"
-#include "qtouchoutputmapping_p.h"
+#include "qoutputmapping_p.h"
#include <QStringList>
#include <QHash>
#include <QSocketNotifier>
#include <QGuiApplication>
-#include <QTouchDevice>
#include <QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
+#include <QtGui/qpointingdevice.h>
#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qpointingdevice_p.h>
+
+#include <QtCore/qpointer.h>
#include <mutex>
@@ -58,6 +25,14 @@
#include <linux/input.h>
#endif
+#ifndef input_event_sec
+#define input_event_sec time.tv_sec
+#endif
+
+#ifndef input_event_usec
+#define input_event_usec time.tv_usec
+#endif
+
#include <math.h>
#if QT_CONFIG(mtdev)
@@ -68,6 +43,8 @@ extern "C" {
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(qLcEvdevTouch, "qt.qpa.input")
Q_LOGGING_CATEGORY(qLcEvents, "qt.qpa.input.events")
@@ -118,8 +95,7 @@ public:
int y = 0;
int maj = -1;
int pressure = 0;
- Qt::TouchPointState state = Qt::TouchPointPressed;
- QTouchEvent::TouchPoint::InfoFlags flags;
+ QEventPoint::State state = QEventPoint::State::Pressed;
};
QHash<int, Contact> m_contacts; // The key is a tracking id for type A, slot number for type B.
QHash<int, Contact> m_lastContacts;
@@ -130,7 +106,7 @@ public:
double m_lastTimeStamp;
int findClosestContact(const QHash<int, Contact> &contacts, int x, int y, int *dist);
- void addTouchPoint(const Contact &contact, Qt::TouchPointStates *combinedStates);
+ void addTouchPoint(const Contact &contact, QEventPoint::States *combinedStates);
void reportPoints();
void loadMultiScreenMappings();
@@ -176,12 +152,12 @@ QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, co
m_filtered(false), m_prediction(0)
{
for (const QString &arg : args) {
- if (arg == QStringLiteral("force_window"))
+ if (arg == u"force_window")
m_forceToActiveWindow = true;
- else if (arg == QStringLiteral("filtered"))
+ else if (arg == u"filtered")
m_filtered = true;
- else if (arg.startsWith(QStringLiteral("prediction=")))
- m_prediction = arg.mid(11).toInt();
+ else if (const QStringView prefix = u"prediction="; arg.startsWith(prefix))
+ m_prediction = QStringView(arg).mid(prefix.size()).toInt();
}
}
@@ -201,15 +177,15 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
, m_mtdev(nullptr)
#endif
{
- setObjectName(QLatin1String("Evdev Touch Handler"));
+ setObjectName("Evdev Touch Handler"_L1);
- const QStringList args = spec.split(QLatin1Char(':'));
+ const QStringList args = spec.split(u':');
int rotationAngle = 0;
bool invertx = false;
bool inverty = false;
- for (int i = 0; i < args.count(); ++i) {
- if (args.at(i).startsWith(QLatin1String("rotate"))) {
- QString rotateArg = args.at(i).section(QLatin1Char('='), 1, 1);
+ for (int i = 0; i < args.size(); ++i) {
+ if (args.at(i).startsWith("rotate"_L1)) {
+ QString rotateArg = args.at(i).section(u'=', 1, 1);
bool ok;
uint argValue = rotateArg.toUInt(&ok);
if (ok) {
@@ -218,13 +194,14 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
case 180:
case 270:
rotationAngle = argValue;
+ break;
default:
break;
}
}
- } else if (args.at(i) == QLatin1String("invertx")) {
+ } else if (args.at(i) == "invertx"_L1) {
invertx = true;
- } else if (args.at(i) == QLatin1String("inverty")) {
+ } else if (args.at(i) == "inverty"_L1) {
inverty = true;
}
}
@@ -247,6 +224,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
if (mtdeverr) {
qWarning("evdevtouch: mtdev_open failed: %d", mtdeverr);
QT_CLOSE(m_fd);
+ free(m_mtdev);
return;
}
#endif
@@ -314,7 +292,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
}
// Fix up the coordinate ranges for am335x in case the kernel driver does not have them fixed.
- if (d->hw_name == QLatin1String("ti-tsc")) {
+ if (d->hw_name == "ti-tsc"_L1) {
if (d->hw_range_x_min == 0 && d->hw_range_x_max == 4095) {
d->hw_range_x_min = 165;
d->hw_range_x_max = 4016;
@@ -342,15 +320,15 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
if (inverty)
d->m_rotate *= QTransform::fromTranslate(0.5, 0.5).scale(1.0, -1.0).translate(-0.5, -0.5);
- QTouchOutputMapping mapping;
- if (mapping.load()) {
- d->m_screenName = mapping.screenNameForDeviceNode(d->deviceNode);
+ QOutputMapping *mapping = QOutputMapping::get();
+ if (mapping->load()) {
+ d->m_screenName = mapping->screenNameForDeviceNode(d->deviceNode);
if (!d->m_screenName.isEmpty())
qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %ls to screen %ls",
qUtf16Printable(d->deviceNode), qUtf16Printable(d->m_screenName));
}
- registerTouchDevice();
+ registerPointingDevice();
}
QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
@@ -367,7 +345,7 @@ QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
delete d;
- unregisterTouchDevice();
+ unregisterPointingDevice();
}
bool QEvdevTouchScreenHandler::isFiltered() const
@@ -375,7 +353,7 @@ bool QEvdevTouchScreenHandler::isFiltered() const
return d && d->m_filtered;
}
-QTouchDevice *QEvdevTouchScreenHandler::touchDevice() const
+QPointingDevice *QEvdevTouchScreenHandler::touchDevice() const
{
return m_device;
}
@@ -436,48 +414,82 @@ err:
QT_CLOSE(m_fd);
m_fd = -1;
- unregisterTouchDevice();
+ unregisterPointingDevice();
}
return;
}
}
}
-void QEvdevTouchScreenHandler::registerTouchDevice()
+void QEvdevTouchScreenHandler::registerPointingDevice()
{
if (m_device)
return;
- m_device = new QTouchDevice;
- m_device->setName(d->hw_name);
- m_device->setType(QTouchDevice::TouchScreen);
- m_device->setCapabilities(QTouchDevice::Position | QTouchDevice::Area);
+ static int id = 1;
+ QPointingDevice::Capabilities caps = QPointingDevice::Capability::Position | QPointingDevice::Capability::Area;
if (d->hw_pressure_max > d->hw_pressure_min)
- m_device->setCapabilities(m_device->capabilities() | QTouchDevice::Pressure);
+ caps.setFlag(QPointingDevice::Capability::Pressure);
+
+ // TODO get evdev ID instead of an incremeting number; set USB ID too
+ m_device = new QPointingDevice(d->hw_name, id++,
+ QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger,
+ caps, 16, 0);
+
+ auto geom = d->screenGeometry();
+ if (!geom.isNull())
+ QPointingDevicePrivate::get(m_device)->setAvailableVirtualGeometry(geom);
- QWindowSystemInterface::registerTouchDevice(m_device);
+ QWindowSystemInterface::registerInputDevice(m_device);
}
-void QEvdevTouchScreenHandler::unregisterTouchDevice()
+/*! \internal
+
+ QEvdevTouchScreenHandler::unregisterPointingDevice can be called by several cases.
+
+ First of all, the case that an application is terminated, and destroy all input devices
+ immediately to unregister in this case.
+
+ Secondly, the case that removing a device without touch events for the device while the
+ application is still running. In this case, the destructor of QEvdevTouchScreenHandler from
+ the connection with QDeviceDiscovery::deviceRemoved in QEvdevTouchManager calls this method.
+ And this method moves a device into the main thread and then deletes it later but there is no
+ touch events for the device so that the device would be deleted in appropriate time.
+
+ Finally, this case is similar as the second one but with touch events, that is, a device is
+ removed while touch events are given to the device and the application is still running.
+ In this case, this method is called by readData with ENODEV error and the destructor of
+ QEvdevTouchScreenHandler. So in order to prevent accessing the device which is already nullptr,
+ check the nullity of a device first. And as same as the second case, move the device into the
+ main thread and then delete it later. But in this case, cannot guarantee which event is
+ handled first since the list or queue where posting QDeferredDeleteEvent and appending touch
+ events are different.
+ If touch events are handled first, there is no problem because the device which is used for
+ these events is registered. However if QDeferredDeleteEvent for deleting the device is
+ handled first, this may cause a crash due to using unregistered device when processing touch
+ events later. In order to prevent processing such touch events, check a device which is used
+ for touch events is registered when processing touch events.
+
+ see QGuiApplicationPrivate::processTouchEvent().
+ */
+void QEvdevTouchScreenHandler::unregisterPointingDevice()
{
if (!m_device)
return;
- // At app exit the cleanup may have already been done, avoid
- // double delete by checking the list first.
- if (QWindowSystemInterface::isTouchDeviceRegistered(m_device)) {
- QWindowSystemInterface::unregisterTouchDevice(m_device);
+ if (QGuiApplication::instance()) {
+ m_device->moveToThread(QGuiApplication::instance()->thread());
+ m_device->deleteLater();
+ } else {
delete m_device;
}
-
m_device = nullptr;
}
-void QEvdevTouchScreenData::addTouchPoint(const Contact &contact, Qt::TouchPointStates *combinedStates)
+void QEvdevTouchScreenData::addTouchPoint(const Contact &contact, QEventPoint::States *combinedStates)
{
QWindowSystemInterface::TouchPoint tp;
tp.id = contact.trackingId;
- tp.flags = contact.flags;
tp.state = contact.state;
*combinedStates |= tp.state;
@@ -508,8 +520,8 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
m_contacts[m_currentSlot].x = m_currentData.x;
if (m_typeB) {
m_contacts[m_currentSlot].x = m_currentData.x;
- if (m_contacts[m_currentSlot].state == Qt::TouchPointStationary)
- m_contacts[m_currentSlot].state = Qt::TouchPointMoved;
+ if (m_contacts[m_currentSlot].state == QEventPoint::State::Stationary)
+ m_contacts[m_currentSlot].state = QEventPoint::State::Updated;
}
} else if (data->code == ABS_MT_POSITION_Y || (m_singleTouch && data->code == ABS_Y)) {
m_currentData.y = qBound(hw_range_y_min, data->value, hw_range_y_max);
@@ -517,23 +529,23 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
m_contacts[m_currentSlot].y = m_currentData.y;
if (m_typeB) {
m_contacts[m_currentSlot].y = m_currentData.y;
- if (m_contacts[m_currentSlot].state == Qt::TouchPointStationary)
- m_contacts[m_currentSlot].state = Qt::TouchPointMoved;
+ if (m_contacts[m_currentSlot].state == QEventPoint::State::Stationary)
+ m_contacts[m_currentSlot].state = QEventPoint::State::Updated;
}
} else if (data->code == ABS_MT_TRACKING_ID) {
m_currentData.trackingId = data->value;
if (m_typeB) {
if (m_currentData.trackingId == -1) {
- m_contacts[m_currentSlot].state = Qt::TouchPointReleased;
+ m_contacts[m_currentSlot].state = QEventPoint::State::Released;
} else {
- m_contacts[m_currentSlot].state = Qt::TouchPointPressed;
+ m_contacts[m_currentSlot].state = QEventPoint::State::Pressed;
m_contacts[m_currentSlot].trackingId = m_currentData.trackingId;
}
}
} else if (data->code == ABS_MT_TOUCH_MAJOR) {
m_currentData.maj = data->value;
if (data->value == 0)
- m_currentData.state = Qt::TouchPointReleased;
+ m_currentData.state = QEventPoint::State::Released;
if (m_typeB)
m_contacts[m_currentSlot].maj = m_currentData.maj;
} else if (data->code == ABS_PRESSURE || data->code == ABS_MT_PRESSURE) {
@@ -549,14 +561,14 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
} else if (data->type == EV_KEY && !m_typeB) {
if (data->code == BTN_TOUCH && data->value == 0)
- m_contacts[m_currentSlot].state = Qt::TouchPointReleased;
+ m_contacts[m_currentSlot].state = QEventPoint::State::Released;
} else if (data->type == EV_SYN && data->code == SYN_MT_REPORT && m_lastEventType != EV_SYN) {
// If there is no tracking id, one will be generated later.
// Until that use a temporary key.
int key = m_currentData.trackingId;
if (key == -1)
- key = m_contacts.count();
+ key = m_contacts.size();
m_contacts.insert(key, m_currentData);
m_currentData = Contact();
@@ -573,39 +585,39 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
// update timestamps
m_lastTimeStamp = m_timeStamp;
- m_timeStamp = data->time.tv_sec + data->time.tv_usec / 1000000.0;
+ m_timeStamp = data->input_event_sec + data->input_event_usec / 1000000.0;
m_lastTouchPoints = m_touchPoints;
m_touchPoints.clear();
- Qt::TouchPointStates combinedStates;
+ QEventPoint::States combinedStates;
bool hasPressure = false;
- for (auto i = m_contacts.begin(), end = m_contacts.end(); i != end; /*erasing*/) {
- auto it = i++;
-
+ for (auto it = m_contacts.begin(), end = m_contacts.end(); it != end; /*erasing*/) {
Contact &contact(it.value());
- if (!contact.state)
+ if (!contact.state) {
+ ++it;
continue;
+ }
int key = m_typeB ? it.key() : contact.trackingId;
if (!m_typeB && m_lastContacts.contains(key)) {
const Contact &prev(m_lastContacts.value(key));
- if (contact.state == Qt::TouchPointReleased) {
+ if (contact.state == QEventPoint::State::Released) {
// Copy over the previous values for released points, just in case.
contact.x = prev.x;
contact.y = prev.y;
contact.maj = prev.maj;
} else {
contact.state = (prev.x == contact.x && prev.y == contact.y)
- ? Qt::TouchPointStationary : Qt::TouchPointMoved;
+ ? QEventPoint::State::Stationary : QEventPoint::State::Updated;
}
}
// Avoid reporting a contact in released state more than once.
- if (!m_typeB && contact.state == Qt::TouchPointReleased
+ if (!m_typeB && contact.state == QEventPoint::State::Released
&& !m_lastContacts.contains(key)) {
- m_contacts.erase(it);
+ it = m_contacts.erase(it);
continue;
}
@@ -613,6 +625,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
hasPressure = true;
addTouchPoint(contact, &combinedStates);
+ ++it;
}
// Now look for contacts that have disappeared since the last sync.
@@ -621,34 +634,37 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
int key = m_typeB ? it.key() : contact.trackingId;
if (m_typeB) {
if (contact.trackingId != m_contacts[key].trackingId && contact.state) {
- contact.state = Qt::TouchPointReleased;
+ contact.state = QEventPoint::State::Released;
addTouchPoint(contact, &combinedStates);
}
} else {
if (!m_contacts.contains(key)) {
- contact.state = Qt::TouchPointReleased;
+ contact.state = QEventPoint::State::Released;
addTouchPoint(contact, &combinedStates);
}
}
}
// Remove contacts that have just been reported as released.
- for (auto i = m_contacts.begin(), end = m_contacts.end(); i != end; /*erasing*/) {
- auto it = i++;
-
+ for (auto it = m_contacts.begin(), end = m_contacts.end(); it != end; /*erasing*/) {
Contact &contact(it.value());
- if (!contact.state)
+ if (!contact.state) {
+ ++it;
continue;
+ }
- if (contact.state == Qt::TouchPointReleased) {
- if (m_typeB)
- contact.state = static_cast<Qt::TouchPointState>(0);
- else
- m_contacts.erase(it);
+ if (contact.state == QEventPoint::State::Released) {
+ if (m_typeB) {
+ contact.state = QEventPoint::State::Unknown;
+ } else {
+ it = m_contacts.erase(it);
+ continue;
+ }
} else {
- contact.state = Qt::TouchPointStationary;
+ contact.state = QEventPoint::State::Stationary;
}
+ ++it;
}
m_lastContacts = m_contacts;
@@ -656,7 +672,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
m_contacts.clear();
- if (!m_touchPoints.isEmpty() && (hasPressure || combinedStates != Qt::TouchPointStationary))
+ if (!m_touchPoints.isEmpty() && (hasPressure || combinedStates != QEventPoint::State::Stationary))
reportPoints();
}
@@ -720,7 +736,7 @@ QRect QEvdevTouchScreenData::screenGeometry() const
{
if (m_forceToActiveWindow) {
QWindow *win = QGuiApplication::focusWindow();
- return win ? QHighDpi::toNativePixels(win->geometry(), win) : QRect();
+ return win ? QHighDpi::toNativeWindowGeometry(win->geometry(), win) : QRect();
}
// Now it becomes tricky. Traditionally we picked the primaryScreen()
@@ -728,7 +744,7 @@ QRect QEvdevTouchScreenData::screenGeometry() const
// suddenly it was all broken.
//
// For now we only support the display configuration of the KMS/DRM
- // backends of eglfs. See QTouchOutputMapping.
+ // backends of eglfs. See QOutputMapping.
//
// The good news it that once winRect refers to the correct screen
// geometry in the full virtual desktop space, there is nothing else
@@ -747,7 +763,7 @@ QRect QEvdevTouchScreenData::screenGeometry() const
if (m_screen)
screen = m_screen;
}
- return QHighDpi::toNativePixels(screen->geometry(), screen);
+ return screen ? QHighDpi::toNativePixels(screen->geometry(), screen) : QRect();
}
void QEvdevTouchScreenData::reportPoints()
@@ -761,7 +777,7 @@ void QEvdevTouchScreenData::reportPoints()
// Map the coordinates based on the normalized position. QPA expects 'area'
// to be in screen coordinates.
- const int pointCount = m_touchPoints.count();
+ const int pointCount = m_touchPoints.size();
for (int i = 0; i < pointCount; ++i) {
QWindowSystemInterface::TouchPoint &tp(m_touchPoints[i]);
@@ -779,7 +795,7 @@ void QEvdevTouchScreenData::reportPoints()
// Calculate normalized pressure.
if (!hw_pressure_min && !hw_pressure_max)
- tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1;
+ tp.pressure = tp.state == QEventPoint::State::Released ? 0 : 1;
else
tp.pressure = (tp.pressure - hw_pressure_min) / qreal(hw_pressure_max - hw_pressure_min);
@@ -825,7 +841,7 @@ void QEvdevTouchScreenHandlerThread::run()
m_handler = nullptr;
}
-bool QEvdevTouchScreenHandlerThread::isTouchDeviceRegistered() const
+bool QEvdevTouchScreenHandlerThread::isPointingDeviceRegistered() const
{
return m_touchDeviceRegistered;
}
@@ -888,7 +904,7 @@ void QEvdevTouchScreenHandlerThread::filterAndSendTouchPoints()
} else {
// Update our estimate for the touch rate. We're making the assumption
- // that this value will be mostly accurate with the occational bump,
+ // that this value will be mostly accurate with the occasional bump,
// so we're weighting the existing value high compared to the update.
const double ratio = 0.9;
m_touchRate = sqrt(m_touchRate * m_touchRate * ratio + touchDelta * touchDelta * (1.0 - ratio));
@@ -926,8 +942,8 @@ void QEvdevTouchScreenHandlerThread::filterAndSendTouchPoints()
f.y.initialize(pos.y(), velocity.y());
// Make sure the first instance of a touch point we send has the
// 'pressed' state.
- if (tp.state != Qt::TouchPointPressed)
- tp.state = Qt::TouchPointPressed;
+ if (tp.state != QEventPoint::State::Pressed)
+ tp.state = QEventPoint::State::Pressed;
}
tp.velocity = QVector2D(f.x.velocity() * winRect.width(), f.y.velocity() * winRect.height());
@@ -949,14 +965,14 @@ void QEvdevTouchScreenHandlerThread::filterAndSendTouchPoints()
f.touchPoint = tp;
// Don't store the point for future reference if it is a release.
- if (tp.state != Qt::TouchPointReleased)
+ if (tp.state != QEventPoint::State::Released)
filteredPoints[tp.id] = f;
}
for (QHash<int, FilteredTouchPoint>::const_iterator it = m_filteredPoints.constBegin(), end = m_filteredPoints.constEnd(); it != end; ++it) {
const FilteredTouchPoint &f = it.value();
QWindowSystemInterface::TouchPoint tp = f.touchPoint;
- tp.state = Qt::TouchPointReleased;
+ tp.state = QEventPoint::State::Released;
tp.velocity = QVector2D();
points.append(tp);
}
@@ -970,3 +986,5 @@ void QEvdevTouchScreenHandlerThread::filterAndSendTouchPoints()
QT_END_NAMESPACE
+
+#include "moc_qevdevtouchhandler_p.cpp"
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
index 56308d0352..b7b058e8b2 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVTOUCHHANDLER_P_H
#define QEVDEVTOUCHHANDLER_P_H
@@ -52,10 +16,12 @@
// We mean it.
//
+//#include <QtGui/qpointingdevice.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <QObject>
#include <QString>
#include <QList>
+#include <QHash>
#include <QThread>
#include <QtCore/private/qthread_p.h>
#include <qpa/qwindowsysteminterface.h>
@@ -69,6 +35,7 @@ QT_BEGIN_NAMESPACE
class QSocketNotifier;
class QEvdevTouchScreenData;
+class QPointingDevice;
class QEvdevTouchScreenHandler : public QObject
{
@@ -78,7 +45,7 @@ public:
explicit QEvdevTouchScreenHandler(const QString &device, const QString &spec = QString(), QObject *parent = nullptr);
~QEvdevTouchScreenHandler();
- QTouchDevice *touchDevice() const;
+ QPointingDevice *touchDevice() const;
bool isFiltered() const;
@@ -91,13 +58,13 @@ private:
friend class QEvdevTouchScreenData;
friend class QEvdevTouchScreenHandlerThread;
- void registerTouchDevice();
- void unregisterTouchDevice();
+ void registerPointingDevice();
+ void unregisterPointingDevice();
QSocketNotifier *m_notify;
int m_fd;
QEvdevTouchScreenData *d;
- QTouchDevice *m_device;
+ QPointingDevice *m_device;
#if QT_CONFIG(mtdev)
mtdev *m_mtdev;
#endif
@@ -111,7 +78,7 @@ public:
~QEvdevTouchScreenHandlerThread();
void run() override;
- bool isTouchDeviceRegistered() const;
+ bool isPointingDeviceRegistered() const;
bool eventFilter(QObject *object, QEvent *event) override;
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
index bf2df93d11..f2a652c254 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevtouchmanager_p.h"
#include "qevdevtouchhandler_p.h"
@@ -48,7 +12,6 @@
#include <QtDeviceDiscoverySupport/private/qdevicediscovery_p.h>
#include <private/qguiapplication_p.h>
#include <private/qinputdevicemanager_p_p.h>
-#include <private/qmemory_p.h>
QT_BEGIN_NAMESPACE
@@ -70,7 +33,7 @@ QEvdevTouchManager::QEvdevTouchManager(const QString &key, const QString &specif
auto parsed = QEvdevUtil::parseSpecification(spec);
m_spec = std::move(parsed.spec);
- for (const QString &device : qAsConst(parsed.devices))
+ for (const QString &device : std::as_const(parsed.devices))
addDevice(device);
// when no devices specified, use device discovery to scan and monitor
@@ -96,7 +59,7 @@ QEvdevTouchManager::~QEvdevTouchManager()
void QEvdevTouchManager::addDevice(const QString &deviceNode)
{
qCDebug(qLcEvdevTouch, "evdevtouch: Adding device at %ls", qUtf16Printable(deviceNode));
- auto handler = qt_make_unique<QEvdevTouchScreenHandlerThread>(deviceNode, m_spec);
+ auto handler = std::make_unique<QEvdevTouchScreenHandlerThread>(deviceNode, m_spec);
if (handler) {
connect(handler.get(), &QEvdevTouchScreenHandlerThread::touchDeviceRegistered, this, &QEvdevTouchManager::updateInputDeviceCount);
m_activeDevices.add(deviceNode, std::move(handler));
@@ -117,7 +80,7 @@ void QEvdevTouchManager::updateInputDeviceCount()
{
int registeredTouchDevices = 0;
for (const auto &device : m_activeDevices) {
- if (device.handler->isTouchDeviceRegistered())
+ if (device.handler->isPointingDeviceRegistered())
++registeredTouchDevices;
}
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h
index 94ee05d900..0bbc87ac0b 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVTOUCHMANAGER_P_H
#define QEVDEVTOUCHMANAGER_P_H
diff --git a/src/platformsupport/input/input-support.pro b/src/platformsupport/input/input-support.pro
deleted file mode 100644
index 3d39210b9e..0000000000
--- a/src/platformsupport/input/input-support.pro
+++ /dev/null
@@ -1,35 +0,0 @@
-TARGET = QtInputSupport
-MODULE = input_support
-
-QT = core-private gui-private devicediscovery_support-private
-CONFIG += static internal_module
-
-DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
-
-qtConfig(evdev) {
- include($$PWD/evdevmouse/evdevmouse.pri)
- include($$PWD/evdevkeyboard/evdevkeyboard.pri)
- include($$PWD/evdevtouch/evdevtouch.pri)
- qtConfig(tabletevent) {
- include($$PWD/evdevtablet/evdevtablet.pri)
- }
-}
-
-qtConfig(tslib) {
- include($$PWD/tslib/tslib.pri)
-}
-
-qtConfig(libinput) {
- include($$PWD/libinput/libinput.pri)
-}
-
-qtConfig(evdev)|qtConfig(libinput) {
- include($$PWD/shared/shared.pri)
-}
-
-qtConfig(integrityhid) {
- include($$PWD/integrityhid/integrityhid.pri)
-}
-
-load(qt_module)
diff --git a/src/platformsupport/input/input.pro b/src/platformsupport/input/input.pro
deleted file mode 100644
index 138c04dea3..0000000000
--- a/src/platformsupport/input/input.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = subdirs
-QT_FOR_CONFIG += gui-private
-
-qtConfig(xkbcommon): SUBDIRS += xkbcommon
-
-SUBDIRS += input-support.pro ### FIXME - QTBUG-52657
-
-CONFIG += ordered
diff --git a/src/platformsupport/input/integrityhid/integrityhid.pri b/src/platformsupport/input/integrityhid/integrityhid.pri
deleted file mode 100644
index 0a6240c422..0000000000
--- a/src/platformsupport/input/integrityhid/integrityhid.pri
+++ /dev/null
@@ -1,7 +0,0 @@
-HEADERS += \
- $$PWD/qintegrityhidmanager.h
-
-SOURCES += \
- $$PWD/qintegrityhidmanager.cpp
-
-QMAKE_USE_PRIVATE += integrityhid
diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp
index e472693077..86036d579d 100644
--- a/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp
+++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Green Hills Software
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 Green Hills Software
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qintegrityhidmanager.h"
#include <QList>
diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.h b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h
index fde5fd7dbb..228d9ea5f3 100644
--- a/src/platformsupport/input/integrityhid/qintegrityhidmanager.h
+++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Green Hills Software
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 Green Hills Software
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QINTEGRITYHIDMANAGER_P_H
#define QINTEGRITYHIDMANAGER_P_H
@@ -55,7 +19,7 @@ public:
QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = nullptr);
~QIntegrityHIDManager();
- void run(void);
+ void run(void) override;
private:
void open_devices(void);
diff --git a/src/platformsupport/input/libinput/libinput.pri b/src/platformsupport/input/libinput/libinput.pri
deleted file mode 100644
index f80b5f41d9..0000000000
--- a/src/platformsupport/input/libinput/libinput.pri
+++ /dev/null
@@ -1,20 +0,0 @@
-HEADERS += \
- $$PWD/qlibinputhandler_p.h \
- $$PWD/qlibinputpointer_p.h \
- $$PWD/qlibinputkeyboard_p.h \
- $$PWD/qlibinputtouch_p.h
-
-SOURCES += \
- $$PWD/qlibinputhandler.cpp \
- $$PWD/qlibinputpointer.cpp \
- $$PWD/qlibinputkeyboard.cpp \
- $$PWD/qlibinputtouch.cpp
-
-QMAKE_USE_PRIVATE += libudev libinput
-
-INCLUDEPATH += $$PWD/../shared
-
-qtConfig(xkbcommon): {
- QMAKE_USE_PRIVATE += xkbcommon
- QT += xkbcommon_support-private
-}
diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp
index 95dfb46d16..ef45533f1a 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler.cpp
+++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlibinputhandler_p.h"
#include "qlibinputpointer_p.h"
@@ -115,7 +79,7 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
m_touch.reset(new QLibInputTouch);
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
- connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [this](const QPoint &pos) {
+ connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, this, [this](const QPoint &pos) {
m_pointer->setPos(pos);
});
@@ -208,7 +172,11 @@ void QLibInputHandler::processEvent(libinput_event *ev)
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
m_pointer->processAbsMotion(libinput_event_get_pointer_event(ev));
break;
+#if QT_CONFIG(libinput_hires_wheel_support)
+ case LIBINPUT_EVENT_POINTER_SCROLL_WHEEL:
+#else
case LIBINPUT_EVENT_POINTER_AXIS:
+#endif
m_pointer->processAxis(libinput_event_get_pointer_event(ev));
break;
case LIBINPUT_EVENT_KEYBOARD_KEY:
diff --git a/src/platformsupport/input/libinput/qlibinputhandler_p.h b/src/platformsupport/input/libinput/qlibinputhandler_p.h
index ac7a267a4d..ca7926bae6 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler_p.h
+++ b/src/platformsupport/input/libinput/qlibinputhandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIBINPUTHANDLER_P_H
#define QLIBINPUTHANDLER_P_H
@@ -43,6 +7,7 @@
#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
#include <QtCore/QMap>
+#include <QtCore/private/qglobal_p.h>
//
// W A R N I N G
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
index 6586b084f1..25939cd510 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
@@ -1,44 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlibinputkeyboard_p.h"
-#include <QtCore/QTextCodec>
#include <QtCore/QLoggingCategory>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qinputdevicemanager_p.h>
@@ -47,7 +10,7 @@
#if QT_CONFIG(xkbcommon)
#include <xkbcommon/xkbcommon-keysyms.h>
#include <xkbcommon/xkbcommon-names.h>
-#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
+#include <QtGui/private/qxkbcommon_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -116,7 +79,7 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
xkb_state_update_key(m_state, keycode, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
- Qt::KeyboardModifiers modifiersAfterStateChange = QXkbCommon::modifiers(m_state);
+ Qt::KeyboardModifiers modifiersAfterStateChange = QXkbCommon::modifiers(m_state, sym);
QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(modifiersAfterStateChange);
QWindowSystemInterface::handleExtendedKeyEvent(nullptr,
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
index 7521902e02..fecbca34aa 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIBINPUTKEYBOARD_P_H
#define QLIBINPUTKEYBOARD_P_H
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index db9e81b5df..03351397b5 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlibinputpointer_p.h"
#include <libinput.h>
@@ -133,16 +97,28 @@ void QLibInputPointer::processAxis(libinput_event_pointer *e)
angleDelta.setX(qRound(value));
#else
if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
+#if QT_CONFIG(libinput_hires_wheel_support)
+ value = libinput_event_pointer_get_scroll_value_v120(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+#else
value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+#endif
angleDelta.setY(qRound(value));
}
if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
+#if QT_CONFIG(libinput_hires_wheel_support)
+ value = libinput_event_pointer_get_scroll_value_v120(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
+#else
value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
+#endif
angleDelta.setX(qRound(value));
}
#endif
- const int factor = 8;
- angleDelta *= -factor;
+#if QT_CONFIG(libinput_hires_wheel_support)
+ const int factor = -1;
+#else
+ const int factor = -8;
+#endif
+ angleDelta *= factor;
Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, QPoint(), angleDelta, mods);
}
diff --git a/src/platformsupport/input/libinput/qlibinputpointer_p.h b/src/platformsupport/input/libinput/qlibinputpointer_p.h
index 55d4a5f919..f1709eaa34 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer_p.h
+++ b/src/platformsupport/input/libinput/qlibinputpointer_p.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIBINPUTPOINTER_P_H
#define QLIBINPUTPOINTER_P_H
#include <QtCore/QPoint>
+#include <QtCore/private/qglobal_p.h>
//
// W A R N I N G
diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp
index 446218e4b3..e3a483dc84 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch.cpp
+++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp
@@ -1,58 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qlibinputtouch_p.h"
-#include "qtouchoutputmapping_p.h"
+#include "qoutputmapping_p.h"
#include <libinput.h>
#include <QtGui/QGuiApplication>
+#include <QtGui/QPointingDevice>
#include <QtGui/QScreen>
+#include <QtGui/QPointingDevice>
#include <QtGui/private/qhighdpiscaling_p.h>
+#include <QtGui/private/qpointingdevice_p.h>
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcLibInput)
+Q_LOGGING_CATEGORY(qLcLibInputEvents, "qt.qpa.input.events")
QWindowSystemInterface::TouchPoint *QLibInputTouch::DeviceState::point(int32_t slot)
{
const int id = qMax(0, slot);
- for (int i = 0; i < m_points.count(); ++i)
+ for (int i = 0; i < m_points.size(); ++i)
if (m_points.at(i).id == id)
return &m_points[i];
@@ -65,9 +33,8 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e
return &m_devState[dev];
}
-QPointF QLibInputTouch::getPos(libinput_event_touch *e)
+QRect QLibInputTouch::screenGeometry(DeviceState *state)
{
- DeviceState *state = deviceState(e);
QScreen *screen = QGuiApplication::primaryScreen();
if (!state->m_screenName.isEmpty()) {
if (!m_screen) {
@@ -82,12 +49,45 @@ QPointF QLibInputTouch::getPos(libinput_event_touch *e)
if (m_screen)
screen = m_screen;
}
- const QRect geom = QHighDpi::toNativePixels(screen->geometry(), screen);
+ return screen ? QHighDpi::toNativePixels(screen->geometry(), screen) : QRect();
+}
+
+QPointF QLibInputTouch::getPos(libinput_event_touch *e)
+{
+ DeviceState *state = deviceState(e);
+ QRect geom = screenGeometry(state);
const double x = libinput_event_touch_get_x_transformed(e, geom.width());
const double y = libinput_event_touch_get_y_transformed(e, geom.height());
return geom.topLeft() + QPointF(x, y);
}
+static void setMatrix(libinput_device *dev)
+{
+ if (libinput_device_config_calibration_has_matrix(dev)) {
+ QByteArray env = qgetenv("QT_QPA_LIBINPUT_TOUCH_MATRIX");
+ env = env.simplified();
+ if (env.size()) {
+ float matrix[6];
+ QList<QByteArray> list = env.split(' ');
+ if (list.length() != 6) {
+ qCWarning(qLcLibInput, "matrix length %lld wrong, should be 6", list.length());
+ return;
+ }
+ for (int i = 0; i < 6; i++) {
+ bool ok = true;
+ matrix[i] = list[i].toFloat(&ok);
+ if (!ok) {
+ qCWarning(qLcLibInput, "Invalid matrix entry %d %s ", i, list[i].constData());
+ return;
+ }
+ }
+ if (libinput_device_config_calibration_set_matrix(dev, matrix) != LIBINPUT_CONFIG_STATUS_SUCCESS)
+ qCWarning(qLcLibInput, "Failed to set libinput calibration matrix ");
+ }
+ } else {
+ qCWarning(qLcLibInput, "Touch device doesn't support matrix");
+ }
+}
void QLibInputTouch::registerDevice(libinput_device *dev)
{
struct udev_device *udev_device;
@@ -98,26 +98,34 @@ void QLibInputTouch::registerDevice(libinput_device *dev)
qCDebug(qLcLibInput, "libinput: registerDevice %s - %s",
qPrintable(devNode), qPrintable(devName));
- QTouchOutputMapping mapping;
- if (mapping.load()) {
- m_devState[dev].m_screenName = mapping.screenNameForDeviceNode(devNode);
- if (!m_devState[dev].m_screenName.isEmpty())
- qCDebug(qLcLibInput, "libinput: Mapping device %s to screen %s",
- qPrintable(devNode), qPrintable(m_devState[dev].m_screenName));
+ QOutputMapping *mapping = QOutputMapping::get();
+ QRect geom;
+ if (mapping->load()) {
+ m_devState[dev].m_screenName = mapping->screenNameForDeviceNode(devNode);
+ if (!m_devState[dev].m_screenName.isEmpty()) {
+ geom = screenGeometry(&m_devState[dev]);
+ qCDebug(qLcLibInput) << "libinput: Mapping device" << devNode
+ << "to screen" << m_devState[dev].m_screenName
+ << "with geometry" << geom;
+ }
}
- QTouchDevice *&td = m_devState[dev].m_touchDevice;
- td = new QTouchDevice;
- td->setName(devName);
- td->setType(QTouchDevice::TouchScreen);
- td->setCapabilities(QTouchDevice::Position | QTouchDevice::Area);
- QWindowSystemInterface::registerTouchDevice(td);
+ QPointingDevice *&td = m_devState[dev].m_touchDevice;
+ td = new QPointingDevice(devName, udev_device_get_devnum(udev_device),
+ QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger,
+ QPointingDevice::Capability::Position | QPointingDevice::Capability::Area, 16, 0);
+ auto devPriv = QPointingDevicePrivate::get(td);
+ devPriv->busId = QString::fromLocal8Bit(udev_device_get_syspath(udev_device)); // TODO is that the best to choose?
+ if (!geom.isNull())
+ devPriv->setAvailableVirtualGeometry(geom);
+ QWindowSystemInterface::registerInputDevice(td);
+ setMatrix(dev);
}
void QLibInputTouch::unregisterDevice(libinput_device *dev)
{
Q_UNUSED(dev);
- // There is no way to remove a QTouchDevice.
+ // There is no way to remove a QPointingDevice.
}
void QLibInputTouch::processTouchDown(libinput_event_touch *e)
@@ -130,10 +138,11 @@ void QLibInputTouch::processTouchDown(libinput_event_touch *e)
} else {
QWindowSystemInterface::TouchPoint newTp;
newTp.id = qMax(0, slot);
- newTp.state = Qt::TouchPointPressed;
+ newTp.state = QEventPoint::State::Pressed;
newTp.area = QRect(0, 0, 8, 8);
newTp.area.moveCenter(getPos(e));
state->m_points.append(newTp);
+ qCDebug(qLcLibInputEvents) << "touch down" << newTp;
}
}
@@ -143,16 +152,17 @@ void QLibInputTouch::processTouchMotion(libinput_event_touch *e)
DeviceState *state = deviceState(e);
QWindowSystemInterface::TouchPoint *tp = state->point(slot);
if (tp) {
- Qt::TouchPointState tmpState = Qt::TouchPointMoved;
+ QEventPoint::State tmpState = QEventPoint::State::Updated;
const QPointF p = getPos(e);
if (tp->area.center() == p)
- tmpState = Qt::TouchPointStationary;
+ tmpState = QEventPoint::State::Stationary;
else
tp->area.moveCenter(p);
// 'down' may be followed by 'motion' within the same "frame".
// Handle this by compressing and keeping the Pressed state until the 'frame'.
- if (tp->state != Qt::TouchPointPressed && tp->state != Qt::TouchPointReleased)
+ if (tp->state != QEventPoint::State::Pressed && tp->state != QEventPoint::State::Released)
tp->state = tmpState;
+ qCDebug(qLcLibInputEvents) << "touch move" << tp;
} else {
qWarning("Inconsistent touch state (got 'motion' without 'down')");
}
@@ -164,13 +174,16 @@ void QLibInputTouch::processTouchUp(libinput_event_touch *e)
DeviceState *state = deviceState(e);
QWindowSystemInterface::TouchPoint *tp = state->point(slot);
if (tp) {
- tp->state = Qt::TouchPointReleased;
+ tp->state = QEventPoint::State::Released;
// There may not be a Frame event after the last Up. Work this around.
- Qt::TouchPointStates s;
- for (int i = 0; i < state->m_points.count(); ++i)
+ QEventPoint::States s;
+ for (int i = 0; i < state->m_points.size(); ++i)
s |= state->m_points.at(i).state;
- if (s == Qt::TouchPointReleased)
+ qCDebug(qLcLibInputEvents) << "touch up" << s << tp;
+ if (s == QEventPoint::State::Released)
processTouchFrame(e);
+ else
+ qCDebug(qLcLibInputEvents, "waiting for all points to be released");
} else {
qWarning("Inconsistent touch state (got 'up' without 'down')");
}
@@ -179,6 +192,7 @@ void QLibInputTouch::processTouchUp(libinput_event_touch *e)
void QLibInputTouch::processTouchCancel(libinput_event_touch *e)
{
DeviceState *state = deviceState(e);
+ qCDebug(qLcLibInputEvents) << "touch cancel" << state->m_points;
if (state->m_touchDevice)
QWindowSystemInterface::handleTouchCancelEvent(nullptr, state->m_touchDevice, QGuiApplication::keyboardModifiers());
else
@@ -192,18 +206,19 @@ void QLibInputTouch::processTouchFrame(libinput_event_touch *e)
qWarning("TouchFrame without registered device");
return;
}
+ qCDebug(qLcLibInputEvents) << "touch frame" << state->m_points;
if (state->m_points.isEmpty())
return;
QWindowSystemInterface::handleTouchEvent(nullptr, state->m_touchDevice, state->m_points,
QGuiApplication::keyboardModifiers());
- for (int i = 0; i < state->m_points.count(); ++i) {
+ for (int i = 0; i < state->m_points.size(); ++i) {
QWindowSystemInterface::TouchPoint &tp(state->m_points[i]);
- if (tp.state == Qt::TouchPointReleased)
+ if (tp.state == QEventPoint::State::Released)
state->m_points.removeAt(i--);
- else if (tp.state == Qt::TouchPointPressed)
- tp.state = Qt::TouchPointStationary;
+ else if (tp.state == QEventPoint::State::Pressed)
+ tp.state = QEventPoint::State::Stationary;
}
}
diff --git a/src/platformsupport/input/libinput/qlibinputtouch_p.h b/src/platformsupport/input/libinput/qlibinputtouch_p.h
index 2682b83b26..174795b140 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch_p.h
+++ b/src/platformsupport/input/libinput/qlibinputtouch_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QLIBINPUTTOUCH_P_H
#define QLIBINPUTTOUCH_P_H
@@ -44,6 +8,7 @@
#include <QtCore/QList>
#include <QtCore/QPointer>
#include <qpa/qwindowsysteminterface.h>
+#include <private/qglobal_p.h>
//
// W A R N I N G
@@ -78,11 +43,12 @@ private:
DeviceState() : m_touchDevice(nullptr), m_screenName() { }
QWindowSystemInterface::TouchPoint *point(int32_t slot);
QList<QWindowSystemInterface::TouchPoint> m_points;
- QTouchDevice *m_touchDevice;
+ QPointingDevice *m_touchDevice;
QString m_screenName;
};
DeviceState *deviceState(libinput_event_touch *e);
+ QRect screenGeometry(DeviceState *state);
QPointF getPos(libinput_event_touch *e);
QHash<libinput_device *, DeviceState> m_devState;
diff --git a/src/platformsupport/input/shared/devicehandlerlist_p.h b/src/platformsupport/input/shared/devicehandlerlist_p.h
index 97794d4d7d..facd1946a5 100644
--- a/src/platformsupport/input/shared/devicehandlerlist_p.h
+++ b/src/platformsupport/input/shared/devicehandlerlist_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTINPUTSUPPORT_DEVICEHANDLERLIST_P_H
#define QTINPUTSUPPORT_DEVICEHANDLERLIST_P_H
@@ -52,6 +16,7 @@
//
#include <QString>
+#include <private/qglobal_p.h>
#include <vector>
#include <memory>
diff --git a/src/platformsupport/input/shared/qevdevutil.cpp b/src/platformsupport/input/shared/qevdevutil.cpp
index 74f8bcdc2b..c1ebb9ada0 100644
--- a/src/platformsupport/input/shared/qevdevutil.cpp
+++ b/src/platformsupport/input/shared/qevdevutil.cpp
@@ -1,61 +1,27 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qevdevutil_p.h"
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace QEvdevUtil {
ParsedSpecification parseSpecification(const QString &specification)
{
ParsedSpecification result;
- result.args = specification.splitRef(QLatin1Char(':'));
+ result.args = QStringView{specification}.split(u':');
- for (const QStringRef &arg : qAsConst(result.args)) {
- if (arg.startsWith(QLatin1String("/dev/"))) {
+ for (const auto &arg : std::as_const(result.args)) {
+ if (arg.startsWith("/dev/"_L1)) {
// if device is specified try to use it
result.devices.append(arg.toString());
} else {
// build new specification without /dev/ elements
- result.spec += arg + QLatin1Char(':');
+ result.spec += arg + u':';
}
}
diff --git a/src/platformsupport/input/shared/qevdevutil_p.h b/src/platformsupport/input/shared/qevdevutil_p.h
index 7d0a5af130..8533b93783 100644
--- a/src/platformsupport/input/shared/qevdevutil_p.h
+++ b/src/platformsupport/input/shared/qevdevutil_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVUTIL_P_H
#define QEVDEVUTIL_P_H
@@ -51,10 +15,11 @@
// We mean it.
//
+#include <QList>
#include <QString>
#include <QStringList>
-#include <QVector>
-#include <QStringRef>
+#include <QStringView>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +29,7 @@ struct ParsedSpecification
{
QString spec;
QStringList devices;
- QVector<QStringRef> args;
+ QList<QStringView> args;
};
ParsedSpecification parseSpecification(const QString &specification);
diff --git a/src/platformsupport/input/shared/qoutputmapping.cpp b/src/platformsupport/input/shared/qoutputmapping.cpp
new file mode 100644
index 0000000000..c8683958d3
--- /dev/null
+++ b/src/platformsupport/input/shared/qoutputmapping.cpp
@@ -0,0 +1,95 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qoutputmapping_p.h"
+#include <QFile>
+#include <QFileInfo>
+#include <QVariantMap>
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonArray>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+static QOutputMapping *s_outputMapping = nullptr;
+
+QOutputMapping *QOutputMapping::get()
+{
+ if (!s_outputMapping)
+ s_outputMapping = new QDefaultOutputMapping;
+
+ return s_outputMapping;
+}
+
+bool QOutputMapping::load()
+{
+ return false;
+}
+
+QString QOutputMapping::screenNameForDeviceNode(const QString &deviceNode)
+{
+ Q_UNUSED(deviceNode);
+ return QString();
+}
+
+#ifdef Q_OS_WEBOS
+QWindow *QOutputMapping::windowForDeviceNode(const QString &deviceNode)
+{
+ Q_UNUSED(deviceNode);
+ return nullptr;
+}
+
+void QOutputMapping::set(QOutputMapping *mapping)
+{
+ if (s_outputMapping)
+ delete s_outputMapping;
+
+ s_outputMapping = mapping;
+}
+#endif // Q_OS_WEBOS
+
+bool QDefaultOutputMapping::load()
+{
+ static QByteArray configFile = qgetenv("QT_QPA_EGLFS_KMS_CONFIG");
+ if (configFile.isEmpty())
+ return false;
+
+ QFile file(QString::fromUtf8(configFile));
+ if (!file.open(QFile::ReadOnly)) {
+ qWarning("touch input support: Failed to open %s", configFile.constData());
+ return false;
+ }
+
+ const QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
+ if (!doc.isObject()) {
+ qWarning("touch input support: Failed to parse %s", configFile.constData());
+ return false;
+ }
+
+ // What we are interested is the virtualIndex and touchDevice properties for
+ // each element in the outputs array.
+ const QJsonArray outputs = doc.object().value("outputs"_L1).toArray();
+ for (int i = 0; i < outputs.size(); ++i) {
+ const QVariantMap output = outputs.at(i).toObject().toVariantMap();
+ if (!output.contains(QStringLiteral("touchDevice")))
+ continue;
+ if (!output.contains(QStringLiteral("name"))) {
+ qWarning("evdevtouch: Output %d specifies touchDevice but not name, this is wrong", i);
+ continue;
+ }
+ QFileInfo deviceNode(output.value(QStringLiteral("touchDevice")).toString());
+ const QString &screenName = output.value(QStringLiteral("name")).toString();
+ m_screenTable.insert(deviceNode.canonicalFilePath(), screenName);
+ }
+
+ return true;
+}
+
+QString QDefaultOutputMapping::screenNameForDeviceNode(const QString &deviceNode)
+{
+ return m_screenTable.value(deviceNode);
+}
+
+QT_END_NAMESPACE
diff --git a/src/platformsupport/input/shared/qoutputmapping_p.h b/src/platformsupport/input/shared/qoutputmapping_p.h
new file mode 100644
index 0000000000..b11364188d
--- /dev/null
+++ b/src/platformsupport/input/shared/qoutputmapping_p.h
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QOUTPUTMAPPING_P_H
+#define QOUTPUTMAPPING_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QString>
+#include <QHash>
+#include <private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+
+class QOutputMapping
+{
+public:
+ virtual ~QOutputMapping() {}
+
+ static QOutputMapping *get();
+ virtual bool load();
+ virtual QString screenNameForDeviceNode(const QString &deviceNode);
+
+#ifdef Q_OS_WEBOS
+ virtual QWindow *windowForDeviceNode(const QString &deviceNode);
+ static void set(QOutputMapping *mapping);
+#endif
+};
+
+class QDefaultOutputMapping : public QOutputMapping
+{
+public:
+ bool load() override;
+ QString screenNameForDeviceNode(const QString &deviceNode) override;
+
+private:
+ QHash<QString, QString> m_screenTable;
+};
+
+QT_END_NAMESPACE
+
+#endif // QOUTPUTMAPPING_P_H
diff --git a/src/platformsupport/input/shared/qtouchoutputmapping.cpp b/src/platformsupport/input/shared/qtouchoutputmapping.cpp
deleted file mode 100644
index 0a1afd4739..0000000000
--- a/src/platformsupport/input/shared/qtouchoutputmapping.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtouchoutputmapping_p.h"
-#include <QFile>
-#include <QVariantMap>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QJsonArray>
-
-QT_BEGIN_NAMESPACE
-
-bool QTouchOutputMapping::load()
-{
- static QByteArray configFile = qgetenv("QT_QPA_EGLFS_KMS_CONFIG");
- if (configFile.isEmpty())
- return false;
-
- QFile file(QString::fromUtf8(configFile));
- if (!file.open(QFile::ReadOnly)) {
- qWarning("touch input support: Failed to open %s", configFile.constData());
- return false;
- }
-
- const QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
- if (!doc.isObject()) {
- qWarning("touch input support: Failed to parse %s", configFile.constData());
- return false;
- }
-
- // What we are interested is the virtualIndex and touchDevice properties for
- // each element in the outputs array.
- const QJsonArray outputs = doc.object().value(QLatin1String("outputs")).toArray();
- for (int i = 0; i < outputs.size(); ++i) {
- const QVariantMap output = outputs.at(i).toObject().toVariantMap();
- if (!output.contains(QStringLiteral("touchDevice")))
- continue;
- if (!output.contains(QStringLiteral("name"))) {
- qWarning("evdevtouch: Output %d specifies touchDevice but not name, this is wrong", i);
- continue;
- }
- const QString &deviceNode = output.value(QStringLiteral("touchDevice")).toString();
- const QString &screenName = output.value(QStringLiteral("name")).toString();
- m_screenTable.insert(deviceNode, screenName);
- }
-
- return true;
-}
-
-QString QTouchOutputMapping::screenNameForDeviceNode(const QString &deviceNode)
-{
- return m_screenTable.value(deviceNode);
-}
-
-QT_END_NAMESPACE
diff --git a/src/platformsupport/input/shared/qtouchoutputmapping_p.h b/src/platformsupport/input/shared/qtouchoutputmapping_p.h
deleted file mode 100644
index 94d4dbc3b1..0000000000
--- a/src/platformsupport/input/shared/qtouchoutputmapping_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTOUCHOUTPUTMAPPING_P_H
-#define QTOUCHOUTPUTMAPPING_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QString>
-#include <QHash>
-
-QT_BEGIN_NAMESPACE
-
-class QTouchOutputMapping
-{
-public:
- bool load();
- QString screenNameForDeviceNode(const QString &deviceNode);
-
-private:
- QHash<QString, QString> m_screenTable;
-};
-
-QT_END_NAMESPACE
-
-#endif // QTOUCHOUTPUTMAPPING_P_H
diff --git a/src/platformsupport/input/shared/shared.pri b/src/platformsupport/input/shared/shared.pri
deleted file mode 100644
index c29d11e7d6..0000000000
--- a/src/platformsupport/input/shared/shared.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-HEADERS += \
- $$PWD/devicehandlerlist_p.h \
- $$PWD/qevdevutil_p.h \
- $$PWD/qtouchoutputmapping_p.h
-
-SOURCES += \
- $$PWD/qevdevutil.cpp \
- $$PWD/qtouchoutputmapping.cpp
diff --git a/src/platformsupport/input/tslib/qtslib.cpp b/src/platformsupport/input/tslib/qtslib.cpp
index e105f5ea98..a84cc90dc2 100644
--- a/src/platformsupport/input/tslib/qtslib.cpp
+++ b/src/platformsupport/input/tslib/qtslib.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtslib_p.h"
@@ -51,16 +15,18 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(qLcTsLib, "qt.qpa.input")
QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
const QString &specification,
QObject *parent)
: QObject(parent),
- m_rawMode(!key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive))
+ m_rawMode(!key.compare("TslibRaw"_L1, Qt::CaseInsensitive))
{
qCDebug(qLcTsLib) << "Initializing tslib plugin" << key << specification;
- setObjectName(QLatin1String("TSLib Mouse Handler"));
+ setObjectName("TSLib Mouse Handler"_L1);
m_dev = ts_setup(nullptr, 1);
if (!m_dev) {
@@ -113,9 +79,12 @@ void QTsLibMouseHandler::readMouseData()
}
QPoint pos(x, y);
- QWindowSystemInterface::handleMouseEvent(nullptr, pos, pos,
- pressed ? Qt::LeftButton : Qt::NoButton,
- Qt::NoButton, QEvent::None);
+ Qt::MouseButton button = pressed ^ m_pressed ? Qt::LeftButton : Qt::NoButton;
+ Qt::MouseButtons state = pressed ? Qt::LeftButton : Qt::NoButton;
+ QEvent::Type type = pressed ? (m_pressed ? QEvent::MouseMove : QEvent::MouseButtonPress)
+ : QEvent::MouseButtonRelease;
+
+ QWindowSystemInterface::handleMouseEvent(nullptr, pos, pos, state, button, type);
m_x = x;
m_y = y;
@@ -124,3 +93,5 @@ void QTsLibMouseHandler::readMouseData()
}
QT_END_NAMESPACE
+
+#include "moc_qtslib_p.cpp"
diff --git a/src/platformsupport/input/tslib/qtslib_p.h b/src/platformsupport/input/tslib/qtslib_p.h
index ffd60cd0e3..03514a6d5d 100644
--- a/src/platformsupport/input/tslib/qtslib_p.h
+++ b/src/platformsupport/input/tslib/qtslib_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTSLIB_H
#define QTSLIB_H
@@ -52,6 +16,7 @@
//
#include <QObject>
+#include <private/qglobal_p.h>
struct tsdev;
@@ -64,7 +29,7 @@ class QTsLibMouseHandler : public QObject
Q_OBJECT
public:
- QTsLibMouseHandler(const QString &key, const QString &specification, QObject *parent = 0);
+ QTsLibMouseHandler(const QString &key, const QString &specification, QObject *parent = nullptr);
~QTsLibMouseHandler();
private slots:
diff --git a/src/platformsupport/input/tslib/tslib.pri b/src/platformsupport/input/tslib/tslib.pri
deleted file mode 100644
index 9efd126e13..0000000000
--- a/src/platformsupport/input/tslib/tslib.pri
+++ /dev/null
@@ -1,7 +0,0 @@
-HEADERS += \
- $$PWD/qtslib_p.h
-
-SOURCES += \
- $$PWD/qtslib.cpp
-
-QMAKE_USE += tslib
diff --git a/src/platformsupport/input/xkbcommon/qxkbcommon.cpp b/src/platformsupport/input/xkbcommon/qxkbcommon.cpp
deleted file mode 100644
index 877c5d848f..0000000000
--- a/src/platformsupport/input/xkbcommon/qxkbcommon.cpp
+++ /dev/null
@@ -1,828 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qxkbcommon_p.h"
-
-#include <private/qmakearray_p.h>
-
-#include <QtCore/QMetaMethod>
-#include <QtGui/QKeyEvent>
-#include <QtGui/private/qguiapplication_p.h>
-
-#include <qpa/qplatforminputcontext.h>
-#include <qpa/qplatformintegration.h>
-
-QT_BEGIN_NAMESPACE
-
-Q_LOGGING_CATEGORY(lcXkbcommon, "qt.xkbcommon")
-
-static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers,
- xkb_state *state, xkb_keycode_t code,
- bool superAsMeta, bool hyperAsMeta);
-
-typedef struct xkb2qt
-{
- unsigned int xkb;
- unsigned int qt;
-
- constexpr bool operator <=(const xkb2qt &that) const noexcept
- {
- return xkb <= that.xkb;
- }
-
- constexpr bool operator <(const xkb2qt &that) const noexcept
- {
- return xkb < that.xkb;
- }
-} xkb2qt_t;
-
-template<std::size_t Xkb, std::size_t Qt>
-struct Xkb2Qt
-{
- using Type = xkb2qt_t;
- static constexpr Type data() noexcept { return Type{Xkb, Qt}; }
-};
-
-static constexpr const auto KeyTbl = qMakeArray(
- QSortedData<
- // misc keys
-
- Xkb2Qt<XKB_KEY_Escape, Qt::Key_Escape>,
- Xkb2Qt<XKB_KEY_Tab, Qt::Key_Tab>,
- Xkb2Qt<XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab>,
- Xkb2Qt<XKB_KEY_BackSpace, Qt::Key_Backspace>,
- Xkb2Qt<XKB_KEY_Return, Qt::Key_Return>,
- Xkb2Qt<XKB_KEY_Insert, Qt::Key_Insert>,
- Xkb2Qt<XKB_KEY_Delete, Qt::Key_Delete>,
- Xkb2Qt<XKB_KEY_Clear, Qt::Key_Delete>,
- Xkb2Qt<XKB_KEY_Pause, Qt::Key_Pause>,
- Xkb2Qt<XKB_KEY_Print, Qt::Key_Print>,
- Xkb2Qt<0x1005FF60, Qt::Key_SysReq>, // hardcoded Sun SysReq
- Xkb2Qt<0x1007ff00, Qt::Key_SysReq>, // hardcoded X386 SysReq
-
- // cursor movement
-
- Xkb2Qt<XKB_KEY_Home, Qt::Key_Home>,
- Xkb2Qt<XKB_KEY_End, Qt::Key_End>,
- Xkb2Qt<XKB_KEY_Left, Qt::Key_Left>,
- Xkb2Qt<XKB_KEY_Up, Qt::Key_Up>,
- Xkb2Qt<XKB_KEY_Right, Qt::Key_Right>,
- Xkb2Qt<XKB_KEY_Down, Qt::Key_Down>,
- Xkb2Qt<XKB_KEY_Prior, Qt::Key_PageUp>,
- Xkb2Qt<XKB_KEY_Next, Qt::Key_PageDown>,
-
- // modifiers
-
- Xkb2Qt<XKB_KEY_Shift_L, Qt::Key_Shift>,
- Xkb2Qt<XKB_KEY_Shift_R, Qt::Key_Shift>,
- Xkb2Qt<XKB_KEY_Shift_Lock, Qt::Key_Shift>,
- Xkb2Qt<XKB_KEY_Control_L, Qt::Key_Control>,
- Xkb2Qt<XKB_KEY_Control_R, Qt::Key_Control>,
- Xkb2Qt<XKB_KEY_Meta_L, Qt::Key_Meta>,
- Xkb2Qt<XKB_KEY_Meta_R, Qt::Key_Meta>,
- Xkb2Qt<XKB_KEY_Alt_L, Qt::Key_Alt>,
- Xkb2Qt<XKB_KEY_Alt_R, Qt::Key_Alt>,
- Xkb2Qt<XKB_KEY_Caps_Lock, Qt::Key_CapsLock>,
- Xkb2Qt<XKB_KEY_Num_Lock, Qt::Key_NumLock>,
- Xkb2Qt<XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock>,
- Xkb2Qt<XKB_KEY_Super_L, Qt::Key_Super_L>,
- Xkb2Qt<XKB_KEY_Super_R, Qt::Key_Super_R>,
- Xkb2Qt<XKB_KEY_Menu, Qt::Key_Menu>,
- Xkb2Qt<XKB_KEY_Hyper_L, Qt::Key_Hyper_L>,
- Xkb2Qt<XKB_KEY_Hyper_R, Qt::Key_Hyper_R>,
- Xkb2Qt<XKB_KEY_Help, Qt::Key_Help>,
- Xkb2Qt<0x1000FF74, Qt::Key_Backtab>, // hardcoded HP backtab
- Xkb2Qt<0x1005FF10, Qt::Key_F11>, // hardcoded Sun F36 (labeled F11)
- Xkb2Qt<0x1005FF11, Qt::Key_F12>, // hardcoded Sun F37 (labeled F12)
-
- // numeric and function keypad keys
-
- Xkb2Qt<XKB_KEY_KP_Space, Qt::Key_Space>,
- Xkb2Qt<XKB_KEY_KP_Tab, Qt::Key_Tab>,
- Xkb2Qt<XKB_KEY_KP_Enter, Qt::Key_Enter>,
- Xkb2Qt<XKB_KEY_KP_Home, Qt::Key_Home>,
- Xkb2Qt<XKB_KEY_KP_Left, Qt::Key_Left>,
- Xkb2Qt<XKB_KEY_KP_Up, Qt::Key_Up>,
- Xkb2Qt<XKB_KEY_KP_Right, Qt::Key_Right>,
- Xkb2Qt<XKB_KEY_KP_Down, Qt::Key_Down>,
- Xkb2Qt<XKB_KEY_KP_Prior, Qt::Key_PageUp>,
- Xkb2Qt<XKB_KEY_KP_Next, Qt::Key_PageDown>,
- Xkb2Qt<XKB_KEY_KP_End, Qt::Key_End>,
- Xkb2Qt<XKB_KEY_KP_Begin, Qt::Key_Clear>,
- Xkb2Qt<XKB_KEY_KP_Insert, Qt::Key_Insert>,
- Xkb2Qt<XKB_KEY_KP_Delete, Qt::Key_Delete>,
- Xkb2Qt<XKB_KEY_KP_Equal, Qt::Key_Equal>,
- Xkb2Qt<XKB_KEY_KP_Multiply, Qt::Key_Asterisk>,
- Xkb2Qt<XKB_KEY_KP_Add, Qt::Key_Plus>,
- Xkb2Qt<XKB_KEY_KP_Separator, Qt::Key_Comma>,
- Xkb2Qt<XKB_KEY_KP_Subtract, Qt::Key_Minus>,
- Xkb2Qt<XKB_KEY_KP_Decimal, Qt::Key_Period>,
- Xkb2Qt<XKB_KEY_KP_Divide, Qt::Key_Slash>,
-
- // special non-XF86 function keys
-
- Xkb2Qt<XKB_KEY_Undo, Qt::Key_Undo>,
- Xkb2Qt<XKB_KEY_Redo, Qt::Key_Redo>,
- Xkb2Qt<XKB_KEY_Find, Qt::Key_Find>,
- Xkb2Qt<XKB_KEY_Cancel, Qt::Key_Cancel>,
-
- // International input method support keys
-
- // International & multi-key character composition
- Xkb2Qt<XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr>,
- Xkb2Qt<XKB_KEY_Multi_key, Qt::Key_Multi_key>,
- Xkb2Qt<XKB_KEY_Codeinput, Qt::Key_Codeinput>,
- Xkb2Qt<XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate>,
- Xkb2Qt<XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate>,
- Xkb2Qt<XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate>,
-
- // Misc Functions
- Xkb2Qt<XKB_KEY_Mode_switch, Qt::Key_Mode_switch>,
- Xkb2Qt<XKB_KEY_script_switch, Qt::Key_Mode_switch>,
-
- // Japanese keyboard support
- Xkb2Qt<XKB_KEY_Kanji, Qt::Key_Kanji>,
- Xkb2Qt<XKB_KEY_Muhenkan, Qt::Key_Muhenkan>,
- //Xkb2Qt<XKB_KEY_Henkan_Mode, Qt::Key_Henkan_Mode>,
- Xkb2Qt<XKB_KEY_Henkan_Mode, Qt::Key_Henkan>,
- Xkb2Qt<XKB_KEY_Henkan, Qt::Key_Henkan>,
- Xkb2Qt<XKB_KEY_Romaji, Qt::Key_Romaji>,
- Xkb2Qt<XKB_KEY_Hiragana, Qt::Key_Hiragana>,
- Xkb2Qt<XKB_KEY_Katakana, Qt::Key_Katakana>,
- Xkb2Qt<XKB_KEY_Hiragana_Katakana, Qt::Key_Hiragana_Katakana>,
- Xkb2Qt<XKB_KEY_Zenkaku, Qt::Key_Zenkaku>,
- Xkb2Qt<XKB_KEY_Hankaku, Qt::Key_Hankaku>,
- Xkb2Qt<XKB_KEY_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku>,
- Xkb2Qt<XKB_KEY_Touroku, Qt::Key_Touroku>,
- Xkb2Qt<XKB_KEY_Massyo, Qt::Key_Massyo>,
- Xkb2Qt<XKB_KEY_Kana_Lock, Qt::Key_Kana_Lock>,
- Xkb2Qt<XKB_KEY_Kana_Shift, Qt::Key_Kana_Shift>,
- Xkb2Qt<XKB_KEY_Eisu_Shift, Qt::Key_Eisu_Shift>,
- Xkb2Qt<XKB_KEY_Eisu_toggle, Qt::Key_Eisu_toggle>,
- //Xkb2Qt<XKB_KEY_Kanji_Bangou, Qt::Key_Kanji_Bangou>,
- //Xkb2Qt<XKB_KEY_Zen_Koho, Qt::Key_Zen_Koho>,
- //Xkb2Qt<XKB_KEY_Mae_Koho, Qt::Key_Mae_Koho>,
- Xkb2Qt<XKB_KEY_Kanji_Bangou, Qt::Key_Codeinput>,
- Xkb2Qt<XKB_KEY_Zen_Koho, Qt::Key_MultipleCandidate>,
- Xkb2Qt<XKB_KEY_Mae_Koho, Qt::Key_PreviousCandidate>,
-
- // Korean keyboard support
- Xkb2Qt<XKB_KEY_Hangul, Qt::Key_Hangul>,
- Xkb2Qt<XKB_KEY_Hangul_Start, Qt::Key_Hangul_Start>,
- Xkb2Qt<XKB_KEY_Hangul_End, Qt::Key_Hangul_End>,
- Xkb2Qt<XKB_KEY_Hangul_Hanja, Qt::Key_Hangul_Hanja>,
- Xkb2Qt<XKB_KEY_Hangul_Jamo, Qt::Key_Hangul_Jamo>,
- Xkb2Qt<XKB_KEY_Hangul_Romaja, Qt::Key_Hangul_Romaja>,
- //Xkb2Qt<XKB_KEY_Hangul_Codeinput, Qt::Key_Hangul_Codeinput>,
- Xkb2Qt<XKB_KEY_Hangul_Codeinput, Qt::Key_Codeinput>,
- Xkb2Qt<XKB_KEY_Hangul_Jeonja, Qt::Key_Hangul_Jeonja>,
- Xkb2Qt<XKB_KEY_Hangul_Banja, Qt::Key_Hangul_Banja>,
- Xkb2Qt<XKB_KEY_Hangul_PreHanja, Qt::Key_Hangul_PreHanja>,
- Xkb2Qt<XKB_KEY_Hangul_PostHanja, Qt::Key_Hangul_PostHanja>,
- //Xkb2Qt<XKB_KEY_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate>,
- //Xkb2Qt<XKB_KEY_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate>,
- //Xkb2Qt<XKB_KEY_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate>,
- Xkb2Qt<XKB_KEY_Hangul_SingleCandidate, Qt::Key_SingleCandidate>,
- Xkb2Qt<XKB_KEY_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate>,
- Xkb2Qt<XKB_KEY_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate>,
- Xkb2Qt<XKB_KEY_Hangul_Special, Qt::Key_Hangul_Special>,
- //Xkb2Qt<XKB_KEY_Hangul_switch, Qt::Key_Hangul_switch>,
- Xkb2Qt<XKB_KEY_Hangul_switch, Qt::Key_Mode_switch>,
-
- // dead keys
- Xkb2Qt<XKB_KEY_dead_grave, Qt::Key_Dead_Grave>,
- Xkb2Qt<XKB_KEY_dead_acute, Qt::Key_Dead_Acute>,
- Xkb2Qt<XKB_KEY_dead_circumflex, Qt::Key_Dead_Circumflex>,
- Xkb2Qt<XKB_KEY_dead_tilde, Qt::Key_Dead_Tilde>,
- Xkb2Qt<XKB_KEY_dead_macron, Qt::Key_Dead_Macron>,
- Xkb2Qt<XKB_KEY_dead_breve, Qt::Key_Dead_Breve>,
- Xkb2Qt<XKB_KEY_dead_abovedot, Qt::Key_Dead_Abovedot>,
- Xkb2Qt<XKB_KEY_dead_diaeresis, Qt::Key_Dead_Diaeresis>,
- Xkb2Qt<XKB_KEY_dead_abovering, Qt::Key_Dead_Abovering>,
- Xkb2Qt<XKB_KEY_dead_doubleacute, Qt::Key_Dead_Doubleacute>,
- Xkb2Qt<XKB_KEY_dead_caron, Qt::Key_Dead_Caron>,
- Xkb2Qt<XKB_KEY_dead_cedilla, Qt::Key_Dead_Cedilla>,
- Xkb2Qt<XKB_KEY_dead_ogonek, Qt::Key_Dead_Ogonek>,
- Xkb2Qt<XKB_KEY_dead_iota, Qt::Key_Dead_Iota>,
- Xkb2Qt<XKB_KEY_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound>,
- Xkb2Qt<XKB_KEY_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound>,
- Xkb2Qt<XKB_KEY_dead_belowdot, Qt::Key_Dead_Belowdot>,
- Xkb2Qt<XKB_KEY_dead_hook, Qt::Key_Dead_Hook>,
- Xkb2Qt<XKB_KEY_dead_horn, Qt::Key_Dead_Horn>,
- Xkb2Qt<XKB_KEY_dead_stroke, Qt::Key_Dead_Stroke>,
- Xkb2Qt<XKB_KEY_dead_abovecomma, Qt::Key_Dead_Abovecomma>,
- Xkb2Qt<XKB_KEY_dead_abovereversedcomma, Qt::Key_Dead_Abovereversedcomma>,
- Xkb2Qt<XKB_KEY_dead_doublegrave, Qt::Key_Dead_Doublegrave>,
- Xkb2Qt<XKB_KEY_dead_belowring, Qt::Key_Dead_Belowring>,
- Xkb2Qt<XKB_KEY_dead_belowmacron, Qt::Key_Dead_Belowmacron>,
- Xkb2Qt<XKB_KEY_dead_belowcircumflex, Qt::Key_Dead_Belowcircumflex>,
- Xkb2Qt<XKB_KEY_dead_belowtilde, Qt::Key_Dead_Belowtilde>,
- Xkb2Qt<XKB_KEY_dead_belowbreve, Qt::Key_Dead_Belowbreve>,
- Xkb2Qt<XKB_KEY_dead_belowdiaeresis, Qt::Key_Dead_Belowdiaeresis>,
- Xkb2Qt<XKB_KEY_dead_invertedbreve, Qt::Key_Dead_Invertedbreve>,
- Xkb2Qt<XKB_KEY_dead_belowcomma, Qt::Key_Dead_Belowcomma>,
- Xkb2Qt<XKB_KEY_dead_currency, Qt::Key_Dead_Currency>,
- Xkb2Qt<XKB_KEY_dead_a, Qt::Key_Dead_a>,
- Xkb2Qt<XKB_KEY_dead_A, Qt::Key_Dead_A>,
- Xkb2Qt<XKB_KEY_dead_e, Qt::Key_Dead_e>,
- Xkb2Qt<XKB_KEY_dead_E, Qt::Key_Dead_E>,
- Xkb2Qt<XKB_KEY_dead_i, Qt::Key_Dead_i>,
- Xkb2Qt<XKB_KEY_dead_I, Qt::Key_Dead_I>,
- Xkb2Qt<XKB_KEY_dead_o, Qt::Key_Dead_o>,
- Xkb2Qt<XKB_KEY_dead_O, Qt::Key_Dead_O>,
- Xkb2Qt<XKB_KEY_dead_u, Qt::Key_Dead_u>,
- Xkb2Qt<XKB_KEY_dead_U, Qt::Key_Dead_U>,
- Xkb2Qt<XKB_KEY_dead_small_schwa, Qt::Key_Dead_Small_Schwa>,
- Xkb2Qt<XKB_KEY_dead_capital_schwa, Qt::Key_Dead_Capital_Schwa>,
- Xkb2Qt<XKB_KEY_dead_greek, Qt::Key_Dead_Greek>,
- Xkb2Qt<XKB_KEY_dead_lowline, Qt::Key_Dead_Lowline>,
- Xkb2Qt<XKB_KEY_dead_aboveverticalline, Qt::Key_Dead_Aboveverticalline>,
- Xkb2Qt<XKB_KEY_dead_belowverticalline, Qt::Key_Dead_Belowverticalline>,
- Xkb2Qt<XKB_KEY_dead_longsolidusoverlay, Qt::Key_Dead_Longsolidusoverlay>,
-
- // Special keys from X.org - This include multimedia keys,
- // wireless/bluetooth/uwb keys, special launcher keys, etc.
- Xkb2Qt<XKB_KEY_XF86Back, Qt::Key_Back>,
- Xkb2Qt<XKB_KEY_XF86Forward, Qt::Key_Forward>,
- Xkb2Qt<XKB_KEY_XF86Stop, Qt::Key_Stop>,
- Xkb2Qt<XKB_KEY_XF86Refresh, Qt::Key_Refresh>,
- Xkb2Qt<XKB_KEY_XF86Favorites, Qt::Key_Favorites>,
- Xkb2Qt<XKB_KEY_XF86AudioMedia, Qt::Key_LaunchMedia>,
- Xkb2Qt<XKB_KEY_XF86OpenURL, Qt::Key_OpenUrl>,
- Xkb2Qt<XKB_KEY_XF86HomePage, Qt::Key_HomePage>,
- Xkb2Qt<XKB_KEY_XF86Search, Qt::Key_Search>,
- Xkb2Qt<XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown>,
- Xkb2Qt<XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute>,
- Xkb2Qt<XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp>,
- Xkb2Qt<XKB_KEY_XF86AudioPlay, Qt::Key_MediaPlay>,
- Xkb2Qt<XKB_KEY_XF86AudioStop, Qt::Key_MediaStop>,
- Xkb2Qt<XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious>,
- Xkb2Qt<XKB_KEY_XF86AudioNext, Qt::Key_MediaNext>,
- Xkb2Qt<XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord>,
- Xkb2Qt<XKB_KEY_XF86AudioPause, Qt::Key_MediaPause>,
- Xkb2Qt<XKB_KEY_XF86Mail, Qt::Key_LaunchMail>,
- Xkb2Qt<XKB_KEY_XF86MyComputer, Qt::Key_Launch0>, // ### Qt 6: remap properly
- Xkb2Qt<XKB_KEY_XF86Calculator, Qt::Key_Launch1>,
- Xkb2Qt<XKB_KEY_XF86Memo, Qt::Key_Memo>,
- Xkb2Qt<XKB_KEY_XF86ToDoList, Qt::Key_ToDoList>,
- Xkb2Qt<XKB_KEY_XF86Calendar, Qt::Key_Calendar>,
- Xkb2Qt<XKB_KEY_XF86PowerDown, Qt::Key_PowerDown>,
- Xkb2Qt<XKB_KEY_XF86ContrastAdjust, Qt::Key_ContrastAdjust>,
- Xkb2Qt<XKB_KEY_XF86Standby, Qt::Key_Standby>,
- Xkb2Qt<XKB_KEY_XF86MonBrightnessUp, Qt::Key_MonBrightnessUp>,
- Xkb2Qt<XKB_KEY_XF86MonBrightnessDown, Qt::Key_MonBrightnessDown>,
- Xkb2Qt<XKB_KEY_XF86KbdLightOnOff, Qt::Key_KeyboardLightOnOff>,
- Xkb2Qt<XKB_KEY_XF86KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp>,
- Xkb2Qt<XKB_KEY_XF86KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown>,
- Xkb2Qt<XKB_KEY_XF86PowerOff, Qt::Key_PowerOff>,
- Xkb2Qt<XKB_KEY_XF86WakeUp, Qt::Key_WakeUp>,
- Xkb2Qt<XKB_KEY_XF86Eject, Qt::Key_Eject>,
- Xkb2Qt<XKB_KEY_XF86ScreenSaver, Qt::Key_ScreenSaver>,
- Xkb2Qt<XKB_KEY_XF86WWW, Qt::Key_WWW>,
- Xkb2Qt<XKB_KEY_XF86Sleep, Qt::Key_Sleep>,
- Xkb2Qt<XKB_KEY_XF86LightBulb, Qt::Key_LightBulb>,
- Xkb2Qt<XKB_KEY_XF86Shop, Qt::Key_Shop>,
- Xkb2Qt<XKB_KEY_XF86History, Qt::Key_History>,
- Xkb2Qt<XKB_KEY_XF86AddFavorite, Qt::Key_AddFavorite>,
- Xkb2Qt<XKB_KEY_XF86HotLinks, Qt::Key_HotLinks>,
- Xkb2Qt<XKB_KEY_XF86BrightnessAdjust, Qt::Key_BrightnessAdjust>,
- Xkb2Qt<XKB_KEY_XF86Finance, Qt::Key_Finance>,
- Xkb2Qt<XKB_KEY_XF86Community, Qt::Key_Community>,
- Xkb2Qt<XKB_KEY_XF86AudioRewind, Qt::Key_AudioRewind>,
- Xkb2Qt<XKB_KEY_XF86BackForward, Qt::Key_BackForward>,
- Xkb2Qt<XKB_KEY_XF86ApplicationLeft, Qt::Key_ApplicationLeft>,
- Xkb2Qt<XKB_KEY_XF86ApplicationRight, Qt::Key_ApplicationRight>,
- Xkb2Qt<XKB_KEY_XF86Book, Qt::Key_Book>,
- Xkb2Qt<XKB_KEY_XF86CD, Qt::Key_CD>,
- Xkb2Qt<XKB_KEY_XF86Calculater, Qt::Key_Calculator>,
- Xkb2Qt<XKB_KEY_XF86Clear, Qt::Key_Clear>,
- Xkb2Qt<XKB_KEY_XF86ClearGrab, Qt::Key_ClearGrab>,
- Xkb2Qt<XKB_KEY_XF86Close, Qt::Key_Close>,
- Xkb2Qt<XKB_KEY_XF86Copy, Qt::Key_Copy>,
- Xkb2Qt<XKB_KEY_XF86Cut, Qt::Key_Cut>,
- Xkb2Qt<XKB_KEY_XF86Display, Qt::Key_Display>,
- Xkb2Qt<XKB_KEY_XF86DOS, Qt::Key_DOS>,
- Xkb2Qt<XKB_KEY_XF86Documents, Qt::Key_Documents>,
- Xkb2Qt<XKB_KEY_XF86Excel, Qt::Key_Excel>,
- Xkb2Qt<XKB_KEY_XF86Explorer, Qt::Key_Explorer>,
- Xkb2Qt<XKB_KEY_XF86Game, Qt::Key_Game>,
- Xkb2Qt<XKB_KEY_XF86Go, Qt::Key_Go>,
- Xkb2Qt<XKB_KEY_XF86iTouch, Qt::Key_iTouch>,
- Xkb2Qt<XKB_KEY_XF86LogOff, Qt::Key_LogOff>,
- Xkb2Qt<XKB_KEY_XF86Market, Qt::Key_Market>,
- Xkb2Qt<XKB_KEY_XF86Meeting, Qt::Key_Meeting>,
- Xkb2Qt<XKB_KEY_XF86MenuKB, Qt::Key_MenuKB>,
- Xkb2Qt<XKB_KEY_XF86MenuPB, Qt::Key_MenuPB>,
- Xkb2Qt<XKB_KEY_XF86MySites, Qt::Key_MySites>,
- Xkb2Qt<XKB_KEY_XF86New, Qt::Key_New>,
- Xkb2Qt<XKB_KEY_XF86News, Qt::Key_News>,
- Xkb2Qt<XKB_KEY_XF86OfficeHome, Qt::Key_OfficeHome>,
- Xkb2Qt<XKB_KEY_XF86Open, Qt::Key_Open>,
- Xkb2Qt<XKB_KEY_XF86Option, Qt::Key_Option>,
- Xkb2Qt<XKB_KEY_XF86Paste, Qt::Key_Paste>,
- Xkb2Qt<XKB_KEY_XF86Phone, Qt::Key_Phone>,
- Xkb2Qt<XKB_KEY_XF86Reply, Qt::Key_Reply>,
- Xkb2Qt<XKB_KEY_XF86Reload, Qt::Key_Reload>,
- Xkb2Qt<XKB_KEY_XF86RotateWindows, Qt::Key_RotateWindows>,
- Xkb2Qt<XKB_KEY_XF86RotationPB, Qt::Key_RotationPB>,
- Xkb2Qt<XKB_KEY_XF86RotationKB, Qt::Key_RotationKB>,
- Xkb2Qt<XKB_KEY_XF86Save, Qt::Key_Save>,
- Xkb2Qt<XKB_KEY_XF86Send, Qt::Key_Send>,
- Xkb2Qt<XKB_KEY_XF86Spell, Qt::Key_Spell>,
- Xkb2Qt<XKB_KEY_XF86SplitScreen, Qt::Key_SplitScreen>,
- Xkb2Qt<XKB_KEY_XF86Support, Qt::Key_Support>,
- Xkb2Qt<XKB_KEY_XF86TaskPane, Qt::Key_TaskPane>,
- Xkb2Qt<XKB_KEY_XF86Terminal, Qt::Key_Terminal>,
- Xkb2Qt<XKB_KEY_XF86Tools, Qt::Key_Tools>,
- Xkb2Qt<XKB_KEY_XF86Travel, Qt::Key_Travel>,
- Xkb2Qt<XKB_KEY_XF86Video, Qt::Key_Video>,
- Xkb2Qt<XKB_KEY_XF86Word, Qt::Key_Word>,
- Xkb2Qt<XKB_KEY_XF86Xfer, Qt::Key_Xfer>,
- Xkb2Qt<XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn>,
- Xkb2Qt<XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut>,
- Xkb2Qt<XKB_KEY_XF86Away, Qt::Key_Away>,
- Xkb2Qt<XKB_KEY_XF86Messenger, Qt::Key_Messenger>,
- Xkb2Qt<XKB_KEY_XF86WebCam, Qt::Key_WebCam>,
- Xkb2Qt<XKB_KEY_XF86MailForward, Qt::Key_MailForward>,
- Xkb2Qt<XKB_KEY_XF86Pictures, Qt::Key_Pictures>,
- Xkb2Qt<XKB_KEY_XF86Music, Qt::Key_Music>,
- Xkb2Qt<XKB_KEY_XF86Battery, Qt::Key_Battery>,
- Xkb2Qt<XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth>,
- Xkb2Qt<XKB_KEY_XF86WLAN, Qt::Key_WLAN>,
- Xkb2Qt<XKB_KEY_XF86UWB, Qt::Key_UWB>,
- Xkb2Qt<XKB_KEY_XF86AudioForward, Qt::Key_AudioForward>,
- Xkb2Qt<XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat>,
- Xkb2Qt<XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay>,
- Xkb2Qt<XKB_KEY_XF86Subtitle, Qt::Key_Subtitle>,
- Xkb2Qt<XKB_KEY_XF86AudioCycleTrack, Qt::Key_AudioCycleTrack>,
- Xkb2Qt<XKB_KEY_XF86Time, Qt::Key_Time>,
- Xkb2Qt<XKB_KEY_XF86Select, Qt::Key_Select>,
- Xkb2Qt<XKB_KEY_XF86View, Qt::Key_View>,
- Xkb2Qt<XKB_KEY_XF86TopMenu, Qt::Key_TopMenu>,
- Xkb2Qt<XKB_KEY_XF86Red, Qt::Key_Red>,
- Xkb2Qt<XKB_KEY_XF86Green, Qt::Key_Green>,
- Xkb2Qt<XKB_KEY_XF86Yellow, Qt::Key_Yellow>,
- Xkb2Qt<XKB_KEY_XF86Blue, Qt::Key_Blue>,
- Xkb2Qt<XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth>,
- Xkb2Qt<XKB_KEY_XF86Suspend, Qt::Key_Suspend>,
- Xkb2Qt<XKB_KEY_XF86Hibernate, Qt::Key_Hibernate>,
- Xkb2Qt<XKB_KEY_XF86TouchpadToggle, Qt::Key_TouchpadToggle>,
- Xkb2Qt<XKB_KEY_XF86TouchpadOn, Qt::Key_TouchpadOn>,
- Xkb2Qt<XKB_KEY_XF86TouchpadOff, Qt::Key_TouchpadOff>,
- Xkb2Qt<XKB_KEY_XF86AudioMicMute, Qt::Key_MicMute>,
- Xkb2Qt<XKB_KEY_XF86Launch0, Qt::Key_Launch2>, // ### Qt 6: remap properly
- Xkb2Qt<XKB_KEY_XF86Launch1, Qt::Key_Launch3>,
- Xkb2Qt<XKB_KEY_XF86Launch2, Qt::Key_Launch4>,
- Xkb2Qt<XKB_KEY_XF86Launch3, Qt::Key_Launch5>,
- Xkb2Qt<XKB_KEY_XF86Launch4, Qt::Key_Launch6>,
- Xkb2Qt<XKB_KEY_XF86Launch5, Qt::Key_Launch7>,
- Xkb2Qt<XKB_KEY_XF86Launch6, Qt::Key_Launch8>,
- Xkb2Qt<XKB_KEY_XF86Launch7, Qt::Key_Launch9>,
- Xkb2Qt<XKB_KEY_XF86Launch8, Qt::Key_LaunchA>,
- Xkb2Qt<XKB_KEY_XF86Launch9, Qt::Key_LaunchB>,
- Xkb2Qt<XKB_KEY_XF86LaunchA, Qt::Key_LaunchC>,
- Xkb2Qt<XKB_KEY_XF86LaunchB, Qt::Key_LaunchD>,
- Xkb2Qt<XKB_KEY_XF86LaunchC, Qt::Key_LaunchE>,
- Xkb2Qt<XKB_KEY_XF86LaunchD, Qt::Key_LaunchF>,
- Xkb2Qt<XKB_KEY_XF86LaunchE, Qt::Key_LaunchG>,
- Xkb2Qt<XKB_KEY_XF86LaunchF, Qt::Key_LaunchH>
- >::Data{}
-);
-
-xkb_keysym_t QXkbCommon::qxkbcommon_xkb_keysym_to_upper(xkb_keysym_t ks)
-{
- xkb_keysym_t lower, upper;
-
- xkbcommon_XConvertCase(ks, &lower, &upper);
-
- return upper;
-}
-
-QString QXkbCommon::lookupString(struct xkb_state *state, xkb_keycode_t code)
-{
- QVarLengthArray<char, 32> chars(32);
- const int size = xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
- if (Q_UNLIKELY(size + 1 > chars.size())) { // +1 for NUL
- chars.resize(size + 1);
- xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
- }
- return QString::fromUtf8(chars.constData(), size);
-}
-
-QString QXkbCommon::lookupStringNoKeysymTransformations(xkb_keysym_t keysym)
-{
- QVarLengthArray<char, 32> chars(32);
- const int size = xkb_keysym_to_utf8(keysym, chars.data(), chars.size());
- if (size == 0)
- return QString(); // the keysym does not have a Unicode representation
-
- if (Q_UNLIKELY(size > chars.size())) {
- chars.resize(size);
- xkb_keysym_to_utf8(keysym, chars.data(), chars.size());
- }
- return QString::fromUtf8(chars.constData(), size - 1);
-}
-
-QVector<xkb_keysym_t> QXkbCommon::toKeysym(QKeyEvent *event)
-{
- QVector<xkb_keysym_t> keysyms;
- int qtKey = event->key();
-
- if (qtKey >= Qt::Key_F1 && qtKey <= Qt::Key_F35) {
- keysyms.append(XKB_KEY_F1 + (qtKey - Qt::Key_F1));
- } else if (event->modifiers() & Qt::KeypadModifier) {
- if (qtKey >= Qt::Key_0 && qtKey <= Qt::Key_9)
- keysyms.append(XKB_KEY_KP_0 + (qtKey - Qt::Key_0));
- } else if (isLatin(qtKey) && event->text().isUpper()) {
- keysyms.append(qtKey);
- }
-
- if (!keysyms.isEmpty())
- return keysyms;
-
- // check if we have a direct mapping
- auto it = std::find_if(KeyTbl.cbegin(), KeyTbl.cend(), [&qtKey](xkb2qt_t elem) {
- return elem.qt == static_cast<uint>(qtKey);
- });
- if (it != KeyTbl.end()) {
- keysyms.append(it->xkb);
- return keysyms;
- }
-
- QVector<uint> ucs4;
- if (event->text().isEmpty())
- ucs4.append(qtKey);
- else
- ucs4 = event->text().toUcs4();
-
- // From libxkbcommon keysym-utf.c:
- // "We allow to represent any UCS character in the range U-00000000 to
- // U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff."
- for (uint utf32 : qAsConst(ucs4))
- keysyms.append(utf32 | 0x01000000);
-
- return keysyms;
-}
-
-int QXkbCommon::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers)
-{
- return keysymToQtKey(keysym, modifiers, nullptr, 0);
-}
-
-int QXkbCommon::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers,
- xkb_state *state, xkb_keycode_t code,
- bool superAsMeta, bool hyperAsMeta)
-{
- // Note 1: All standard key sequences on linux (as defined in platform theme)
- // that use a latin character also contain a control modifier, which is why
- // checking for Qt::ControlModifier is sufficient here. It is possible to
- // override QPlatformTheme::keyBindings() and provide custom sequences for
- // QKeySequence::StandardKey. Custom sequences probably should respect this
- // convention (alternatively, we could test against other modifiers here).
- // Note 2: The possibleKeys() shorcut mechanism is not affected by this value
- // adjustment and does its own thing.
- if (modifiers & Qt::ControlModifier) {
- // With standard shortcuts we should prefer a latin character, this is
- // for checks like "some qkeyevent == QKeySequence::Copy" to work even
- // when using for example 'russian' keyboard layout.
- if (!QXkbCommon::isLatin(keysym)) {
- xkb_keysym_t latinKeysym = QXkbCommon::lookupLatinKeysym(state, code);
- if (latinKeysym != XKB_KEY_NoSymbol)
- keysym = latinKeysym;
- }
- }
-
- return keysymToQtKey_internal(keysym, modifiers, state, code, superAsMeta, hyperAsMeta);
-}
-
-static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers,
- xkb_state *state, xkb_keycode_t code,
- bool superAsMeta, bool hyperAsMeta)
-{
- int qtKey = 0;
-
- // lookup from direct mapping
- if (keysym >= XKB_KEY_F1 && keysym <= XKB_KEY_F35) {
- // function keys
- qtKey = Qt::Key_F1 + (keysym - XKB_KEY_F1);
- } else if (keysym >= XKB_KEY_KP_0 && keysym <= XKB_KEY_KP_9) {
- // numeric keypad keys
- qtKey = Qt::Key_0 + (keysym - XKB_KEY_KP_0);
- } else if (QXkbCommon::isLatin(keysym)) {
- qtKey = QXkbCommon::qxkbcommon_xkb_keysym_to_upper(keysym);
- } else {
- // check if we have a direct mapping
- xkb2qt_t searchKey{keysym, 0};
- auto it = std::lower_bound(KeyTbl.cbegin(), KeyTbl.cend(), searchKey);
- if (it != KeyTbl.end() && !(searchKey < *it))
- qtKey = it->qt;
- }
-
- if (qtKey)
- return qtKey;
-
- // lookup from unicode
- QString text;
- if (!state || modifiers & Qt::ControlModifier) {
- // Control modifier changes the text to ASCII control character, therefore we
- // can't use this text to map keysym to a qt key. We can use the same keysym
- // (it is not affectd by transformation) to obtain untransformed text. For details
- // see "Appendix A. Default Symbol Transformations" in the XKB specification.
- text = QXkbCommon::lookupStringNoKeysymTransformations(keysym);
- } else {
- text = QXkbCommon::lookupString(state, code);
- }
- if (!text.isEmpty()) {
- if (text.unicode()->isDigit()) {
- // Ensures that also non-latin digits are mapped to corresponding qt keys,
- // e.g CTRL + ۲ (arabic two), is mapped to CTRL + Qt::Key_2.
- qtKey = Qt::Key_0 + text.unicode()->digitValue();
- } else {
- qtKey = text.unicode()->toUpper().unicode();
- }
- }
-
- // translate Super/Hyper keys to Meta if we're using them as the MetaModifier
- if (superAsMeta && (qtKey == Qt::Key_Super_L || qtKey == Qt::Key_Super_R))
- qtKey = Qt::Key_Meta;
- if (hyperAsMeta && (qtKey == Qt::Key_Hyper_L || qtKey == Qt::Key_Hyper_R))
- qtKey = Qt::Key_Meta;
-
- return qtKey;
-}
-
-Qt::KeyboardModifiers QXkbCommon::modifiers(struct xkb_state *state)
-{
- Qt::KeyboardModifiers modifiers = Qt::NoModifier;
-
- if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE) > 0)
- modifiers |= Qt::ControlModifier;
- if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_ALT, XKB_STATE_MODS_EFFECTIVE) > 0)
- modifiers |= Qt::AltModifier;
- if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_EFFECTIVE) > 0)
- modifiers |= Qt::ShiftModifier;
- if (xkb_state_mod_name_is_active(state, XKB_MOD_NAME_LOGO, XKB_STATE_MODS_EFFECTIVE) > 0)
- modifiers |= Qt::MetaModifier;
-
- return modifiers;
-}
-
-// Possible modifier states.
-static const Qt::KeyboardModifiers ModsTbl[] = {
- Qt::NoModifier, // 0
- Qt::ShiftModifier, // 1
- Qt::ControlModifier, // 2
- Qt::ControlModifier | Qt::ShiftModifier, // 3
- Qt::AltModifier, // 4
- Qt::AltModifier | Qt::ShiftModifier, // 5
- Qt::AltModifier | Qt::ControlModifier, // 6
- Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 7
- Qt::NoModifier // Fall-back to raw Key_*, for non-latin1 kb layouts
-};
-
-QList<int> QXkbCommon::possibleKeys(xkb_state *state, const QKeyEvent *event,
- bool superAsMeta, bool hyperAsMeta)
-{
- QList<int> result;
- quint32 keycode = event->nativeScanCode();
- Qt::KeyboardModifiers modifiers = event->modifiers();
- xkb_keymap *keymap = xkb_state_get_keymap(state);
- // turn off the modifier bits which doesn't participate in shortcuts
- Qt::KeyboardModifiers notNeeded = Qt::KeypadModifier | Qt::GroupSwitchModifier;
- modifiers &= ~notNeeded;
- // create a fresh kb state and test against the relevant modifier combinations
- ScopedXKBState scopedXkbQueryState(xkb_state_new(keymap));
- xkb_state *queryState = scopedXkbQueryState.get();
- if (!queryState) {
- qCWarning(lcXkbcommon) << Q_FUNC_INFO << "failed to compile xkb keymap";
- return result;
- }
- // get kb state from the master state and update the temporary state
- xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(state, XKB_STATE_LAYOUT_LOCKED);
- xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LATCHED);
- xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LOCKED);
- xkb_mod_mask_t depressedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_DEPRESSED);
- xkb_state_update_mask(queryState, depressedMods, latchedMods, lockedMods, 0, 0, lockedLayout);
- // handle shortcuts for level three and above
- xkb_layout_index_t layoutIndex = xkb_state_key_get_layout(queryState, keycode);
- xkb_level_index_t levelIndex = 0;
- if (layoutIndex != XKB_LAYOUT_INVALID) {
- levelIndex = xkb_state_key_get_level(queryState, keycode, layoutIndex);
- if (levelIndex == XKB_LEVEL_INVALID)
- levelIndex = 0;
- }
- if (levelIndex <= 1)
- xkb_state_update_mask(queryState, 0, latchedMods, lockedMods, 0, 0, lockedLayout);
-
- xkb_keysym_t sym = xkb_state_key_get_one_sym(queryState, keycode);
- if (sym == XKB_KEY_NoSymbol)
- return result;
-
- int baseQtKey = keysymToQtKey_internal(sym, modifiers, queryState, keycode, superAsMeta, hyperAsMeta);
- if (baseQtKey)
- result += (baseQtKey + modifiers);
-
- xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(keymap, "Shift");
- xkb_mod_index_t altMod = xkb_keymap_mod_get_index(keymap, "Alt");
- xkb_mod_index_t controlMod = xkb_keymap_mod_get_index(keymap, "Control");
- xkb_mod_index_t metaMod = xkb_keymap_mod_get_index(keymap, "Meta");
-
- Q_ASSERT(shiftMod < 32);
- Q_ASSERT(altMod < 32);
- Q_ASSERT(controlMod < 32);
-
- xkb_mod_mask_t depressed;
- int qtKey = 0;
- // obtain a list of possible shortcuts for the given key event
- for (uint i = 1; i < sizeof(ModsTbl) / sizeof(*ModsTbl) ; ++i) {
- Qt::KeyboardModifiers neededMods = ModsTbl[i];
- if ((modifiers & neededMods) == neededMods) {
- if (i == 8) {
- if (isLatin(baseQtKey))
- continue;
- // add a latin key as a fall back key
- sym = lookupLatinKeysym(state, keycode);
- } else {
- depressed = 0;
- if (neededMods & Qt::AltModifier)
- depressed |= (1 << altMod);
- if (neededMods & Qt::ShiftModifier)
- depressed |= (1 << shiftMod);
- if (neededMods & Qt::ControlModifier)
- depressed |= (1 << controlMod);
- if (metaMod < 32 && neededMods & Qt::MetaModifier)
- depressed |= (1 << metaMod);
- xkb_state_update_mask(queryState, depressed, latchedMods, lockedMods, 0, 0, lockedLayout);
- sym = xkb_state_key_get_one_sym(queryState, keycode);
- }
- if (sym == XKB_KEY_NoSymbol)
- continue;
-
- Qt::KeyboardModifiers mods = modifiers & ~neededMods;
- qtKey = keysymToQtKey_internal(sym, mods, queryState, keycode, superAsMeta, hyperAsMeta);
- if (!qtKey || qtKey == baseQtKey)
- continue;
-
- // catch only more specific shortcuts, i.e. Ctrl+Shift+= also generates Ctrl++ and +,
- // but Ctrl++ is more specific than +, so we should skip the last one
- bool ambiguous = false;
- for (int shortcut : qAsConst(result)) {
- if (int(shortcut & ~Qt::KeyboardModifierMask) == qtKey && (shortcut & mods) == mods) {
- ambiguous = true;
- break;
- }
- }
- if (ambiguous)
- continue;
-
- result += (qtKey + mods);
- }
- }
-
- return result;
-}
-
-void QXkbCommon::verifyHasLatinLayout(xkb_keymap *keymap)
-{
- const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts(keymap);
- const xkb_keycode_t minKeycode = xkb_keymap_min_keycode(keymap);
- const xkb_keycode_t maxKeycode = xkb_keymap_max_keycode(keymap);
-
- const xkb_keysym_t *keysyms = nullptr;
- int nrLatinKeys = 0;
- for (xkb_layout_index_t layout = 0; layout < layoutCount; ++layout) {
- for (xkb_keycode_t code = minKeycode; code < maxKeycode; ++code) {
- xkb_keymap_key_get_syms_by_level(keymap, code, layout, 0, &keysyms);
- if (keysyms && isLatin(keysyms[0]))
- nrLatinKeys++;
- if (nrLatinKeys > 10) // arbitrarily chosen threshold
- return;
- }
- }
- // This means that lookupLatinKeysym() will not find anything and latin
- // key shortcuts might not work. This is a bug in the affected desktop
- // environment. Usually can be solved via system settings by adding e.g. 'us'
- // layout to the list of seleced layouts, or by using command line, "setxkbmap
- // -layout rus,en". The position of latin key based layout in the list of the
- // selected layouts is irrelevant. Properly functioning desktop environments
- // handle this behind the scenes, even if no latin key based layout has been
- // explicitly listed in the selected layouts.
- qCDebug(lcXkbcommon, "no keyboard layouts with latin keys present");
-}
-
-xkb_keysym_t QXkbCommon::lookupLatinKeysym(xkb_state *state, xkb_keycode_t keycode)
-{
- xkb_layout_index_t layout;
- xkb_keysym_t sym = XKB_KEY_NoSymbol;
- xkb_keymap *keymap = xkb_state_get_keymap(state);
- const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts_for_key(keymap, keycode);
- const xkb_layout_index_t currentLayout = xkb_state_key_get_layout(state, keycode);
- // Look at user layouts in the order in which they are defined in system
- // settings to find a latin keysym.
- for (layout = 0; layout < layoutCount; ++layout) {
- if (layout == currentLayout)
- continue;
- const xkb_keysym_t *syms = nullptr;
- xkb_level_index_t level = xkb_state_key_get_level(state, keycode, layout);
- if (xkb_keymap_key_get_syms_by_level(keymap, keycode, layout, level, &syms) != 1)
- continue;
- if (isLatin(syms[0])) {
- sym = syms[0];
- break;
- }
- }
-
- if (sym == XKB_KEY_NoSymbol)
- return sym;
-
- xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LATCHED);
- xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(state, XKB_STATE_MODS_LOCKED);
-
- // Check for uniqueness, consider the following setup:
- // setxkbmap -layout us,ru,us -variant dvorak,, -option 'grp:ctrl_alt_toggle' (set 'ru' as active).
- // In this setup, the user would expect to trigger a ctrl+q shortcut by pressing ctrl+<physical x key>,
- // because "US dvorak" is higher up in the layout settings list. This check verifies that an obtained
- // 'sym' can not be acquired by any other layout higher up in the user's layout list. If it can be acquired
- // then the obtained key is not unique. This prevents ctrl+<physical q key> from generating a ctrl+q
- // shortcut in the above described setup. We don't want ctrl+<physical x key> and ctrl+<physical q key> to
- // generate the same shortcut event in this case.
- const xkb_keycode_t minKeycode = xkb_keymap_min_keycode(keymap);
- const xkb_keycode_t maxKeycode = xkb_keymap_max_keycode(keymap);
- ScopedXKBState queryState(xkb_state_new(keymap));
- for (xkb_layout_index_t prevLayout = 0; prevLayout < layout; ++prevLayout) {
- xkb_state_update_mask(queryState.get(), 0, latchedMods, lockedMods, 0, 0, prevLayout);
- for (xkb_keycode_t code = minKeycode; code < maxKeycode; ++code) {
- xkb_keysym_t prevSym = xkb_state_key_get_one_sym(queryState.get(), code);
- if (prevSym == sym) {
- sym = XKB_KEY_NoSymbol;
- break;
- }
- }
- }
-
- return sym;
-}
-
-void QXkbCommon::setXkbContext(QPlatformInputContext *inputContext, struct xkb_context *context)
-{
- if (!inputContext || !context)
- return;
-
- const char *const inputContextClassName = "QComposeInputContext";
- const char *const normalizedSignature = "setXkbContext(xkb_context*)";
-
- if (inputContext->objectName() != QLatin1String(inputContextClassName))
- return;
-
- static const QMetaMethod setXkbContext = [&]() {
- int methodIndex = inputContext->metaObject()->indexOfMethod(normalizedSignature);
- QMetaMethod method = inputContext->metaObject()->method(methodIndex);
- Q_ASSERT(method.isValid());
- if (!method.isValid())
- qCWarning(lcXkbcommon) << normalizedSignature << "not found on" << inputContextClassName;
- return method;
- }();
-
- if (!setXkbContext.isValid())
- return;
-
- setXkbContext.invoke(inputContext, Qt::DirectConnection, Q_ARG(struct xkb_context*, context));
-}
-
-QT_END_NAMESPACE
diff --git a/src/platformsupport/input/xkbcommon/qxkbcommon_3rdparty.cpp b/src/platformsupport/input/xkbcommon/qxkbcommon_3rdparty.cpp
deleted file mode 100644
index 08f43b3b72..0000000000
--- a/src/platformsupport/input/xkbcommon/qxkbcommon_3rdparty.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/* Copyright 1985, 1987, 1990, 1998 The Open Group
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- Except as contained in this notice, the names of the authors or their
- institutions shall not be used in advertising or otherwise to promote the
- sale, use or other dealings in this Software without prior written
- authorization from the authors.
-
-
-
- Copyright © 2009 Dan Nicholson
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice (including the next
- paragraph) shall be included in all copies or substantial portions of the
- Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- XConvertCase was copied from src/3rdparty/xkbcommon/src/keysym.c
- The following code modifications were applied:
-
- XConvertCase() was renamed to xkbcommon_XConvertCase(), to not confuse it
- with Xlib's XConvertCase().
-
- UCSConvertCase() was renamed to qt_UCSConvertCase() and function's body was
- replaced to use Qt APIs for doing case conversion, which should give us better
- results instead of using the less complete version from keysym.c
-*/
-
-#include "qxkbcommon_p.h"
-
-#include <QtCore/QChar>
-
-static void qt_UCSConvertCase(uint32_t code, xkb_keysym_t *lower, xkb_keysym_t *upper)
-{
- *lower = QChar::toLower(code);
- *upper = QChar::toUpper(code);
-}
-
-void QXkbCommon::xkbcommon_XConvertCase(xkb_keysym_t sym, xkb_keysym_t *lower, xkb_keysym_t *upper)
-{
- /* Latin 1 keysym */
- if (sym < 0x100) {
- qt_UCSConvertCase(sym, lower, upper);
- return;
- }
-
- /* Unicode keysym */
- if ((sym & 0xff000000) == 0x01000000) {
- qt_UCSConvertCase((sym & 0x00ffffff), lower, upper);
- *upper |= 0x01000000;
- *lower |= 0x01000000;
- return;
- }
-
- /* Legacy keysym */
-
- *lower = sym;
- *upper = sym;
-
- switch (sym >> 8) {
- case 1: /* Latin 2 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym == XKB_KEY_Aogonek)
- *lower = XKB_KEY_aogonek;
- else if (sym >= XKB_KEY_Lstroke && sym <= XKB_KEY_Sacute)
- *lower += (XKB_KEY_lstroke - XKB_KEY_Lstroke);
- else if (sym >= XKB_KEY_Scaron && sym <= XKB_KEY_Zacute)
- *lower += (XKB_KEY_scaron - XKB_KEY_Scaron);
- else if (sym >= XKB_KEY_Zcaron && sym <= XKB_KEY_Zabovedot)
- *lower += (XKB_KEY_zcaron - XKB_KEY_Zcaron);
- else if (sym == XKB_KEY_aogonek)
- *upper = XKB_KEY_Aogonek;
- else if (sym >= XKB_KEY_lstroke && sym <= XKB_KEY_sacute)
- *upper -= (XKB_KEY_lstroke - XKB_KEY_Lstroke);
- else if (sym >= XKB_KEY_scaron && sym <= XKB_KEY_zacute)
- *upper -= (XKB_KEY_scaron - XKB_KEY_Scaron);
- else if (sym >= XKB_KEY_zcaron && sym <= XKB_KEY_zabovedot)
- *upper -= (XKB_KEY_zcaron - XKB_KEY_Zcaron);
- else if (sym >= XKB_KEY_Racute && sym <= XKB_KEY_Tcedilla)
- *lower += (XKB_KEY_racute - XKB_KEY_Racute);
- else if (sym >= XKB_KEY_racute && sym <= XKB_KEY_tcedilla)
- *upper -= (XKB_KEY_racute - XKB_KEY_Racute);
- break;
- case 2: /* Latin 3 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= XKB_KEY_Hstroke && sym <= XKB_KEY_Hcircumflex)
- *lower += (XKB_KEY_hstroke - XKB_KEY_Hstroke);
- else if (sym >= XKB_KEY_Gbreve && sym <= XKB_KEY_Jcircumflex)
- *lower += (XKB_KEY_gbreve - XKB_KEY_Gbreve);
- else if (sym >= XKB_KEY_hstroke && sym <= XKB_KEY_hcircumflex)
- *upper -= (XKB_KEY_hstroke - XKB_KEY_Hstroke);
- else if (sym >= XKB_KEY_gbreve && sym <= XKB_KEY_jcircumflex)
- *upper -= (XKB_KEY_gbreve - XKB_KEY_Gbreve);
- else if (sym >= XKB_KEY_Cabovedot && sym <= XKB_KEY_Scircumflex)
- *lower += (XKB_KEY_cabovedot - XKB_KEY_Cabovedot);
- else if (sym >= XKB_KEY_cabovedot && sym <= XKB_KEY_scircumflex)
- *upper -= (XKB_KEY_cabovedot - XKB_KEY_Cabovedot);
- break;
- case 3: /* Latin 4 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= XKB_KEY_Rcedilla && sym <= XKB_KEY_Tslash)
- *lower += (XKB_KEY_rcedilla - XKB_KEY_Rcedilla);
- else if (sym >= XKB_KEY_rcedilla && sym <= XKB_KEY_tslash)
- *upper -= (XKB_KEY_rcedilla - XKB_KEY_Rcedilla);
- else if (sym == XKB_KEY_ENG)
- *lower = XKB_KEY_eng;
- else if (sym == XKB_KEY_eng)
- *upper = XKB_KEY_ENG;
- else if (sym >= XKB_KEY_Amacron && sym <= XKB_KEY_Umacron)
- *lower += (XKB_KEY_amacron - XKB_KEY_Amacron);
- else if (sym >= XKB_KEY_amacron && sym <= XKB_KEY_umacron)
- *upper -= (XKB_KEY_amacron - XKB_KEY_Amacron);
- break;
- case 6: /* Cyrillic */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= XKB_KEY_Serbian_DJE && sym <= XKB_KEY_Serbian_DZE)
- *lower -= (XKB_KEY_Serbian_DJE - XKB_KEY_Serbian_dje);
- else if (sym >= XKB_KEY_Serbian_dje && sym <= XKB_KEY_Serbian_dze)
- *upper += (XKB_KEY_Serbian_DJE - XKB_KEY_Serbian_dje);
- else if (sym >= XKB_KEY_Cyrillic_YU && sym <= XKB_KEY_Cyrillic_HARDSIGN)
- *lower -= (XKB_KEY_Cyrillic_YU - XKB_KEY_Cyrillic_yu);
- else if (sym >= XKB_KEY_Cyrillic_yu && sym <= XKB_KEY_Cyrillic_hardsign)
- *upper += (XKB_KEY_Cyrillic_YU - XKB_KEY_Cyrillic_yu);
- break;
- case 7: /* Greek */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= XKB_KEY_Greek_ALPHAaccent && sym <= XKB_KEY_Greek_OMEGAaccent)
- *lower += (XKB_KEY_Greek_alphaaccent - XKB_KEY_Greek_ALPHAaccent);
- else if (sym >= XKB_KEY_Greek_alphaaccent && sym <= XKB_KEY_Greek_omegaaccent &&
- sym != XKB_KEY_Greek_iotaaccentdieresis &&
- sym != XKB_KEY_Greek_upsilonaccentdieresis)
- *upper -= (XKB_KEY_Greek_alphaaccent - XKB_KEY_Greek_ALPHAaccent);
- else if (sym >= XKB_KEY_Greek_ALPHA && sym <= XKB_KEY_Greek_OMEGA)
- *lower += (XKB_KEY_Greek_alpha - XKB_KEY_Greek_ALPHA);
- else if (sym >= XKB_KEY_Greek_alpha && sym <= XKB_KEY_Greek_omega &&
- sym != XKB_KEY_Greek_finalsmallsigma)
- *upper -= (XKB_KEY_Greek_alpha - XKB_KEY_Greek_ALPHA);
- break;
- case 0x13: /* Latin 9 */
- if (sym == XKB_KEY_OE)
- *lower = XKB_KEY_oe;
- else if (sym == XKB_KEY_oe)
- *upper = XKB_KEY_OE;
- else if (sym == XKB_KEY_Ydiaeresis)
- *lower = XKB_KEY_ydiaeresis;
- break;
- }
-}
diff --git a/src/platformsupport/input/xkbcommon/qxkbcommon_p.h b/src/platformsupport/input/xkbcommon/qxkbcommon_p.h
deleted file mode 100644
index 561eae03db..0000000000
--- a/src/platformsupport/input/xkbcommon/qxkbcommon_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QXKBCOMMON_P_H
-#define QXKBCOMMON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QString>
-#include <QtCore/QVector>
-#include <QtCore/QLoggingCategory>
-#include <QtCore/QList>
-
-#include <xkbcommon/xkbcommon.h>
-
-#include <memory>
-
-QT_BEGIN_NAMESPACE
-
-Q_DECLARE_LOGGING_CATEGORY(lcXkbcommon)
-
-class QEvent;
-class QKeyEvent;
-class QPlatformInputContext;
-
-class QXkbCommon
-{
-public:
- static QString lookupString(struct xkb_state *state, xkb_keycode_t code);
- static QString lookupStringNoKeysymTransformations(xkb_keysym_t keysym);
-
- static QVector<xkb_keysym_t> toKeysym(QKeyEvent *event);
-
- static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers);
- static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers,
- xkb_state *state, xkb_keycode_t code,
- bool superAsMeta = false, bool hyperAsMeta = false);
-
- // xkbcommon_* API is part of libxkbcommon internals, with modifications as
- // desribed in the header of the implementation file.
- static void xkbcommon_XConvertCase(xkb_keysym_t sym, xkb_keysym_t *lower, xkb_keysym_t *upper);
- static xkb_keysym_t qxkbcommon_xkb_keysym_to_upper(xkb_keysym_t ks);
-
- static Qt::KeyboardModifiers modifiers(struct xkb_state *state);
-
- static QList<int> possibleKeys(xkb_state *state, const QKeyEvent *event,
- bool superAsMeta = false, bool hyperAsMeta = false);
-
- static void verifyHasLatinLayout(xkb_keymap *keymap);
- static xkb_keysym_t lookupLatinKeysym(xkb_state *state, xkb_keycode_t keycode);
-
- static bool isLatin(xkb_keysym_t sym) {
- return ((sym >= 'a' && sym <= 'z') || (sym >= 'A' && sym <= 'Z'));
- }
- static bool isKeypad(xkb_keysym_t sym) {
- return sym >= XKB_KEY_KP_Space && sym <= XKB_KEY_KP_9;
- }
-
- static void setXkbContext(QPlatformInputContext *inputContext, struct xkb_context *context);
-
- struct XKBStateDeleter {
- void operator()(struct xkb_state *state) const { return xkb_state_unref(state); }
- };
- struct XKBKeymapDeleter {
- void operator()(struct xkb_keymap *keymap) const { return xkb_keymap_unref(keymap); }
- };
- struct XKBContextDeleter {
- void operator()(struct xkb_context *context) const { return xkb_context_unref(context); }
- };
- using ScopedXKBState = std::unique_ptr<struct xkb_state, XKBStateDeleter>;
- using ScopedXKBKeymap = std::unique_ptr<struct xkb_keymap, XKBKeymapDeleter>;
- using ScopedXKBContext = std::unique_ptr<struct xkb_context, XKBContextDeleter>;
-};
-
-QT_END_NAMESPACE
-
-#endif // QXKBCOMMON_P_H
diff --git a/src/platformsupport/input/xkbcommon/xkbcommon.pro b/src/platformsupport/input/xkbcommon/xkbcommon.pro
deleted file mode 100644
index 22b16ae44a..0000000000
--- a/src/platformsupport/input/xkbcommon/xkbcommon.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TARGET = QtXkbCommonSupport
-MODULE = xkbcommon_support
-
-QT = core-private gui-private
-CONFIG += static internal_module
-
-DEFINES += QT_NO_CAST_FROM_ASCII
-PRECOMPILED_HEADER = ../../../corelib/global/qt_pch.h
-
-QMAKE_USE += xkbcommon
-
-HEADERS += \
- qxkbcommon_p.h
-
-SOURCES += \
- qxkbcommon.cpp \
- qxkbcommon_3rdparty.cpp
-
-# qxkbcommon.cpp::KeyTbl has more than 256 levels of expansion and older
-# Clang uses that as a limit (it's 1024 in current versions).
-clang:!intel_icc: QMAKE_CXXFLAGS += -ftemplate-depth=1024
-
-load(qt_module)