[neon/qt/qtwayland/Neon/unstable] debian: Add patches from KDE’s Qt 5 Patch Collection up to 2023-10-24.

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


Git commit e1ed655537f1e999817bf145b8121efb1e09f22a by Dmitry Shachnev.
Committed on 24/12/2023 at 15:11.
Pushed by jriddell into branch 'Neon/unstable'.

Add patches from KDE’s Qt 5 Patch Collection up to 2023-10-24.

M  +1    -0    debian/changelog
A  +33   -0    debian/patches/0070-Destroy-frame-queue-before-display.patch
A  +37   -0    debian/patches/0071-client-Fix-crash-on-dnd-updates-after-client-facing-.patch
A  +61   -0    debian/patches/0072-Convert-cursor-bitmap-to-supported-format.patch
A  +153  -0    debian/patches/0073-Replace-scale-with-devicePixelRatio-for-non-integer-.patch
A  +66   -0    debian/patches/0074-Client-Fix-buffer-damage.patch
A  +58   -0    debian/patches/0075-client-Fix-infinite-recursion-with-text-input-v2.patch
A  +32   -0    debian/patches/0076-Client-Fix-the-mouse-being-stuck-in-pressed-state-af.patch
A  +32   -0    debian/patches/0077-Client-Commit-the-initial-surface-state-explicitly.patch
A  +30   -0    debian/patches/0078-tests-Fix-tst_xdgshell-minMaxSize.patch
A  +55   -0    debian/patches/0079-Client-Remove-some-surface-commits.patch
A  +63   -0    debian/patches/0080-Client-Avoid-locking-resizing-in-QWaylandShmBackingS.patch
A  +47   -0    debian/patches/0081-Client-Always-populate-mimedata-in-drags.patch
M  +12   -0    debian/patches/series

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

diff --git a/debian/changelog b/debian/changelog
index 7bca428..b622c7d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,7 @@ qtwayland-opensource-src (5.15.12-1) UNRELEASED; urgency=medium
     - 0055-Client-Ensure-that-wl_surface-lives-as-long-as-qtqui.patch
     - 0057-Revert-Client-Ensure-that-wl_surface-lives-as-long-a.patch
   * Refresh other patches.
+  * Add patches from KDE’s Qt 5 Patch Collection up to 2023-10-24.
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sat, 23 Dec 2023 16:11:34 +0300
 
diff --git a/debian/patches/0070-Destroy-frame-queue-before-display.patch b/debian/patches/0070-Destroy-frame-queue-before-display.patch
new file mode 100644
index 0000000..0c8ff7e
--- /dev/null
+++ b/debian/patches/0070-Destroy-frame-queue-before-display.patch
@@ -0,0 +1,33 @@
+From 24be5552594b583ab78a469c6735ac288178507f Mon Sep 17 00:00:00 2001
+From: David Redondo <qt at david-redondo.de>
+Date: Tue, 11 Apr 2023 14:27:27 +0200
+Subject: [PATCH] Destroy frame queue before display
+
+wl_event_queue_destroy accesses the display.
+Found by running a test under valgrind.
+
+Pick-to: 6.5
+Change-Id: Ic89cbd3b6e98b4fc9561b0e63b5fab4886a1ec50
+Reviewed-by: David Edmundson <davidedmundson at kde.org>
+(cherry picked from commit a76bf824fcd1cc3789f0d3454a0423c0241d9718)
+---
+ src/client/qwaylanddisplay.cpp | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/src/client/qwaylanddisplay.cpp
++++ b/src/client/qwaylanddisplay.cpp
+@@ -379,11 +379,12 @@ QWaylandDisplay::~QWaylandDisplay(void)
+ #if QT_CONFIG(cursor)
+     qDeleteAll(mCursorThemes);
+ #endif
+-    if (mDisplay)
+-        wl_display_disconnect(mDisplay);
+ 
+     if (m_frameEventQueue)
+         wl_event_queue_destroy(m_frameEventQueue);
++
++    if (mDisplay)
++        wl_display_disconnect(mDisplay);
+ }
+ 
+ // Steps which is called just after constructor. This separates registry_global() out of the constructor
diff --git a/debian/patches/0071-client-Fix-crash-on-dnd-updates-after-client-facing-.patch b/debian/patches/0071-client-Fix-crash-on-dnd-updates-after-client-facing-.patch
new file mode 100644
index 0000000..c46cdde
--- /dev/null
+++ b/debian/patches/0071-client-Fix-crash-on-dnd-updates-after-client-facing-.patch
@@ -0,0 +1,37 @@
+From 4a71f55f3c838ce27f76bdf7356b1caa827f00ec Mon Sep 17 00:00:00 2001
+From: David Edmundson <davidedmundson at kde.org>
+Date: Wed, 7 Jun 2023 22:12:15 +0100
+Subject: [PATCH] client: Fix crash on dnd updates after client facing drag
+ ends
+
+A platform drag and a application-facing drag have two different
+lifespans.
+
+The platform drag lasts until all mimedata is transferred and the client
+receiving the drops marks it as finished.
+
+The application facing QDrag lasts until the client deletes it. We can
+get a crash if we get updates during this time.
+
+The drop event is guarded, but not the action negotiation.
+
+Pick-to: 6.6
+Change-Id: Ib9c047f04d65883105d4cd3f169637d0e038a63f
+Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt at qt.io>
+(cherry picked from commit 22daca49b807fefba58113a06b86df4274e49f62)
+---
+ src/client/qwaylanddatadevice.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/src/client/qwaylanddatadevice.cpp
++++ b/src/client/qwaylanddatadevice.cpp
+@@ -132,6 +132,9 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte
+     connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled);
+     connect(m_dragSource.data(), &QWaylandDataSource::dndResponseUpdated, this, [this](bool accepted, Qt::DropAction action) {
+             auto drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag());
++            if (!drag->currentDrag()) {
++                return;
++            }
+             // in old versions drop action is not set, so we guess
+             if (wl_data_source_get_version(m_dragSource->object()) < 3) {
+                 drag->setResponse(accepted);
diff --git a/debian/patches/0072-Convert-cursor-bitmap-to-supported-format.patch b/debian/patches/0072-Convert-cursor-bitmap-to-supported-format.patch
new file mode 100644
index 0000000..7fe3a85
--- /dev/null
+++ b/debian/patches/0072-Convert-cursor-bitmap-to-supported-format.patch
@@ -0,0 +1,61 @@
+From 91725b8bddc1aa3b7edce3b195a8f332650c89c0 Mon Sep 17 00:00:00 2001
+From: Michael Weghorn <m.weghorn at posteo.de>
+Date: Mon, 20 Feb 2023 14:02:23 +0100
+Subject: [PATCH] Convert cursor bitmap to supported format
+
+The 1-bit image formats QImage::Format_Mono and
+QImage::Format_MonoLSB used by cursor bitmaps don't have
+a corresponding wl_shm_format.
+
+Therefore, convert to a supported image format as necessary
+to make such bitmap cursors work on Wayland as well.
+
+Fixes: QTBUG-95434
+Change-Id: I402fd870b301ddc01075251b66f2cf7cc1923133
+Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt at qt.io>
+(cherry picked from commit 45ec1362f8fcb5ade92f4d2d4985b1c24e78c8ba)
+
+Backport changes: Use Qt::ReturnByValue version for QCursor::mask() and QCursor::bitmap()
+---
+ src/client/qwaylandcursor.cpp | 23 ++++++++++++++++++++++-
+ 1 file changed, 22 insertions(+), 1 deletion(-)
+
+--- a/src/client/qwaylandcursor.cpp
++++ b/src/client/qwaylandcursor.cpp
+@@ -44,6 +44,7 @@
+ #include "qwaylandshmbackingstore_p.h"
+ 
+ #include <QtGui/QImageReader>
++#include <QBitmap>
+ #include <QDebug>
+ 
+ #include <wayland-cursor.h>
+@@ -250,7 +251,27 @@ QWaylandCursor::QWaylandCursor(QWaylandDisplay *display)
+ QSharedPointer<QWaylandBuffer> QWaylandCursor::cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor)
+ {
+     Q_ASSERT(cursor->shape() == Qt::BitmapCursor);
+-    const QImage &img = cursor->pixmap().toImage();
++
++    const QBitmap mask = cursor->mask(Qt::ReturnByValue);
++    QImage img;
++    if (cursor->pixmap().isNull())
++        img = cursor->bitmap(Qt::ReturnByValue).toImage();
++    else
++        img = cursor->pixmap().toImage();
++
++    // convert to supported format if necessary
++    if (!display->shm()->formatSupported(img.format())) {
++        if (mask.isNull()) {
++            img.convertTo(QImage::Format_RGB32);
++        } else {
++            // preserve mask
++            img.convertTo(QImage::Format_ARGB32);
++            QPixmap pixmap = QPixmap::fromImage(img);
++            pixmap.setMask(mask);
++            img = pixmap.toImage();
++        }
++    }
++
+     QSharedPointer<QWaylandShmBuffer> buffer(new QWaylandShmBuffer(display, img.size(), img.format()));
+     memcpy(buffer->image()->bits(), img.bits(), size_t(img.sizeInBytes()));
+     return buffer;
diff --git a/debian/patches/0073-Replace-scale-with-devicePixelRatio-for-non-integer-.patch b/debian/patches/0073-Replace-scale-with-devicePixelRatio-for-non-integer-.patch
new file mode 100644
index 0000000..16d087a
--- /dev/null
+++ b/debian/patches/0073-Replace-scale-with-devicePixelRatio-for-non-integer-.patch
@@ -0,0 +1,153 @@
+From d9793fed272bd2edc52f92496768242ff2fc0847 Mon Sep 17 00:00:00 2001
+From: Jungi Byun <jungi.byun at lge.com>
+Date: Wed, 27 Jan 2021 08:24:23 +0900
+Subject: [PATCH] Replace scale with devicePixelRatio for non-integer scaling
+
+The 'scale' event from wayland cannot support non-integer scaling
+which was originally supported in Qt.
+
+As default, devicePixelRatio follows the 'scale' so that the high DPI
+still works as the mechanism in Wayland. But if non-integer scaling
+factor such as 150% is needed, it can be supported to override the
+devicePixelRatio.
+
+Change-Id: I63a04db27bd521264b6d0904e1ddd05a572dc970
+Reviewed-by: Elvis Lee <kwangwoong.lee at lge.com>
+Reviewed-by: Jungi Byun <jungi.byun at lge.com>
+Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt at qt.io>
+(cherry picked from commit cf98abbc6ae9ba9373803ffe193f839324e0c80b)
+---
+ src/client/qwaylandabstractdecoration.cpp        |  2 +-
+ src/client/qwaylandshmbackingstore.cpp           |  6 +++---
+ src/client/qwaylandshmbackingstore_p.h           |  2 +-
+ src/client/qwaylandwindow.cpp                    | 16 ++++++++--------
+ src/client/qwaylandwindow_p.h                    |  2 +-
+ .../client/wayland-egl/qwaylandglcontext.cpp     |  2 +-
+ 6 files changed, 15 insertions(+), 15 deletions(-)
+
+--- a/src/client/qwaylandabstractdecoration.cpp
++++ b/src/client/qwaylandabstractdecoration.cpp
+@@ -122,7 +122,7 @@ const QImage &QWaylandAbstractDecoration::contentImage()
+     if (d->m_isDirty) {
+         // Update the decoration backingstore
+ 
+-        const int bufferScale = waylandWindow()->scale();
++        const qreal bufferScale = waylandWindow()->scale();
+         const QSize imageSize = waylandWindow()->surfaceSize() * bufferScale;
+         d->m_decorationContentImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied);
+         // Only scale by buffer scale, not QT_SCALE_FACTOR etc.
+--- a/src/client/qwaylandshmbackingstore.cpp
++++ b/src/client/qwaylandshmbackingstore.cpp
+@@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE
+ namespace QtWaylandClient {
+ 
+ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
+-                     const QSize &size, QImage::Format format, int scale)
++                     const QSize &size, QImage::Format format, qreal scale)
+ {
+     int stride = size.width() * 4;
+     int alloc = stride * size.height();
+@@ -114,7 +114,7 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
+     QWaylandShm* shm = display->shm();
+     wl_shm_format wl_format = shm->formatFrom(format);
+     mImage = QImage(data, size.width(), size.height(), stride, format);
+-    mImage.setDevicePixelRatio(qreal(scale));
++    mImage.setDevicePixelRatio(scale);
+ 
+     mShmPool = wl_shm_create_pool(shm->object(), fd, alloc);
+     init(wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(),
+@@ -277,7 +277,7 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size)
+ void QWaylandShmBackingStore::resize(const QSize &size)
+ {
+     QMargins margins = windowDecorationMargins();
+-    int scale = waylandWindow()->scale();
++    qreal scale = waylandWindow()->scale();
+     QSize sizeWithMargins = (size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom())) * scale;
+ 
+     // We look for a free buffer to draw into. If the buffer is not the last buffer we used,
+--- a/src/client/qwaylandshmbackingstore_p.h
++++ b/src/client/qwaylandshmbackingstore_p.h
+@@ -71,7 +71,7 @@ class QWaylandWindow;
+ class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer {
+ public:
+     QWaylandShmBuffer(QWaylandDisplay *display,
+-           const QSize &size, QImage::Format format, int scale = 1);
++           const QSize &size, QImage::Format format, qreal scale = 1);
+     ~QWaylandShmBuffer() override;
+     QSize size() const override { return mImage.size(); }
+     int scale() const override { return int(mImage.devicePixelRatio()); }
+--- a/src/client/qwaylandwindow.cpp
++++ b/src/client/qwaylandwindow.cpp
+@@ -185,7 +185,7 @@ void QWaylandWindow::initWindow()
+     // typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale()
+     // to inform the compositor that high-resolution buffers will be provided.
+     if (mDisplay->compositorVersion() >= 3)
+-        mSurface->set_buffer_scale(scale());
++        mSurface->set_buffer_scale(mScale);
+ 
+     if (QScreen *s = window()->screen())
+         setOrientationMask(s->orientationUpdateMask());
+@@ -572,9 +572,9 @@ void QWaylandWindow::damage(const QRect &rect)
+     if (mSurface == nullptr)
+         return;
+ 
+-    const int s = scale();
++    const qreal s = scale();
+     if (mDisplay->compositorVersion() >= 4)
+-        mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
++        mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height()));
+     else
+         mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
+ }
+@@ -613,9 +613,9 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
+ 
+     attachOffset(buffer);
+     if (mDisplay->compositorVersion() >= 4) {
+-        const int s = scale();
++        const qreal s = scale();
+         for (const QRect &rect: damage)
+-            mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
++            mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height()));
+     } else {
+         for (const QRect &rect: damage)
+             mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
+@@ -1106,14 +1106,14 @@ bool QWaylandWindow::isActive() const
+     return mDisplay->isWindowActivated(this);
+ }
+ 
+-int QWaylandWindow::scale() const
++qreal QWaylandWindow::scale() const
+ {
+-    return mScale;
++    return devicePixelRatio();
+ }
+ 
+ qreal QWaylandWindow::devicePixelRatio() const
+ {
+-    return mScale;
++    return qreal(mScale);
+ }
+ 
+ bool QWaylandWindow::setMouseGrabEnabled(bool grab)
+--- a/src/client/qwaylandwindow_p.h
++++ b/src/client/qwaylandwindow_p.h
+@@ -158,7 +158,7 @@ public:
+ 
+     void setMask(const QRegion &region) override;
+ 
+-    int scale() const;
++    qreal scale() const;
+     qreal devicePixelRatio() const override;
+ 
+     void requestActivateWindow() override;
+--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
++++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+@@ -195,7 +195,7 @@ public:
+         QOpenGLTextureCache *cache = QOpenGLTextureCache::cacheForContext(m_context->context());
+ 
+         QSize surfaceSize = window->surfaceSize();
+-        int scale = window->scale() ;
++        qreal scale = window->scale() ;
+         glViewport(0, 0, surfaceSize.width() * scale, surfaceSize.height() * scale);
+ 
+         //Draw Decoration
diff --git a/debian/patches/0074-Client-Fix-buffer-damage.patch b/debian/patches/0074-Client-Fix-buffer-damage.patch
new file mode 100644
index 0000000..578a290
--- /dev/null
+++ b/debian/patches/0074-Client-Fix-buffer-damage.patch
@@ -0,0 +1,66 @@
+From 55f55b8475247339aa557aa3b3c0e0dd35d651b6 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorodnii at kde.org>
+Date: Thu, 3 Aug 2023 12:28:44 +0300
+Subject: [PATCH] Client: Fix buffer damage
+
+If the specified damage rectangle has fractional coordinates in the buffer
+local coordinate space, the buffer damage needs to be expanded, i.e.
+
+- bufferRect.left = floor(rect.left * scale)
+- bufferRect.right = ceil(rect.right * scale) = ceil((rect.x + rect.width) * scale)
+
+Flooring the coordinates and ceiling the size is not enough. It can
+produce incorrect results.
+
+For example, consider that a rectangle with logical coordinates of
+QRect(0, 23, 179, 46) has been damaged in a window with scale 1.5. When
+flooring the coordinates and ceiling the size, the following buffer
+damage rect will be produced: QRect(0, 34, 269, 69). Its height is off by
+1, the expected height is 70 (ceil((23 + 46) * 1.5) - floor(23 * 1.5) =
+ceil(103.5) - floor(34.5) = 104 - 34 = 70).
+
+Pick-to: 5.15 6.5 6.6
+Change-Id: I927e75a2224bb58b4634125011d1305dbdfbb3aa
+Reviewed-by: David Edmundson <davidedmundson at kde.org>
+(cherry picked from commit d79db699866b37bd3e3358ca18a210dfc5c0b4b9)
+---
+ src/client/qwaylandwindow.cpp | 20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+--- a/src/client/qwaylandwindow.cpp
++++ b/src/client/qwaylandwindow.cpp
+@@ -573,10 +573,15 @@ void QWaylandWindow::damage(const QRect &rect)
+         return;
+ 
+     const qreal s = scale();
+-    if (mDisplay->compositorVersion() >= 4)
+-        mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height()));
+-    else
++    if (mDisplay->compositorVersion() >= 4) {
++        const QRect bufferRect =
++                QRectF(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height())
++                        .toAlignedRect();
++        mSurface->damage_buffer(bufferRect.x(), bufferRect.y(), bufferRect.width(),
++                                bufferRect.height());
++    } else {
+         mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
++    }
+ }
+ 
+ void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage)
+@@ -614,8 +619,13 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
+     attachOffset(buffer);
+     if (mDisplay->compositorVersion() >= 4) {
+         const qreal s = scale();
+-        for (const QRect &rect: damage)
+-            mSurface->damage_buffer(qFloor(s * rect.x()), qFloor(s * rect.y()), qCeil(s * rect.width()), qCeil(s * rect.height()));
++        for (const QRect &rect : damage) {
++            const QRect bufferRect =
++                    QRectF(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height())
++                            .toAlignedRect();
++            mSurface->damage_buffer(bufferRect.x(), bufferRect.y(), bufferRect.width(),
++                                    bufferRect.height());
++        }
+     } else {
+         for (const QRect &rect: damage)
+             mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
diff --git a/debian/patches/0075-client-Fix-infinite-recursion-with-text-input-v2.patch b/debian/patches/0075-client-Fix-infinite-recursion-with-text-input-v2.patch
new file mode 100644
index 0000000..54d7eae
--- /dev/null
+++ b/debian/patches/0075-client-Fix-infinite-recursion-with-text-input-v2.patch
@@ -0,0 +1,58 @@
+From f21d34890dccc356a1a798e55b865749cdc4fd70 Mon Sep 17 00:00:00 2001
+From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt at qt.io>
+Date: Thu, 12 Jan 2023 14:56:18 +0100
+Subject: [PATCH] client: Fix infinite recursion with text-input-v2
+
+It was possible to get into an infinite recursion when
+double-clicking an entry in an item view to edit it.
+
+What would happen is that the editor takes focus, and we call
+commit on the input method commit in case the previous focused
+widget has pending input that needs to be committed. The
+subsequent method event then causes the QAbstractItemView to
+set focus, and since we have not yet updated the focus in the
+previous call, we end up in an infinite recursion, eventually
+crashing when the stack overflows.
+
+As a guard for this, we only send an input method event when there
+is actually pre-edit text to commit, and we reset the pre-edit
+text immediately so that any subsequent call will just exit.
+
+[ChangeLog][QtWaylandClient] Fixed a possible crash when editing
+a field in an item view.
+
+Pick-to: 5.15 6.2 6.4 6.5
+Fixes: QTBUG-109302
+Change-Id: I45237c80e53b1386705279899e19319180d78fa1
+Reviewed-by: Liang Qi <liang.qi at qt.io>
+Reviewed-by: Paul Olav Tvete <paul.tvete at qt.io>
+Reviewed-by: Inho Lee <inho.lee at qt.io>
+(cherry picked from commit db4afd9caf037cfff7aca8b130d326c340b7fed0)
+
+* asturmlechner 2023-08-14: Resolve conflict with dev branch commit
+  af8f8c33ea885f472682f98e0699721f50b1f020 - change applied in
+  qwaylandinputcontext.cpp instead.
+---
+ src/client/qwaylandinputcontext.cpp | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/src/client/qwaylandinputcontext.cpp
++++ b/src/client/qwaylandinputcontext.cpp
+@@ -93,9 +93,14 @@ void QWaylandTextInput::reset()
+ void QWaylandTextInput::commit()
+ {
+     if (QObject *o = QGuiApplication::focusObject()) {
+-        QInputMethodEvent event;
+-        event.setCommitString(m_preeditCommit);
+-        QCoreApplication::sendEvent(o, &event);
++        if (!m_preeditCommit.isEmpty()) {
++
++            QInputMethodEvent event;
++            event.setCommitString(m_preeditCommit);
++            m_preeditCommit = QString();
++
++            QCoreApplication::sendEvent(o, &event);
++        }
+     }
+ 
+     reset();
diff --git a/debian/patches/0076-Client-Fix-the-mouse-being-stuck-in-pressed-state-af.patch b/debian/patches/0076-Client-Fix-the-mouse-being-stuck-in-pressed-state-af.patch
new file mode 100644
index 0000000..4db8844
--- /dev/null
+++ b/debian/patches/0076-Client-Fix-the-mouse-being-stuck-in-pressed-state-af.patch
@@ -0,0 +1,32 @@
+From 62a132b18dee9088a7d2993a58a44cbd120cde44 Mon Sep 17 00:00:00 2001
+From: Ilya Fedin <fedin-ilja2010 at ya.ru>
+Date: Sun, 19 Mar 2023 10:20:11 +0400
+Subject: [PATCH] Client: Fix the mouse being stuck in pressed state after DnD
+
+I can still reproduce the problem using QtWidgets applications
+on KDE Plasma 5.27. Both Windows and macOS QPA have a similar quirk
+and they both send a MouseButtonRelease event rather than a MouseMove
+event.
+
+Amends f7a386eeaec8e6314c1be7de5e14e9fe3847f9ba
+
+Task-number: QTBUG-97037
+Pick-to: 6.5 6.2 5.15
+Change-Id: I864a1cb68b3660d858623f943b3958f7cafbf955
+Reviewed-by: David Edmundson <davidedmundson at kde.org>
+(cherry picked from commit e3c74961b1c7415fd94678802ad7f8173d0be4c1)
+---
+ src/client/qwaylandinputdevice.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/client/qwaylandinputdevice.cpp
++++ b/src/client/qwaylandinputdevice.cpp
+@@ -845,7 +845,7 @@ void QWaylandInputDevice::Pointer::releaseButtons()
+     mButtons = Qt::NoButton;
+ 
+     if (auto *window = focusWindow()) {
+-        MotionEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers());
++        ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers());
+         window->handleMouse(mParent, e);
+     }
+ }
diff --git a/debian/patches/0077-Client-Commit-the-initial-surface-state-explicitly.patch b/debian/patches/0077-Client-Commit-the-initial-surface-state-explicitly.patch
new file mode 100644
index 0000000..4487939
--- /dev/null
+++ b/debian/patches/0077-Client-Commit-the-initial-surface-state-explicitly.patch
@@ -0,0 +1,32 @@
+From ce5881086f32a2cc03c434965a86d160bf955d64 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorodnii at kde.org>
+Date: Fri, 25 Aug 2023 10:19:07 +0300
+Subject: [PATCH] Client: Commit the initial surface state explicitly
+
+QWaylandWindow lacks an explicit step to finish initializing the shell
+surface by committing the surface. So far it used to work because of
+hidden surface commits in
+QWaylandWindow::handleContentOrientationChange(),
+QWaylandWindow::setMask() and so on.
+
+This change adds an explicit step to commit the initial surface state to
+make the shell surface initialization robust.
+
+Change-Id: Ibc38a4e0dbea689a727451c25a61af0270c7e548
+Reviewed-by: David Edmundson <davidedmundson at kde.org>
+(cherry picked from commit 225432c2294bdfbf24856b2f155cd274b24543b2)
+---
+ src/client/qwaylandwindow.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/src/client/qwaylandwindow.cpp
++++ b/src/client/qwaylandwindow.cpp
+@@ -200,6 +200,8 @@ void QWaylandWindow::initWindow()
+         mShellSurface->requestWindowStates(window()->windowStates());
+     handleContentOrientationChange(window()->contentOrientation());
+     mFlags = window()->flags();
++
++    mSurface->commit();
+ }
+ 
+ void QWaylandWindow::initializeWlSurface()
diff --git a/debian/patches/0078-tests-Fix-tst_xdgshell-minMaxSize.patch b/debian/patches/0078-tests-Fix-tst_xdgshell-minMaxSize.patch
new file mode 100644
index 0000000..d481866
--- /dev/null
+++ b/debian/patches/0078-tests-Fix-tst_xdgshell-minMaxSize.patch
@@ -0,0 +1,30 @@
+From 08f6c09699998a47caa0866bab2afafa620327c3 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorodnii at kde.org>
+Date: Fri, 15 Sep 2023 10:06:32 +0300
+Subject: [PATCH] tests: Fix tst_xdgshell::minMaxSize()
+
+Amends e8cff6fb39c0fd01548bce18542820a6612dbe49.
+
+The new size hints will be committed when the surface is committed.
+
+Change-Id: I94e944fee7dac63d5e9ac86fb348b5d24d54abfc
+Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt at qt.io>
+(cherry picked from commit d8d3d6097afeac62f1b0285e3d5365c7cb580547)
+---
+ tests/auto/client/xdgshell/tst_xdgshell.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp
++++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp
+@@ -604,9 +604,11 @@ void tst_xdgshell::minMaxSize()
+     QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000));
+ 
+     window.setMaximumSize(QSize(500, 400));
++    window.update();
+     QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(500, 400));
+ 
+     window.setMinimumSize(QSize(50, 40));
++    window.update();
+     QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(50, 40));
+ }
+ 
diff --git a/debian/patches/0079-Client-Remove-some-surface-commits.patch b/debian/patches/0079-Client-Remove-some-surface-commits.patch
new file mode 100644
index 0000000..fa0c8f5
--- /dev/null
+++ b/debian/patches/0079-Client-Remove-some-surface-commits.patch
@@ -0,0 +1,55 @@
+From 0b530bd0e5e0b2e585157322a4426b385b632c56 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorodnii at kde.org>
+Date: Fri, 25 Aug 2023 10:15:29 +0300
+Subject: [PATCH] Client: Remove some surface commits
+
+The buffer transform, input and opaque regions are double buffered
+state. They will be applied on the next surface commit.
+
+But the issue with them is that the relevant code makes surface commits
+too. It's undesired as it can lead to qtwayland committing partial
+state, for example it can break xdg surface window geometry.
+
+This change removes hidden surface commits. The relevant properties will
+be applied on the next frame.
+
+Change-Id: I1c40c9a5430fb6b91d7643b20d628f8a9a9d501a
+Reviewed-by: David Edmundson <davidedmundson at kde.org>
+(cherry picked from commit e8cff6fb39c0fd01548bce18542820a6612dbe49)
+---
+ src/client/qwaylandwindow.cpp                               | 4 ----
+ src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 3 ---
+ 2 files changed, 7 deletions(-)
+
+--- a/src/client/qwaylandwindow.cpp
++++ b/src/client/qwaylandwindow.cpp
+@@ -478,8 +478,6 @@ void QWaylandWindow::setMask(const QRegion &mask)
+         if (isOpaque())
+             setOpaqueArea(mMask);
+     }
+-
+-    mSurface->commit();
+ }
+ 
+ void QWaylandWindow::applyConfigureWhenPossible()
+@@ -794,8 +792,6 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient
+             Q_UNREACHABLE();
+     }
+     mSurface->set_buffer_transform(transform);
+-    // set_buffer_transform is double buffered, we need to commit.
+-    mSurface->commit();
+ }
+ 
+ void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask)
+--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+@@ -367,9 +367,6 @@ bool QWaylandXdgSurface::wantsDecorations() const
+ void QWaylandXdgSurface::propagateSizeHints()
+ {
+     setSizeHints();
+-
+-    if (m_toplevel && m_window)
+-        m_window->commit();
+ }
+ 
+ void QWaylandXdgSurface::setWindowGeometry(const QRect &rect)
diff --git a/debian/patches/0080-Client-Avoid-locking-resizing-in-QWaylandShmBackingS.patch b/debian/patches/0080-Client-Avoid-locking-resizing-in-QWaylandShmBackingS.patch
new file mode 100644
index 0000000..7105245
--- /dev/null
+++ b/debian/patches/0080-Client-Avoid-locking-resizing-in-QWaylandShmBackingS.patch
@@ -0,0 +1,63 @@
+From e93ffe9bd5ee6fa737a1a0a8c6cde618a4e70291 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorodnii at kde.org>
+Date: Wed, 30 Aug 2023 09:49:41 +0300
+Subject: [PATCH] Client: Avoid locking resizing in QWaylandShmBackingStore
+
+QWaylandWindow::setCanResize(false) will block applying configure
+events. QWaylandWindow::setCanResize(true) will unblock configure events
+and potentially apply a scheduled configure event if there's one.
+
+QWaylandWindow::setCanResize(true) has to be called **after** committing
+the surface to ensure that the xdg window geometry matches the buffer.
+We don't want the xdg window geometry change when painting.
+
+Unfortunately, setCanResize(true) can be called before the surface is
+committed when using a RasterSurface, for example
+
+ - QWaylandShmBackingStore::beginPaint(): calls setCanResize(false)
+ - QWaylandShmBackingStore::endPaint(): calls setCanResize(true)
+ - QWaylandWindow::setCanResize(true): applies pending configure event
+ - QWaylandShmBackingStore::flush(): commits the surface, but the xdg
+   window geometry is wrong now
+
+As is, beginPaint() and endPaint() are not entirely correct functions
+where configure events can be blocked. We need functions that wrap both
+painting and flushing, which are not feasible with the current backing
+store design.
+
+On the other hand, it's worth noting that blocking configure events in
+the backing store is not necessary because painting happens on the main
+thread unlike OpenGL or Vulkan code paths.
+
+Given the lack of synchronization points and the fact that rendering
+happens on the main thread, this change removes blocking configure
+events in QWaylandShmBackingStore. It fixes dolphin and various other
+applications that use QtWidgets jumping while being interactively
+resized.
+
+Change-Id: I156e4fd5e04a6bba7e8d48171510d5ab0ec89713
+Reviewed-by: David Edmundson <davidedmundson at kde.org>
+(cherry picked from commit 8828452bcf2ecf4e02a64380a1697d148c4366b0)
+---
+ src/client/qwaylandshmbackingstore.cpp | 3 ---
+ 1 file changed, 3 deletions(-)
+
+--- a/src/client/qwaylandshmbackingstore.cpp
++++ b/src/client/qwaylandshmbackingstore.cpp
+@@ -186,8 +186,6 @@ void QWaylandShmBackingStore::beginPaint(const QRegion &region)
+     mPainting = true;
+     ensureSize();
+ 
+-    waylandWindow()->setCanResize(false);
+-
+     if (mBackBuffer->image()->hasAlphaChannel()) {
+         QPainter p(paintDevice());
+         p.setCompositionMode(QPainter::CompositionMode_Source);
+@@ -202,7 +200,6 @@ void QWaylandShmBackingStore::endPaint()
+     mPainting = false;
+     if (mPendingFlush)
+         flush(window(), mPendingRegion, QPoint());
+-    waylandWindow()->setCanResize(true);
+ }
+ 
+ void QWaylandShmBackingStore::ensureSize()
diff --git a/debian/patches/0081-Client-Always-populate-mimedata-in-drags.patch b/debian/patches/0081-Client-Always-populate-mimedata-in-drags.patch
new file mode 100644
index 0000000..97b1c6a
--- /dev/null
+++ b/debian/patches/0081-Client-Always-populate-mimedata-in-drags.patch
@@ -0,0 +1,47 @@
+From c80564c1dfe202c3975ca0ff67e0b72b0352bf13 Mon Sep 17 00:00:00 2001
+From: David Edmundson <davidedmundson at kde.org>
+Date: Wed, 17 May 2023 09:06:03 +0300
+Subject: [PATCH] Client: Always populate mimedata in drags
+
+It's possible for clients to perform a drag and drop operation within
+their own client without any mimeData. A user can directly access the
+original drag.
+
+On wayland without any mimedata it's impossible for a client to accept a
+drag as the mechansim involved is to either select a given mimedata
+entry or an empty string. Within Qt we always accept the first format if
+we accept a drag.
+
+When dragging within our own window we also start a wayland drag so will
+receive a cancel event from the compositor if the compositor doesn't
+believe the client has accepted the drag.
+
+This patch provides a dummy mimedata entry so that something can be
+accepted.
+
+Fixes: QTBUG-112161
+Pick-to: 6.6 6.5 6.2 5.15
+Change-Id: I6309d82e20545e10ebdb9dafde7e13a5e3be5ff2
+Reviewed-by: Liang Qi <liang.qi at qt.io>
+(cherry picked from commit 32fedb6fa6579711b6cb192a2e3cfb7ad1264546)
+
+* asturmlechner 2023-10-24: Backported L1 literal as QString::fromLatin1
+---
+ src/client/qwaylanddatadevice.cpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/src/client/qwaylanddatadevice.cpp
++++ b/src/client/qwaylanddatadevice.cpp
+@@ -124,6 +124,12 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte
+         return false;
+     }
+ 
++    // dragging data without mimetypes is a legal operation in Qt terms
++    // but Wayland uses a mimetype to determine if a drag is accepted or not
++    // In this rare case, insert a placeholder
++    if (mimeData->formats().isEmpty())
++        mimeData->setData(QString::fromLatin1("application/x-qt-avoid-empty-placeholder"), QByteArray("1"));
++
+     m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData));
+ 
+     if (wl_data_device_get_version(object()) >= 3)
diff --git a/debian/patches/series b/debian/patches/series
index b5f10a1..9313832 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -46,4 +46,16 @@
 0067-Client-Manage-QMimeData-lifecycle.patch
 0068-client-Do-not-cast-placeholder-screens-to-QWaylandSc.patch
 0069-Client-Remove-flip-popup-constraints.patch
+0070-Destroy-frame-queue-before-display.patch
+0071-client-Fix-crash-on-dnd-updates-after-client-facing-.patch
+0072-Convert-cursor-bitmap-to-supported-format.patch
+0073-Replace-scale-with-devicePixelRatio-for-non-integer-.patch
+0074-Client-Fix-buffer-damage.patch
+0075-client-Fix-infinite-recursion-with-text-input-v2.patch
+0076-Client-Fix-the-mouse-being-stuck-in-pressed-state-af.patch
+0077-Client-Commit-the-initial-surface-state-explicitly.patch
+0078-tests-Fix-tst_xdgshell-minMaxSize.patch
+0079-Client-Remove-some-surface-commits.patch
+0080-Client-Avoid-locking-resizing-in-QWaylandShmBackingS.patch
+0081-Client-Always-populate-mimedata-in-drags.patch
 skip_animated_cursor_test.diff



More information about the Neon-commits mailing list