diff --git a/src/3rdparty/wayland/extensions/touch-extension.xml b/src/3rdparty/wayland/extensions/touch-extension.xml
deleted file mode 100644
index 429dadfd9c7..00000000000
--- a/src/3rdparty/wayland/extensions/touch-extension.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
- Copyright (C) 2015 The Qt Company Ltd.
- SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt
index 0018f71307d..577450439b4 100644
--- a/src/plugins/platforms/wayland/CMakeLists.txt
+++ b/src/plugins/platforms/wayland/CMakeLists.txt
@@ -52,7 +52,6 @@ qt_internal_add_module(WaylandClient
qwaylandshmwindow.cpp qwaylandshmwindow_p.h
qwaylandsubsurface.cpp qwaylandsubsurface_p.h
qwaylandsurface.cpp qwaylandsurface_p.h
- qwaylandtouch.cpp qwaylandtouch_p.h
qwaylandviewport.cpp qwaylandviewport_p.h
qwaylandwindow.cpp qwaylandwindow_p.h
qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h
@@ -117,7 +116,6 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient
${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml
${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml
${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/hardware-integration.xml
${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/server-buffer-extension.xml
${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/color-management/xx-color-management-v4.xml
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
index 1ff7d25141d..c6334718b8e 100644
--- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp
+++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
@@ -39,7 +39,6 @@
#include "qwaylandpointergestures_p.h"
#include "qwaylandsubsurface_p.h"
-#include "qwaylandtouch_p.h"
#if QT_CONFIG(tabletevent)
#include "qwaylandtabletv2_p.h"
#endif
@@ -668,8 +667,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
mGlobals.subCompositor.reset(
new WithDestructor(registry,
id, 1));
- } else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) {
- mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id));
#if QT_CONFIG(tabletevent)
} else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) {
mGlobals.tabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version))));
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h
index 15c564b291e..db9007a35f0 100644
--- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h
+++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h
@@ -82,7 +82,6 @@ class QWaylandPrimarySelectionDeviceManagerV1;
class QWaylandTabletManagerV2;
#endif
class QWaylandPointerGestures;
-class QWaylandTouchExtension;
class QWaylandWindow;
class QWaylandIntegration;
class QWaylandHardwareIntegration;
@@ -174,10 +173,6 @@ public:
{
return mGlobals.pointerGestures.get();
}
- QWaylandTouchExtension *touchExtension() const
- {
- return mGlobals.touchExtension.get();
- }
QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const
{
return mGlobals.textInputMethodManager.get();
@@ -342,7 +337,6 @@ private:
std::unique_ptr dndSelectionHandler;
#endif
std::unique_ptr subCompositor;
- std::unique_ptr touchExtension;
#if QT_CONFIG(tabletevent)
std::unique_ptr tabletManager;
#endif
diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
index ff2b22a613b..a612f3ef331 100644
--- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
+++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
@@ -23,7 +23,6 @@
#include "qwaylandtabletv2_p.h"
#endif
#include "qwaylandpointergestures_p.h"
-#include "qwaylandtouch_p.h"
#include "qwaylandscreen_p.h"
#include "qwaylandcursor_p.h"
#include "qwaylanddisplay_p.h"
@@ -1457,10 +1456,6 @@ void QWaylandInputDevice::Touch::touch_cancel()
{
mPendingTouchPoints.clear();
- QWaylandTouchExtension *touchExt = mParent->mQDisplay->touchExtension();
- if (touchExt)
- touchExt->touchCanceled();
-
mFocus = nullptr;
QWindowSystemInterface::handleTouchCancelEvent(nullptr, mParent->mTouchDevice);
}
diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp
deleted file mode 100644
index b38c895520a..00000000000
--- a/src/plugins/platforms/wayland/qwaylandtouch.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-// 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 "qwaylandtouch_p.h"
-#include "qwaylandinputdevice_p.h"
-#include "qwaylanddisplay_p.h"
-#include "qwaylandsurface_p.h"
-
-#include
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id)
- : QtWayland::qt_touch_extension(display->wl_registry(), id, 1),
- mDisplay(display),
- mTouchDevice(nullptr),
- mPointsLeft(0),
- mFlags(0),
- mMouseSourceId(-1),
- mInputDevice(nullptr)
-{
-}
-
-QWaylandTouchExtension::~QWaylandTouchExtension()
-{
- qt_touch_extension_destroy(object());
-}
-
-void QWaylandTouchExtension::registerDevice(int caps)
-{
- // TODO number of touchpoints, actual name and ID
- mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0,
- QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger,
- QInputDevice::Capabilities(caps), 10, 0);
- QWindowSystemInterface::registerInputDevice(mTouchDevice);
-}
-
-static inline qreal fromFixed(int f)
-{
- return f / qreal(10000);
-}
-
-void QWaylandTouchExtension::touch_extension_touch(uint32_t time,
- uint32_t id, uint32_t state, int32_t x, int32_t y,
- int32_t normalized_x, int32_t normalized_y,
- int32_t width, int32_t height, uint32_t pressure,
- int32_t velocity_x, int32_t velocity_y,
- uint32_t flags, wl_array *rawdata)
-{
- if (!mInputDevice) {
- QList inputDevices = mDisplay->inputDevices();
- if (inputDevices.isEmpty()) {
- qWarning("qt_touch_extension: handle_touch: No input devices");
- return;
- }
- mInputDevice = inputDevices.first();
- }
- QWaylandWindow *win = mInputDevice->touchFocus();
- if (!win)
- win = mInputDevice->pointerFocus();
- if (!win)
- win = mInputDevice->keyboardFocus();
- if (!win || !win->window()) {
- qWarning("qt_touch_extension: handle_touch: No pointer focus");
- return;
- }
- mTargetWindow = win->window();
-
- QWindowSystemInterface::TouchPoint tp;
- tp.id = id;
- tp.state = QEventPoint::State(int(state & 0xFFFF));
- int sentPointCount = state >> 16;
- if (!mPointsLeft) {
- Q_ASSERT(sentPointCount > 0);
- mPointsLeft = sentPointCount;
- }
-
- if (!mTouchDevice)
- registerDevice(flags >> 16);
-
- tp.area = QRectF(0, 0, fromFixed(width), fromFixed(height));
- // Got surface-relative coords but need a (virtual) screen position.
- QPointF relPos = QPointF(fromFixed(x), fromFixed(y));
- tp.area.moveCenter(mTargetWindow->mapToGlobal(relPos));
-
- tp.normalPosition.setX(fromFixed(normalized_x));
- tp.normalPosition.setY(fromFixed(normalized_y));
- tp.pressure = pressure / 255.0;
- tp.velocity.setX(fromFixed(velocity_x));
- tp.velocity.setY(fromFixed(velocity_y));
-
- if (rawdata) {
- const int rawPosCount = rawdata->size / sizeof(float) / 2;
- float *p = static_cast(rawdata->data);
- for (int i = 0; i < rawPosCount; ++i) {
- float x = *p++;
- float y = *p++;
- tp.rawPositions.append(QPointF(x, y));
- }
- }
-
- mTouchPoints.append(tp);
- mTimestamp = time;
-
- if (!--mPointsLeft)
- sendTouchEvent();
-}
-
-void QWaylandTouchExtension::sendTouchEvent()
-{
- // Copy all points, that are in the previous but not in the current list, as stationary.
- for (int i = 0; i < mPrevTouchPoints.size(); ++i) {
- const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i));
- if (prevPoint.state == QEventPoint::Released)
- continue;
- bool found = false;
- for (int j = 0; j < mTouchPoints.size(); ++j)
- if (mTouchPoints.at(j).id == prevPoint.id) {
- found = true;
- break;
- }
- if (!found) {
- QWindowSystemInterface::TouchPoint p = prevPoint;
- p.state = QEventPoint::Stationary;
- mTouchPoints.append(p);
- }
- }
-
- if (mTouchPoints.isEmpty()) {
- mPrevTouchPoints.clear();
- return;
- }
-
- QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints);
-
- QEventPoint::States states = {};
- for (int i = 0; i < mTouchPoints.size(); ++i)
- states |= mTouchPoints.at(i).state;
-
- if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) {
- const bool firstPress = states == QEventPoint::Pressed;
- if (firstPress)
- mMouseSourceId = mTouchPoints.first().id;
- for (int i = 0; i < mTouchPoints.size(); ++i) {
- const QWindowSystemInterface::TouchPoint &tp(mTouchPoints.at(i));
- if (tp.id == mMouseSourceId) {
- const bool released = tp.state == QEventPoint::Released;
- Qt::MouseButtons buttons = released ? Qt::NoButton : Qt::LeftButton;
- QEvent::Type eventType = firstPress ? QEvent::MouseButtonPress
- : released ? QEvent::MouseButtonRelease
- : QEvent::MouseMove;
- mLastMouseGlobal = tp.area.center();
- QPoint globalPoint = mLastMouseGlobal.toPoint();
- QPointF delta = mLastMouseGlobal - globalPoint;
- mLastMouseLocal = mTargetWindow->mapFromGlobal(globalPoint) + delta;
- QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal,
- buttons, Qt::LeftButton, eventType);
- if (buttons == Qt::NoButton)
- mMouseSourceId = -1;
- break;
- }
- }
- }
-
- mPrevTouchPoints = mTouchPoints;
- mTouchPoints.clear();
-
- if (states == QEventPoint::Released)
- mPrevTouchPoints.clear();
-}
-
-void QWaylandTouchExtension::touchCanceled()
-{
- mTouchPoints.clear();
- mPrevTouchPoints.clear();
- if (mMouseSourceId != -1)
- QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, Qt::NoButton, Qt::LeftButton, QEvent::MouseButtonRelease);
-}
-
-void QWaylandTouchExtension::touch_extension_configure(uint32_t flags)
-{
- mFlags = flags;
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wayland/qwaylandtouch_p.h b/src/plugins/platforms/wayland/qwaylandtouch_p.h
deleted file mode 100644
index e283f90095c..00000000000
--- a/src/plugins/platforms/wayland/qwaylandtouch_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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 QWAYLANDTOUCH_H
-#define QWAYLANDTOUCH_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
-
-#include
-#include
-#include
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandDisplay;
-class QWaylandInputDevice;
-
-class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension
-{
-public:
- QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id);
- ~QWaylandTouchExtension() override;
-
- void touchCanceled();
-
-private:
- void registerDevice(int caps);
-
- QWaylandDisplay *mDisplay = nullptr;
-
- void touch_extension_touch(uint32_t time,
- uint32_t id,
- uint32_t state,
- int32_t x,
- int32_t y,
- int32_t normalized_x,
- int32_t normalized_y,
- int32_t width,
- int32_t height,
- uint32_t pressure,
- int32_t velocity_x,
- int32_t velocity_y,
- uint32_t flags,
- struct wl_array *rawdata) override;
- void touch_extension_configure(uint32_t flags) override;
-
- void sendTouchEvent();
-
- QList mTouchPoints;
- QList mPrevTouchPoints;
- QPointingDevice *mTouchDevice = nullptr;
- uint32_t mTimestamp;
- int mPointsLeft;
- uint32_t mFlags;
- int mMouseSourceId;
- QPointF mLastMouseLocal;
- QPointF mLastMouseGlobal;
- QWindow *mTargetWindow = nullptr;
- QWaylandInputDevice *mInputDevice = nullptr;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDTOUCH_H