diff options
Diffstat (limited to 'src/platformsupport')
16 files changed, 61 insertions, 45 deletions
diff --git a/src/platformsupport/CMakeLists.txt b/src/platformsupport/CMakeLists.txt index ec9ede6cdb..686c6213d2 100644 --- a/src/platformsupport/CMakeLists.txt +++ b/src/platformsupport/CMakeLists.txt @@ -1,8 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from platformsupport.pro. - add_subdirectory(devicediscovery) add_subdirectory(fbconvenience) if(QT_FEATURE_evdev OR QT_FEATURE_integrityhid OR QT_FEATURE_libinput OR QT_FEATURE_tslib OR QT_FEATURE_xkbcommon) diff --git a/src/platformsupport/devicediscovery/CMakeLists.txt b/src/platformsupport/devicediscovery/CMakeLists.txt index a9dcd6b61e..19c35f6660 100644 --- a/src/platformsupport/devicediscovery/CMakeLists.txt +++ b/src/platformsupport/devicediscovery/CMakeLists.txt @@ -1,8 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from devicediscovery.pro. - ##################################################################### ## DeviceDiscoverySupportPrivate Module: ##################################################################### @@ -17,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/fbconvenience/CMakeLists.txt b/src/platformsupport/fbconvenience/CMakeLists.txt index c5cf7d65d0..7bd7daec0d 100644 --- a/src/platformsupport/fbconvenience/CMakeLists.txt +++ b/src/platformsupport/fbconvenience/CMakeLists.txt @@ -1,8 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from fbconvenience.pro. - ##################################################################### ## FbSupportPrivate Module: ##################################################################### @@ -24,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 e804488005..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); } diff --git a/src/platformsupport/input/CMakeLists.txt b/src/platformsupport/input/CMakeLists.txt index 6f753c6cd4..b7ff09d827 100644 --- a/src/platformsupport/input/CMakeLists.txt +++ b/src/platformsupport/input/CMakeLists.txt @@ -1,12 +1,10 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from input.pro. - -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: @@ -24,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/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp index 112fc62209..55b127ef17 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp @@ -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/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 09375393a8..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(); } } @@ -192,6 +194,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const case 180: case 270: rotationAngle = argValue; + break; default: break; } 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 7e69f9e370..e3a483dc84 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -61,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; @@ -92,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) 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 57aab77e2b..9cd4eb1d33 100644 --- a/src/platformsupport/kmsconvenience/CMakeLists.txt +++ b/src/platformsupport/kmsconvenience/CMakeLists.txt @@ -1,9 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from kmsconvenience.pro. - -qt_find_package(Libdrm) # special case +qt_find_package(Libdrm) ##################################################################### ## KmsSupportPrivate Module: @@ -21,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 89b6df605b..421e9f05c0 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp +++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp @@ -716,6 +716,7 @@ 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) |