summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/CMakeLists.txt3
-rw-r--r--src/platformsupport/devicediscovery/CMakeLists.txt8
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp2
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h6
-rw-r--r--src/platformsupport/fbconvenience/CMakeLists.txt7
-rw-r--r--src/platformsupport/fbconvenience/qfbcursor.cpp2
-rw-r--r--src/platformsupport/fbconvenience/qfbcursor_p.h2
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp12
-rw-r--r--src/platformsupport/fbconvenience/qfbwindow.cpp2
-rw-r--r--src/platformsupport/input/CMakeLists.txt15
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h2
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp2
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp6
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp2
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp19
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp2
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler.cpp2
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard.cpp2
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch.cpp42
-rw-r--r--src/platformsupport/input/shared/qevdevutil.cpp2
-rw-r--r--src/platformsupport/input/tslib/qtslib.cpp9
-rw-r--r--src/platformsupport/kmsconvenience/CMakeLists.txt9
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice.cpp13
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice_p.h2
24 files changed, 106 insertions, 67 deletions
diff --git a/src/platformsupport/CMakeLists.txt b/src/platformsupport/CMakeLists.txt
index b9d99ed1c2..686c6213d2 100644
--- a/src/platformsupport/CMakeLists.txt
+++ b/src/platformsupport/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from platformsupport.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(devicediscovery)
add_subdirectory(fbconvenience)
diff --git a/src/platformsupport/devicediscovery/CMakeLists.txt b/src/platformsupport/devicediscovery/CMakeLists.txt
index e9b87d81b7..19c35f6660 100644
--- a/src/platformsupport/devicediscovery/CMakeLists.txt
+++ b/src/platformsupport/devicediscovery/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from devicediscovery.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## DeviceDiscoverySupportPrivate Module:
@@ -14,12 +15,9 @@ qt_internal_add_module(DeviceDiscoverySupportPrivate
QT_NO_CAST_FROM_ASCII
PUBLIC_LIBRARIES
Qt::CorePrivate
+ NO_GENERATE_CPP_EXPORTS
)
-#### Keys ignored in scope 1:.:.:devicediscovery.pro:<TRUE>:
-# MODULE = "devicediscovery_support"
-# QT_FOR_CONFIG = "gui-private"
-
## Scopes:
#####################################################################
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
index 4c6225a354..45043818a4 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
@@ -41,7 +41,7 @@ QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
QDeviceDiscoveryUDev::QDeviceDiscoveryUDev(QDeviceTypes types, struct udev *udev, QObject *parent) :
QDeviceDiscovery(types, parent),
- m_udev(udev), m_udevMonitor(0), m_udevMonitorFileDescriptor(-1), m_udevSocketNotifier(0)
+ m_udev(udev)
{
if (!m_udev)
return;
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
index c03dd88cec..3074877b5a 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
@@ -41,9 +41,9 @@ private:
void startWatching();
void stopWatching();
- struct udev_monitor *m_udevMonitor;
- int m_udevMonitorFileDescriptor;
- QSocketNotifier *m_udevSocketNotifier;
+ struct udev_monitor *m_udevMonitor = nullptr;
+ int m_udevMonitorFileDescriptor = -1;
+ QSocketNotifier *m_udevSocketNotifier = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fbconvenience/CMakeLists.txt b/src/platformsupport/fbconvenience/CMakeLists.txt
index 280d48058c..7bd7daec0d 100644
--- a/src/platformsupport/fbconvenience/CMakeLists.txt
+++ b/src/platformsupport/fbconvenience/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from fbconvenience.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## FbSupportPrivate Module:
@@ -21,7 +22,5 @@ qt_internal_add_module(FbSupportPrivate
Qt::GuiPrivate
PRECOMPILED_HEADER
"../../corelib/global/qt_pch.h"
+ NO_GENERATE_CPP_EXPORTS
)
-
-#### Keys ignored in scope 1:.:.:fbconvenience.pro:<TRUE>:
-# MODULE = "fb_support"
diff --git a/src/platformsupport/fbconvenience/qfbcursor.cpp b/src/platformsupport/fbconvenience/qfbcursor.cpp
index c686cbf731..9f7e964760 100644
--- a/src/platformsupport/fbconvenience/qfbcursor.cpp
+++ b/src/platformsupport/fbconvenience/qfbcursor.cpp
@@ -33,7 +33,7 @@ QFbCursor::QFbCursor(QFbScreen *screen)
if (!mVisible)
return;
- mCursorImage = new QPlatformCursorImage(0, 0, 0, 0, 0, 0);
+ mCursorImage.reset(new QPlatformCursorImage(0, 0, 0, 0, 0, 0));
setCursor(Qt::ArrowCursor);
mDeviceListener = new QFbCursorDeviceListener(this);
diff --git a/src/platformsupport/fbconvenience/qfbcursor_p.h b/src/platformsupport/fbconvenience/qfbcursor_p.h
index 88ac5bd561..a118440ac9 100644
--- a/src/platformsupport/fbconvenience/qfbcursor_p.h
+++ b/src/platformsupport/fbconvenience/qfbcursor_p.h
@@ -77,7 +77,7 @@ private:
QRect mPrevRect; // last place the cursor was drawn
bool mDirty;
bool mOnScreen;
- QPlatformCursorImage *mCursorImage;
+ QScopedPointer<QPlatformCursorImage> mCursorImage;
QFbCursorDeviceListener *mDeviceListener;
QPoint m_pos;
};
diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp
index 21574133dc..85e2f57198 100644
--- a/src/platformsupport/fbconvenience/qfbscreen.cpp
+++ b/src/platformsupport/fbconvenience/qfbscreen.cpp
@@ -63,7 +63,7 @@ void QFbScreen::addWindow(QFbWindow *window)
}
setDirty(window->geometry());
QWindow *w = topWindow();
- QWindowSystemInterface::handleWindowActivated(w);
+ QWindowSystemInterface::handleFocusWindowChanged(w);
topWindowChanged(w);
}
@@ -72,7 +72,7 @@ void QFbScreen::removeWindow(QFbWindow *window)
mWindowStack.removeOne(window);
setDirty(window->geometry());
QWindow *w = topWindow();
- QWindowSystemInterface::handleWindowActivated(w);
+ QWindowSystemInterface::handleFocusWindowChanged(w);
topWindowChanged(w);
}
@@ -84,7 +84,7 @@ void QFbScreen::raise(QFbWindow *window)
mWindowStack.move(index, 0);
setDirty(window->geometry());
QWindow *w = topWindow();
- QWindowSystemInterface::handleWindowActivated(w);
+ QWindowSystemInterface::handleFocusWindowChanged(w);
topWindowChanged(w);
}
@@ -96,7 +96,7 @@ void QFbScreen::lower(QFbWindow *window)
mWindowStack.move(index, mWindowStack.size() - 1);
setDirty(window->geometry());
QWindow *w = topWindow();
- QWindowSystemInterface::handleWindowActivated(w);
+ QWindowSystemInterface::handleFocusWindowChanged(w);
topWindowChanged(w);
}
@@ -120,7 +120,7 @@ QWindow *QFbScreen::topLevelAt(const QPoint & p) const
int QFbScreen::windowCount() const
{
- return mWindowStack.count();
+ return mWindowStack.size();
}
void QFbScreen::setDirty(const QRect &rect)
@@ -210,7 +210,7 @@ QRegion QFbScreen::doRedraw()
QFbWindow *QFbScreen::windowForId(WId wid) const
{
- for (int i = 0; i < mWindowStack.count(); ++i) {
+ for (int i = 0; i < mWindowStack.size(); ++i) {
if (mWindowStack[i]->winId() == wid)
return mWindowStack[i];
}
diff --git a/src/platformsupport/fbconvenience/qfbwindow.cpp b/src/platformsupport/fbconvenience/qfbwindow.cpp
index 7fbb56f126..54716cc497 100644
--- a/src/platformsupport/fbconvenience/qfbwindow.cpp
+++ b/src/platformsupport/fbconvenience/qfbwindow.cpp
@@ -9,7 +9,7 @@
QT_BEGIN_NAMESPACE
-static QBasicAtomicInt winIdGenerator = Q_BASIC_ATOMIC_INITIALIZER(0);
+Q_CONSTINIT static QBasicAtomicInt winIdGenerator = Q_BASIC_ATOMIC_INITIALIZER(0);
QFbWindow::QFbWindow(QWindow *window)
: QPlatformWindow(window), mBackingStore(0), mWindowState(Qt::WindowNoState)
diff --git a/src/platformsupport/input/CMakeLists.txt b/src/platformsupport/input/CMakeLists.txt
index 3ad593e17f..b7ff09d827 100644
--- a/src/platformsupport/input/CMakeLists.txt
+++ b/src/platformsupport/input/CMakeLists.txt
@@ -1,9 +1,10 @@
-# Generated from input.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-qt_find_package(Libinput) # special case
-qt_find_package(XKB) # special case
-qt_find_package(Tslib) # special case
-qt_find_package(Mtdev) # special case
+qt_find_package(Libinput)
+qt_find_package(XKB)
+qt_find_package(Tslib)
+qt_find_package(Mtdev)
#####################################################################
## InputSupportPrivate Module:
@@ -21,11 +22,9 @@ qt_internal_add_module(InputSupportPrivate
Qt::GuiPrivate
PRECOMPILED_HEADER
"../../corelib/global/qt_pch.h"
+ NO_GENERATE_CPP_EXPORTS
)
-#### Keys ignored in scope 2:.:.:input-support.pro:<TRUE>:
-# MODULE = "input_support"
-
## Scopes:
#####################################################################
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
index ed437c0060..1d991e2ba5 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h
@@ -101,7 +101,7 @@ 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; }
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
index 2888ff06b3..43717c4e81 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
@@ -33,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()) {
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
index 32db2e897c..55b127ef17 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
@@ -34,7 +34,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
auto parsed = QEvdevUtil::parseSpecification(spec);
m_spec = std::move(parsed.spec);
- for (const auto &arg : qAsConst(parsed.args)) {
+ for (const auto &arg : std::as_const(parsed.args)) {
if (arg.startsWith("xoffset="_L1)) {
m_xoffset = arg.mid(8).toInt();
} else if (arg.startsWith("yoffset="_L1)) {
@@ -43,7 +43,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
}
// 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()) {
@@ -62,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/evdevtablet/qevdevtabletmanager.cpp b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
index d4bb9edc92..a270f9700d 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
+++ b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
@@ -33,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
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index fbf483087e..1b0da6297b 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -15,6 +15,8 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qpointingdevice_p.h>
+#include <QtCore/qpointer.h>
+
#include <mutex>
#ifdef Q_OS_FREEBSD
@@ -150,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();
}
}
@@ -181,7 +183,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
int rotationAngle = 0;
bool invertx = false;
bool inverty = false;
- for (int i = 0; i < args.count(); ++i) {
+ 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;
@@ -192,6 +194,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
case 180:
case 270:
rotationAngle = argValue;
+ break;
default:
break;
}
@@ -565,7 +568,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
// 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();
@@ -774,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]);
@@ -901,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));
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
index ce885d0a3b..f2a652c254 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
@@ -33,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
diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp
index 3b49438d0a..ef45533f1a 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler.cpp
+++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp
@@ -79,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);
});
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
index f6640171eb..25939cd510 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
@@ -79,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/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp
index 84a05f565e..e3a483dc84 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch.cpp
+++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp
@@ -14,12 +14,13 @@
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];
@@ -60,6 +61,33 @@ QPointF QLibInputTouch::getPos(libinput_event_touch *e)
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;
@@ -91,6 +119,7 @@ void QLibInputTouch::registerDevice(libinput_device *dev)
if (!geom.isNull())
devPriv->setAvailableVirtualGeometry(geom);
QWindowSystemInterface::registerInputDevice(td);
+ setMatrix(dev);
}
void QLibInputTouch::unregisterDevice(libinput_device *dev)
@@ -113,6 +142,7 @@ void QLibInputTouch::processTouchDown(libinput_event_touch *e)
newTp.area = QRect(0, 0, 8, 8);
newTp.area.moveCenter(getPos(e));
state->m_points.append(newTp);
+ qCDebug(qLcLibInputEvents) << "touch down" << newTp;
}
}
@@ -132,6 +162,7 @@ void QLibInputTouch::processTouchMotion(libinput_event_touch *e)
// Handle this by compressing and keeping the Pressed state until the 'frame'.
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')");
}
@@ -146,10 +177,13 @@ void QLibInputTouch::processTouchUp(libinput_event_touch *e)
tp->state = QEventPoint::State::Released;
// There may not be a Frame event after the last Up. Work this around.
QEventPoint::States s;
- for (int i = 0; i < state->m_points.count(); ++i)
+ for (int i = 0; i < state->m_points.size(); ++i)
s |= state->m_points.at(i).state;
+ 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')");
}
@@ -158,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
@@ -171,13 +206,14 @@ 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 == QEventPoint::State::Released)
state->m_points.removeAt(i--);
diff --git a/src/platformsupport/input/shared/qevdevutil.cpp b/src/platformsupport/input/shared/qevdevutil.cpp
index 4557ac9def..c1ebb9ada0 100644
--- a/src/platformsupport/input/shared/qevdevutil.cpp
+++ b/src/platformsupport/input/shared/qevdevutil.cpp
@@ -15,7 +15,7 @@ ParsedSpecification parseSpecification(const QString &specification)
result.args = QStringView{specification}.split(u':');
- for (const auto &arg : qAsConst(result.args)) {
+ 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());
diff --git a/src/platformsupport/input/tslib/qtslib.cpp b/src/platformsupport/input/tslib/qtslib.cpp
index 299d7801ec..a84cc90dc2 100644
--- a/src/platformsupport/input/tslib/qtslib.cpp
+++ b/src/platformsupport/input/tslib/qtslib.cpp
@@ -79,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;
diff --git a/src/platformsupport/kmsconvenience/CMakeLists.txt b/src/platformsupport/kmsconvenience/CMakeLists.txt
index 1c749971c5..9cd4eb1d33 100644
--- a/src/platformsupport/kmsconvenience/CMakeLists.txt
+++ b/src/platformsupport/kmsconvenience/CMakeLists.txt
@@ -1,6 +1,7 @@
-# Generated from kmsconvenience.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-qt_find_package(Libdrm) # special case
+qt_find_package(Libdrm)
#####################################################################
## KmsSupportPrivate Module:
@@ -18,7 +19,5 @@ qt_internal_add_module(KmsSupportPrivate
Libdrm::Libdrm
Qt::CorePrivate
Qt::GuiPrivate
+ NO_GENERATE_CPP_EXPORTS
)
-
-#### Keys ignored in scope 1:.:.:kmsconvenience.pro:<TRUE>:
-# MODULE = "kms_support"
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
index 74d7bafe1b..421e9f05c0 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp
+++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
@@ -200,7 +200,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) {
const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray();
const QByteArrayList vposComp = vpos.split(',');
- if (vposComp.count() == 2)
+ if (vposComp.size() == 2)
vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt());
}
if (userConnectorConfig.value(QStringLiteral("primary")).toBool())
@@ -284,7 +284,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
if (current < 0 && crtc_mode.clock != 0) {
modes << crtc_mode;
- current = mode.size() - 1;
+ current = modes.size() - 1;
}
if (configuration == OutputConfigCurrent)
@@ -437,7 +437,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
}
}
qCDebug(qLcKmsDebug, "Output %s can use %d planes: %s",
- connectorName.constData(), int(output.available_planes.count()), qPrintable(planeListStr));
+ connectorName.constData(), int(output.available_planes.size()), qPrintable(planeListStr));
// This is for the EGLDevice/EGLStream backend. On some of those devices one
// may want to target a pre-configured plane. It is probably useless for
@@ -478,7 +478,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
const QStringList crtcPlanePairs = val.split(u':');
for (const QString &crtcPlanePair : crtcPlanePairs) {
const QStringList values = crtcPlanePair.split(u',');
- if (values.count() == 2 && uint(values[0].toInt()) == output.crtc_id) {
+ if (values.size() == 2 && uint(values[0].toInt()) == output.crtc_id) {
uint planeId = values[1].toInt();
for (QKmsPlane &kmsplane : m_planes) {
if (kmsplane.id == planeId) {
@@ -716,10 +716,11 @@ void QKmsDevice::createScreens()
// virtualIndex. This is not only handy but also required since for instance
// evdevtouch relies on it when performing touch device - screen mapping.
if (!m_screenConfig->separateScreens()) {
+ qCDebug(qLcKmsDebug) << " virtual position is" << virtualPos;
siblings.append(s);
virtualPositions.append(virtualPos);
if (orderedScreen.vinfo.isPrimary)
- primarySiblingIdx = siblings.count() - 1;
+ primarySiblingIdx = siblings.size() - 1;
} else {
registerScreen(s, orderedScreen.vinfo.isPrimary, virtualPos, QList<QPlatformScreen *>() << s);
}
@@ -727,7 +728,7 @@ void QKmsDevice::createScreens()
if (!m_screenConfig->separateScreens()) {
// enable the virtual desktop
- for (int i = 0; i < siblings.count(); ++i)
+ for (int i = 0; i < siblings.size(); ++i)
registerScreen(siblings[i], i == primarySiblingIdx, virtualPositions[i], siblings);
}
}
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice_p.h b/src/platformsupport/kmsconvenience/qkmsdevice_p.h
index b00ff5b304..050d836cb1 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice_p.h
+++ b/src/platformsupport/kmsconvenience/qkmsdevice_p.h
@@ -30,7 +30,7 @@
#include <functional>
// In less fortunate cases one may need to build on a system with dev headers
-// from the dark ages. Let's pull a GL and define the missing stuff outselves.
+// from the dark ages. Let's pull a GL and define the missing stuff ourselves.
#ifndef DRM_PLANE_TYPE_OVERLAY
#define DRM_PLANE_TYPE_OVERLAY 0