[neon/qt/qtwayland/Neon/unstable] debian: Add patches from KDE's Qt 5 Patch Collection up to 2022-09-09.

Dmitry Shachnev null at kde.org
Mon Apr 29 17:44:39 BST 2024


Git commit d02f322ebe608351669376f32d848a100e292ce6 by Dmitry Shachnev.
Committed on 10/09/2022 at 19:17.
Pushed by jriddell into branch 'Neon/unstable'.

Add patches from KDE's Qt 5 Patch Collection up to 2022-09-09.

M  +1    -0    debian/changelog
A  +380  -0    debian/patches/0041-Only-close-popup-in-the-the-hierchary.patch
A  +23   -0    debian/patches/0042-Build-fixes-for-GCC-11.patch
R  +0    -0    debian/patches/0043-Check-pointer-for-null-before-use-in-ASSERT.patch [from: debian/patches/0025-Check-pointer-for-null-before-use-in-ASSERT.patch - 100% similarity]
R  +0    -0    debian/patches/0044-Use-wl_surface.damage_buffer-on-the-client-side.patch [from: debian/patches/0027-Use-wl_surface.damage_buffer-on-the-client-side.patch - 100% similarity]
A  +105  -0    debian/patches/0045-Client-clear-focus-on-touch-cancel.patch
A  +34   -0    debian/patches/0046-Guard-mResizeDirty-by-the-correctMutex.patch
A  +66   -0    debian/patches/0047-client-Synthesize-enter-leave-event-for-popup-in-xdg.patch
A  +24   -0    debian/patches/0048-Fix-compile-tests.patch
D  +0    -14   debian/patches/gcc_11.diff
M  +8    -3    debian/patches/series

https://invent.kde.org/neon/qt/qtwayland/-/commit/d02f322ebe608351669376f32d848a100e292ce6

diff --git a/debian/changelog b/debian/changelog
index b36ad17..98b2596 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ qtwayland-opensource-src (5.15.6-1) UNRELEASED; urgency=medium
   * Drop 0010-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch,
     included in the new release.
   * Refresh other patches.
+  * Add patches from KDE's Qt 5 Patch Collection up to 2022-09-09.
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sat, 10 Sep 2022 21:36:17 +0300
 
diff --git a/debian/patches/0041-Only-close-popup-in-the-the-hierchary.patch b/debian/patches/0041-Only-close-popup-in-the-the-hierchary.patch
new file mode 100644
index 0000000..156a3d8
--- /dev/null
+++ b/debian/patches/0041-Only-close-popup-in-the-the-hierchary.patch
@@ -0,0 +1,380 @@
+From 6df6ff51718eda0f06c2df6edb22e8a4fc9c353e Mon Sep 17 00:00:00 2001
+From: Weng Xuetian <wengxt at gmail.com>
+Date: Wed, 20 Jul 2022 15:57:40 -0700
+Subject: [PATCH] Only close popup in the the hierchary
+
+Imagine following event sequences:
+1. a tooltip is shown. activePopups = {tooltip}
+2. user click menu bar to show the menu, QMenu::setVisible is called.
+    now activePopups(tooltip, menu}
+3. tooltip visibility changed to false.
+4. closePopups() close both tooltip and menu.
+
+This is a common pattern under wayland that menu is shown as a invisible
+state. This patch tries to memorize the surface hierchary used to create
+the popup role. And only close those popups whose ancesotor is hidden.
+
+Pick-to: 6.4
+Change-Id: I78aa0b4e32a5812603e003e756d8bcd202e94af4
+Reviewed-by: David Edmundson <davidedmundson at kde.org>
+(cherry picked from commit f8e3257e9b1e22d52e9c221c62b8d9b6dd1151a3)
+---
+ src/client/qwaylandwindow.cpp                 | 33 ++++---
+ src/client/qwaylandwindow_p.h                 |  6 ++
+ .../xdg-shell-v5/qwaylandxdgpopupv5.cpp       |  5 +-
+ .../xdg-shell-v5/qwaylandxdgpopupv5_p.h       |  3 +-
+ .../xdg-shell-v5/qwaylandxdgshellv5.cpp       |  2 +-
+ .../xdg-shell-v6/qwaylandxdgshellv6.cpp       |  3 +
+ .../xdg-shell/qwaylandxdgshell.cpp            | 22 +++--
+ .../xdg-shell/qwaylandxdgshell_p.h            |  5 +-
+ tests/auto/client/xdgshell/tst_xdgshell.cpp   | 87 +++++++++++++++++++
+ 9 files changed, 136 insertions(+), 30 deletions(-)
+
+--- a/src/client/qwaylandwindow.cpp
++++ b/src/client/qwaylandwindow.cpp
+@@ -239,6 +239,7 @@ bool QWaylandWindow::shouldCreateSubSurface() const
+ 
+ void QWaylandWindow::reset()
+ {
++    closeChildPopups();
+     delete mShellSurface;
+     mShellSurface = nullptr;
+     delete mSubSurfaceWindow;
+@@ -397,21 +398,6 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect)
+     mLastExposeGeometry = rect;
+ }
+ 
+-
+-static QVector<QPointer<QWaylandWindow>> activePopups;
+-
+-void QWaylandWindow::closePopups(QWaylandWindow *parent)
+-{
+-    while (!activePopups.isEmpty()) {
+-        auto popup = activePopups.takeLast();
+-        if (popup.isNull())
+-            continue;
+-        if (popup.data() == parent)
+-            return;
+-        popup->reset();
+-    }
+-}
+-
+ QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const
+ {
+     QReadLocker lock(&mSurfaceLock);
+@@ -431,8 +417,6 @@ void QWaylandWindow::setVisible(bool visible)
+     lastVisible = visible;
+ 
+     if (visible) {
+-        if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip)
+-            activePopups << this;
+         initWindow();
+ 
+         setGeometry(windowGeometry());
+@@ -441,7 +425,6 @@ void QWaylandWindow::setVisible(bool visible)
+         // QWaylandShmBackingStore::beginPaint().
+     } else {
+         sendExposeEvent(QRect());
+-        closePopups(this);
+         reset();
+     }
+ }
+@@ -1290,6 +1273,20 @@ void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea)
+     wl_region_destroy(region);
+ }
+ 
++void QWaylandWindow::addChildPopup(QWaylandWindow *surface) {
++    mChildPopups.append(surface);
++}
++
++void QWaylandWindow::removeChildPopup(QWaylandWindow *surface) {
++    mChildPopups.removeAll(surface);
++}
++
++void QWaylandWindow::closeChildPopups() {
++    while (!mChildPopups.isEmpty()) {
++        auto popup = mChildPopups.takeLast();
++        popup->reset();
++    }
++}
+ }
+ 
+ QT_END_NAMESPACE
+--- a/src/client/qwaylandwindow_p.h
++++ b/src/client/qwaylandwindow_p.h
+@@ -207,6 +207,10 @@ public:
+     void handleUpdate();
+     void deliverUpdateRequest() override;
+ 
++    void addChildPopup(QWaylandWindow* child);
++    void removeChildPopup(QWaylandWindow* child);
++    void closeChildPopups();
++
+ public slots:
+     void applyConfigure();
+ 
+@@ -262,6 +266,8 @@ protected:
+     QWaylandBuffer *mQueuedBuffer = nullptr;
+     QRegion mQueuedBufferDamage;
+ 
++    QList<QPointer<QWaylandWindow>> mChildPopups;
++
+ private:
+     void setGeometry_helper(const QRect &rect);
+     void initWindow();
+--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp
++++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp
+@@ -47,18 +47,21 @@ QT_BEGIN_NAMESPACE
+ 
+ namespace QtWaylandClient {
+ 
+-QWaylandXdgPopupV5::QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow *window)
++QWaylandXdgPopupV5::QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow* parent, QWaylandWindow *window)
+     : QWaylandShellSurface(window)
+     , QtWayland::xdg_popup_v5(popup)
++    , m_parent(parent)
+     , m_window(window)
+ {
+     if (window->display()->windowExtension())
+         m_extendedWindow = new QWaylandExtendedSurface(window);
++    m_parent->addChildPopup(m_window);
+ }
+ 
+ QWaylandXdgPopupV5::~QWaylandXdgPopupV5()
+ {
+     xdg_popup_destroy(object());
++    m_parent->removeChildPopup(m_window);
+     delete m_extendedWindow;
+ }
+ 
+--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h
++++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h
+@@ -70,7 +70,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopupV5 : public QWaylandShellSurface
+ {
+     Q_OBJECT
+ public:
+-    QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow *window);
++    QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow* parent, QWaylandWindow *window);
+     ~QWaylandXdgPopupV5() override;
+ 
+ protected:
+@@ -78,6 +78,7 @@ protected:
+ 
+ private:
+     QWaylandExtendedSurface *m_extendedWindow = nullptr;
++    QWaylandWindow *m_parent = nullptr;
+     QWaylandWindow *m_window = nullptr;
+ };
+ 
+--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp
++++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp
+@@ -84,7 +84,7 @@ QWaylandXdgPopupV5 *QWaylandXdgShellV5::createXdgPopup(QWaylandWindow *window, Q
+     int x = position.x() + parentWindow->frameMargins().left();
+     int y = position.y() + parentWindow->frameMargins().top();
+ 
+-    auto popup = new QWaylandXdgPopupV5(get_xdg_popup(window->wlSurface(), parentSurface, seat, m_popupSerial, x, y), window);
++    auto popup = new QWaylandXdgPopupV5(get_xdg_popup(window->wlSurface(), parentSurface, seat, m_popupSerial, x, y), parentWindow, window);
+     m_popups.append(window);
+     QObject::connect(popup, &QWaylandXdgPopupV5::destroyed, [this, window](){
+         m_popups.removeOne(window);
+--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
++++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
+@@ -174,6 +174,7 @@ QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdg
+     , m_xdgSurface(xdgSurface)
+     , m_parent(parent)
+ {
++    m_parent->window()->addChildPopup(m_xdgSurface->window());
+ }
+ 
+ QWaylandXdgSurfaceV6::Popup::~Popup()
+@@ -181,6 +182,8 @@ QWaylandXdgSurfaceV6::Popup::~Popup()
+     if (isInitialized())
+         destroy();
+ 
++    m_parent->window()->removeChildPopup(m_xdgSurface->window());
++
+     if (m_grabbing) {
+         auto *shell = m_xdgSurface->m_shell;
+         Q_ASSERT(shell->m_topmostGrabbingPopup == this);
+--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+@@ -195,12 +195,17 @@ QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResi
+                 | ((edges & Qt::RightEdge) ? resize_edge_right : 0));
+ }
+ 
+-QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent,
++QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent,
+                                  QtWayland::xdg_positioner *positioner)
+-    : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object()))
+-    , m_xdgSurface(xdgSurface)
++    : m_xdgSurface(xdgSurface)
++    , m_parentXdgSurface(qobject_cast<QWaylandXdgSurface *>(parent->shellSurface()))
+     , m_parent(parent)
+ {
++
++    init(xdgSurface->get_popup(m_parentXdgSurface ? m_parentXdgSurface->object() : nullptr, positioner->object()));
++    if (m_parent) {
++        m_parent->addChildPopup(m_xdgSurface->window());
++    }
+ }
+ 
+ QWaylandXdgSurface::Popup::~Popup()
+@@ -208,10 +213,14 @@ QWaylandXdgSurface::Popup::~Popup()
+     if (isInitialized())
+         destroy();
+ 
++    if (m_parent) {
++        m_parent->removeChildPopup(m_xdgSurface->window());
++    }
++
+     if (m_grabbing) {
+         auto *shell = m_xdgSurface->m_shell;
+         Q_ASSERT(shell->m_topmostGrabbingPopup == this);
+-        shell->m_topmostGrabbingPopup = m_parent->m_popup;
++        shell->m_topmostGrabbingPopup = m_parentXdgSurface ? m_parentXdgSurface->m_popup : nullptr;
+     }
+ }
+ 
+@@ -392,8 +401,6 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
+ {
+     Q_ASSERT(!m_toplevel && !m_popup);
+ 
+-    auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface());
+-
+     auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner());
+     // set_popup expects a position relative to the parent
+     QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
+@@ -406,8 +413,9 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
+     positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left);
+     positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right);
+     positioner->set_size(m_window->geometry().width(), m_window->geometry().height());
+-    m_popup = new Popup(this, parentXdgSurface, positioner);
++    m_popup = new Popup(this, parent, positioner);
+     positioner->destroy();
++
+     delete positioner;
+ }
+ 
+--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
+@@ -131,14 +131,15 @@ private:
+ 
+     class Popup : public QtWayland::xdg_popup {
+     public:
+-        Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner);
++        Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner);
+         ~Popup() override;
+ 
+         void grab(QWaylandInputDevice *seat, uint serial);
+         void xdg_popup_popup_done() override;
+ 
+         QWaylandXdgSurface *m_xdgSurface = nullptr;
+-        QWaylandXdgSurface *m_parent = nullptr;
++        QWaylandXdgSurface *m_parentXdgSurface = nullptr;
++        QWaylandWindow *m_parent = nullptr;
+         bool m_grabbing = false;
+     };
+ 
+--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp
++++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp
+@@ -46,6 +46,7 @@ private slots:
+     void configureStates();
+     void popup();
+     void tooltipOnPopup();
++    void tooltipAndSiblingPopup();
+     void switchPopups();
+     void hidePopupParent();
+     void pongs();
+@@ -346,6 +347,92 @@ void tst_xdgshell::tooltipOnPopup()
+     QCOMPOSITOR_TRY_COMPARE(xdgPopup(0), nullptr);
+ }
+ 
++void tst_xdgshell::tooltipAndSiblingPopup()
++{
++    class ToolTip : public QRasterWindow {
++    public:
++        explicit ToolTip(QWindow *parent) {
++            setTransientParent(parent);
++            setFlags(Qt::ToolTip);
++            resize(100, 100);
++            show();
++        }
++        void mousePressEvent(QMouseEvent *event) override {
++            QRasterWindow::mousePressEvent(event);
++            m_popup = new QRasterWindow;
++            m_popup->setTransientParent(transientParent());
++            m_popup->setFlags(Qt::Popup);
++            m_popup->resize(100, 100);
++            m_popup->show();
++        }
++
++        QRasterWindow *m_popup = nullptr;
++    };
++
++    class Window : public QRasterWindow {
++    public:
++        void mousePressEvent(QMouseEvent *event) override {
++            QRasterWindow::mousePressEvent(event);
++            m_tooltip = new ToolTip(this);
++        }
++        ToolTip *m_tooltip = nullptr;
++    };
++
++    Window window;
++    window.resize(200, 200);
++    window.show();
++
++    QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
++    exec([=] { xdgToplevel()->sendCompleteConfigure(); });
++    QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial);
++
++    exec([=] {
++        auto *surface = xdgToplevel()->surface();
++        auto *p = pointer();
++        auto *c = client();
++        p->sendEnter(surface, {100, 100});
++        p->sendFrame(c);
++        p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
++        p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
++        p->sendFrame(c);
++        p->sendLeave(surface);
++        p->sendFrame(c);
++    });
++
++    QCOMPOSITOR_TRY_VERIFY(xdgPopup());
++    exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
++    QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
++    QCOMPOSITOR_TRY_VERIFY(!xdgPopup()->m_grabbed);
++
++    exec([=] {
++        auto *surface = xdgPopup()->surface();
++        auto *p = pointer();
++        auto *c = client();
++        p->sendEnter(surface, {100, 100});
++        p->sendFrame(c);
++        p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
++        p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
++        p->sendFrame(c);
++    });
++
++    QCOMPOSITOR_TRY_VERIFY(xdgPopup(1));
++    exec([=] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
++    QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_xdgSurface->m_committedConfigureSerial);
++    QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_grabbed);
++
++    // Close the middle tooltip (it should not close the sibling popup)
++    window.m_tooltip->close();
++
++    QCOMPOSITOR_TRY_COMPARE(xdgPopup(1), nullptr);
++    // Verify the remaining xdg surface is a grab popup..
++    QCOMPOSITOR_TRY_VERIFY(xdgPopup(0));
++    QCOMPOSITOR_TRY_VERIFY(xdgPopup(0)->m_grabbed);
++
++    window.m_tooltip->m_popup->close();
++    QCOMPOSITOR_TRY_COMPARE(xdgPopup(1), nullptr);
++    QCOMPOSITOR_TRY_COMPARE(xdgPopup(0), nullptr);
++}
++
+ // QTBUG-65680
+ void tst_xdgshell::switchPopups()
+ {
diff --git a/debian/patches/0042-Build-fixes-for-GCC-11.patch b/debian/patches/0042-Build-fixes-for-GCC-11.patch
new file mode 100644
index 0000000..9804d22
--- /dev/null
+++ b/debian/patches/0042-Build-fixes-for-GCC-11.patch
@@ -0,0 +1,23 @@
+From e501ed58dbe44492a085587d1746a5848ac962f7 Mon Sep 17 00:00:00 2001
+From: Ville Voutilainen <ville.voutilainen at qt.io>
+Date: Mon, 18 Jan 2021 12:31:31 +0200
+Subject: [PATCH] Build fixes for GCC 11
+
+Task-number: QTBUG-89977
+Change-Id: I7e3d0964087865e8062f539f851a61f3df017dae
+Reviewed-by: David Edmundson <davidedmundson at kde.org>
+(cherry picked from commit 1aa6ec2c778504d96543f6cdc2b9199a7b066fc1)
+---
+ tests/auto/client/shared/corecompositor.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/tests/auto/client/shared/corecompositor.cpp
++++ b/tests/auto/client/shared/corecompositor.cpp
+@@ -27,6 +27,7 @@
+ ****************************************************************************/
+ 
+ #include "corecompositor.h"
++#include <thread>
+ 
+ namespace MockCompositor {
+ 
diff --git a/debian/patches/0025-Check-pointer-for-null-before-use-in-ASSERT.patch b/debian/patches/0043-Check-pointer-for-null-before-use-in-ASSERT.patch
similarity index 100%
rename from debian/patches/0025-Check-pointer-for-null-before-use-in-ASSERT.patch
rename to debian/patches/0043-Check-pointer-for-null-before-use-in-ASSERT.patch
diff --git a/debian/patches/0027-Use-wl_surface.damage_buffer-on-the-client-side.patch b/debian/patches/0044-Use-wl_surface.damage_buffer-on-the-client-side.patch
similarity index 100%
rename from debian/patches/0027-Use-wl_surface.damage_buffer-on-the-client-side.patch
rename to debian/patches/0044-Use-wl_surface.damage_buffer-on-the-client-side.patch
diff --git a/debian/patches/0045-Client-clear-focus-on-touch-cancel.patch b/debian/patches/0045-Client-clear-focus-on-touch-cancel.patch
new file mode 100644
index 0000000..27ec2ae
--- /dev/null
+++ b/debian/patches/0045-Client-clear-focus-on-touch-cancel.patch
@@ -0,0 +1,105 @@
+From c618467da4c06528537026e2b78f92265bce446f Mon Sep 17 00:00:00 2001
+From: David Edmundson <davidedmundson at kde.org>
+Date: Fri, 5 Aug 2022 15:00:31 +0100
+Subject: [PATCH] Client: clear focus on touch cancel
+
+When we get a touch_cancel event all touches should be treated as
+lifted.
+
+The next frame call focus is set, with no pending touch points but
+without having gone through touch_up. We call mPendingTouchPoints.last()
+without guards even though it is potentially now empty.
+
+Change-Id: I3719f9507c5d397d8641692271d878076b7c23b8
+Reviewed-by: Shawn Rutledge <shawn.rutledge at qt.io>
+Reviewed-by: Liang Qi <liang.qi at qt.io>
+Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt at qt.io>
+(cherry picked from commit dbdcd92363b44d89440dcb195d8cb9e6c34f0ddf)
+---
+ src/client/qwaylandinputdevice.cpp        |  1 +
+ tests/auto/client/seatv5/tst_seatv5.cpp   | 30 +++++++++++++++++++++++
+ tests/auto/client/shared/coreprotocol.cpp |  7 ++++++
+ tests/auto/client/shared/coreprotocol.h   |  1 +
+ 4 files changed, 39 insertions(+)
+
+--- a/src/client/qwaylandinputdevice.cpp
++++ b/src/client/qwaylandinputdevice.cpp
+@@ -1388,6 +1388,7 @@ void QWaylandInputDevice::Touch::touch_cancel()
+     if (touchExt)
+         touchExt->touchCanceled();
+ 
++    mFocus = nullptr;
+     QWindowSystemInterface::handleTouchCancelEvent(nullptr, mParent->mTouchDevice);
+ }
+ 
+--- a/tests/auto/client/seatv5/tst_seatv5.cpp
++++ b/tests/auto/client/seatv5/tst_seatv5.cpp
+@@ -73,6 +73,7 @@ private slots:
+     void multiTouch();
+     void multiTouchUpAndMotionFrame();
+     void tapAndMoveInSameFrame();
++    void cancelTouch();
+ };
+ 
+ void tst_seatv5::bindsToSeat()
+@@ -646,5 +647,34 @@ void tst_seatv5::tapAndMoveInSameFrame()
+     QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), Qt::TouchPointState::TouchPointReleased);
+ }
+ 
++void tst_seatv5::cancelTouch()
++{
++    TouchWindow window;
++    QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
++
++    exec([=] {
++        auto *t = touch();
++        auto *c = client();
++        t->sendDown(xdgToplevel()->surface(), {32, 32}, 1);
++        t->sendFrame(c);
++        t->sendCancel(c);
++        t->sendFrame(c);
++    });
++
++    QTRY_VERIFY(!window.m_events.empty());
++    {
++        auto e = window.m_events.takeFirst();
++        QCOMPARE(e.type, QEvent::TouchBegin);
++        QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed);
++        QCOMPARE(e.touchPoints.length(), 1);
++        QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
++    }
++    {
++        auto e = window.m_events.takeFirst();
++        QCOMPARE(e.type, QEvent::TouchCancel);
++        QCOMPARE(e.touchPoints.length(), 0);
++    }
++}
++
+ QCOMPOSITOR_TEST_MAIN(tst_seatv5)
+ #include "tst_seatv5.moc"
+--- a/tests/auto/client/shared/coreprotocol.cpp
++++ b/tests/auto/client/shared/coreprotocol.cpp
+@@ -451,6 +451,13 @@ void Touch::sendFrame(wl_client *client)
+         send_frame(r->handle);
+ }
+ 
++void Touch::sendCancel(wl_client *client)
++{
++    const auto touchResources = resourceMap().values(client);
++    for (auto *r : touchResources)
++        send_cancel(r->handle);
++}
++
+ uint Keyboard::sendEnter(Surface *surface)
+ {
+     auto serial = m_seat->m_compositor->nextSerial();
+--- a/tests/auto/client/shared/coreprotocol.h
++++ b/tests/auto/client/shared/coreprotocol.h
+@@ -364,6 +364,7 @@ public:
+     uint sendUp(wl_client *client, int id);
+     void sendMotion(wl_client *client, const QPointF &position, int id);
+     void sendFrame(wl_client *client);
++    void sendCancel(wl_client *client);
+ 
+     Seat *m_seat = nullptr;
+ };
diff --git a/debian/patches/0046-Guard-mResizeDirty-by-the-correctMutex.patch b/debian/patches/0046-Guard-mResizeDirty-by-the-correctMutex.patch
new file mode 100644
index 0000000..52d6803
--- /dev/null
+++ b/debian/patches/0046-Guard-mResizeDirty-by-the-correctMutex.patch
@@ -0,0 +1,34 @@
+From 566f577ee2b0fa1f13bcc1a3cda64b75dbc1b3df Mon Sep 17 00:00:00 2001
+From: David Edmundson <davidedmundson at kde.org>
+Date: Thu, 3 Feb 2022 19:42:33 +0000
+Subject: [PATCH] Guard mResizeDirty by the correctMutex
+
+mResizeDirty is used in the GUI thread in setCanResize which can be
+called from the GUI thread. It is queried and set whilst the resizeLock
+is held. We need to guard our usage.
+
+Change-Id: I5f8dcf8aa2cb2c4bb6274103df1da9e3e268605a
+Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt at qt.io>
+(cherry picked from commit 4ac96662c936821efff2875bbe555b40612caf8a)
+---
+ src/client/qwaylandwindow.cpp | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/src/client/qwaylandwindow.cpp
++++ b/src/client/qwaylandwindow.cpp
+@@ -358,11 +358,12 @@ void QWaylandWindow::setGeometry(const QRect &rect)
+         if (mWindowDecoration)
+             mWindowDecoration->update();
+ 
+-        if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize)
++        if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) {
++            QMutexLocker lock(&mResizeLock);
+             mResizeDirty = true;
+-        else
++        } else {
+             QWindowSystemInterface::handleGeometryChange(window(), geometry());
+-
++        }
+         mSentInitialResize = true;
+     }
+     QRect exposeGeometry(QPoint(), geometry().size());
diff --git a/debian/patches/0047-client-Synthesize-enter-leave-event-for-popup-in-xdg.patch b/debian/patches/0047-client-Synthesize-enter-leave-event-for-popup-in-xdg.patch
new file mode 100644
index 0000000..554f12d
--- /dev/null
+++ b/debian/patches/0047-client-Synthesize-enter-leave-event-for-popup-in-xdg.patch
@@ -0,0 +1,66 @@
+From 489a0a1fc1db61f46e2b232ae4523723a05304b7 Mon Sep 17 00:00:00 2001
+From: Liang Qi <liang.qi at qt.io>
+Date: Fri, 11 Mar 2022 09:17:25 +0100
+Subject: [PATCH] client: Synthesize enter/leave event for popup in xdg-shell
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes: QTBUG-100148
+Pick-to: 6.3 6.2 5.15
+Change-Id: I45e3156d7942cff9968674c0b253d15be7235921
+Reviewed-by: Tang Haixiang <tanghaixiang at uniontech.com>
+Reviewed-by: Qt CI Bot <qt_ci_bot at qt-project.org>
+Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo at qt.io>
+(cherry picked from commit 73d35d3117722cef8e94f0d2036c56ad0a5ddae9)
+
+* asturmlechner 2022-09-08: Resolve conflict with dev branch commits
+    b6a3a938abd4a7fdb7ea96a38485b53f394fba17 and
+    f8e3257e9b1e22d52e9c221c62b8d9b6dd1151a3
+---
+ .../xdg-shell/qwaylandxdgshell.cpp            | 27 +++++++++++++++++++
+ 1 file changed, 27 insertions(+)
+
+--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+@@ -221,6 +221,16 @@ QWaylandXdgSurface::Popup::~Popup()
+         auto *shell = m_xdgSurface->m_shell;
+         Q_ASSERT(shell->m_topmostGrabbingPopup == this);
+         shell->m_topmostGrabbingPopup = m_parentXdgSurface ? m_parentXdgSurface->m_popup : nullptr;
++        m_grabbing = false;
++
++        // Synthesize Qt enter/leave events for popup
++        QWindow *leave = nullptr;
++        if (m_xdgSurface && m_xdgSurface->window())
++            leave = m_xdgSurface->window()->window();
++        QWindowSystemInterface::handleLeaveEvent(leave);
++
++        if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos()))
++            QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos());
+     }
+ }
+ 
+@@ -437,6 +447,23 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic
+     }
+     setPopup(parent);
+     m_popup->grab(device, serial);
++
++    // Synthesize Qt enter/leave events for popup
++    if (!parent)
++        return;
++    QWindow *current = QGuiApplication::topLevelAt(QCursor::pos());
++    QWindow *leave = parent->window();
++    if (current != leave)
++        return;
++
++    QWindowSystemInterface::handleLeaveEvent(leave);
++
++    QWindow *enter = nullptr;
++    if (m_popup && m_popup->m_xdgSurface && m_popup->m_xdgSurface->window())
++        enter = m_popup->m_xdgSurface->window()->window();
++
++    if (enter)
++        QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(QCursor::pos()), QCursor::pos());
+ }
+ 
+ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
diff --git a/debian/patches/0048-Fix-compile-tests.patch b/debian/patches/0048-Fix-compile-tests.patch
new file mode 100644
index 0000000..495127c
--- /dev/null
+++ b/debian/patches/0048-Fix-compile-tests.patch
@@ -0,0 +1,24 @@
+From f77065f0cc9da073535e7347eac1ee150dde1908 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid at kde.org>
+Date: Fri, 9 Sep 2022 15:37:49 +0200
+Subject: [PATCH] Fix compile tests
+
+Broken in c618467da4c06528537026e2b78f92265bce446f
+---
+ tests/auto/client/seatv5/tst_seatv5.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/tests/auto/client/seatv5/tst_seatv5.cpp
++++ b/tests/auto/client/seatv5/tst_seatv5.cpp
+@@ -665,9 +665,9 @@ void tst_seatv5::cancelTouch()
+     {
+         auto e = window.m_events.takeFirst();
+         QCOMPARE(e.type, QEvent::TouchBegin);
+-        QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed);
++        QCOMPARE(e.touchPointStates, Qt::TouchPointPressed);
+         QCOMPARE(e.touchPoints.length(), 1);
+-        QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
++        QCOMPARE(e.touchPoints.first().pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
+     }
+     {
+         auto e = window.m_events.takeFirst();
diff --git a/debian/patches/gcc_11.diff b/debian/patches/gcc_11.diff
deleted file mode 100644
index 5615940..0000000
--- a/debian/patches/gcc_11.diff
+++ /dev/null
@@ -1,14 +0,0 @@
-Description: build fixes for GCC 11
-Origin: upstream, https://code.qt.io/cgit/qt/qtwayland.git/commit/?id=1aa6ec2c778504d9
-Last-Update: 2021-08-10
-
---- a/tests/auto/client/shared/corecompositor.cpp
-+++ b/tests/auto/client/shared/corecompositor.cpp
-@@ -27,6 +27,7 @@
- ****************************************************************************/
- 
- #include "corecompositor.h"
-+#include <thread>
- 
- namespace MockCompositor {
- 
diff --git a/debian/patches/series b/debian/patches/series
index 70f841e..e80898d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -20,9 +20,7 @@
 0022-Handle-registry_global-out-of-constructor.patch
 0023-Connect-flushRequest-after-forceRoundTrip.patch
 0024-Move-the-wayland-socket-polling-to-a-separate-event-.patch
-0025-Check-pointer-for-null-before-use-in-ASSERT.patch
 0026-Do-not-create-decorations-when-the-shellSurface-is-n.patch
-0027-Use-wl_surface.damage_buffer-on-the-client-side.patch
 0028-Fix-crash-if-no-input-method-module-could-be-loaded.patch
 0029-Client-Remove-mWaitingForUpdateDelivery.patch
 0030-Cursor-position-0-should-still-show-the-cursor.patch
@@ -36,5 +34,12 @@
 0038-use-poll-2-when-reading-from-clipboard.patch
 0039-Reduce-memory-leakage.patch
 0040-Fix-build-with-libcxx-missing-array-include.patch
+0041-Only-close-popup-in-the-the-hierchary.patch
+0042-Build-fixes-for-GCC-11.patch
+0043-Check-pointer-for-null-before-use-in-ASSERT.patch
+0044-Use-wl_surface.damage_buffer-on-the-client-side.patch
+0045-Client-clear-focus-on-touch-cancel.patch
+0046-Guard-mResizeDirty-by-the-correctMutex.patch
+0047-client-Synthesize-enter-leave-event-for-popup-in-xdg.patch
+0048-Fix-compile-tests.patch
 skip_animated_cursor_test.diff
-gcc_11.diff



More information about the Neon-commits mailing list