From 5ebdb34771325d10f24ee80baaf787c6ba405e39 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 20 Sep 2021 09:20:33 +0200 Subject: [PATCH] Sync with Fedora Resolves: bz#2003935 --- ...an-output-after-receiving-more-compl.patch | 146 ++++++++++++++++++ ...ue-with-repeated-window-size-changes.patch | 14 +- ...lude-locale.h-for-setlocale-LC_CTYPE.patch | 31 ++++ ...rags-being-accepted-to-updating-the-.patch | 39 +++++ ...ect-registry-listener-on-destruction.patch | 49 ++++++ ...ell-size-hints-before-the-first-comm.patch | 58 +++++++ 0026-Fix-build.patch | 46 ++++++ 0027-Fix-remove-listener.patch | 33 ++++ 0028-Hook-up-queryKeyboardModifers.patch | 55 +++++++ ...the-mask-if-we-do-not-have-a-surface.patch | 44 ++++++ ...-if-image-format-is-supported-by-QIm.patch | 68 ++++++++ qt5-qtwayland.spec | 18 ++- 12 files changed, 594 insertions(+), 7 deletions(-) create mode 100644 0020-Client-Announce-an-output-after-receiving-more-compl.patch rename qtwayland-fix-issue-with-repeated-window-size-changes.patch => 0021-Fix-issue-with-repeated-window-size-changes.patch (89%) create mode 100644 0022-Include-locale.h-for-setlocale-LC_CTYPE.patch create mode 100644 0023-Client-Connect-drags-being-accepted-to-updating-the-.patch create mode 100644 0024-Client-Disconnect-registry-listener-on-destruction.patch create mode 100644 0025-Client-Set-XdgShell-size-hints-before-the-first-comm.patch create mode 100644 0026-Fix-build.patch create mode 100644 0027-Fix-remove-listener.patch create mode 100644 0028-Hook-up-queryKeyboardModifers.patch create mode 100644 0029-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch create mode 100644 0030-Correctly-detect-if-image-format-is-supported-by-QIm.patch diff --git a/0020-Client-Announce-an-output-after-receiving-more-compl.patch b/0020-Client-Announce-an-output-after-receiving-more-compl.patch new file mode 100644 index 0000000..5b7e3bd --- /dev/null +++ b/0020-Client-Announce-an-output-after-receiving-more-compl.patch @@ -0,0 +1,146 @@ +From d5186701e27ad6f09f3944809cec2a25c5328026 Mon Sep 17 00:00:00 2001 +From: Vlad Zahorodnii +Date: Wed, 5 May 2021 20:49:26 +0300 +Subject: [PATCH 20/30] Client: Announce an output after receiving more + complete state + +Output initialization is not atomic, meaning that the compositor may +process a wl_output bind request in one event loop cycle, and the +xdg_output_manager.get_xdg_output in another event loop cycle. + +This means that xdg_output properties may arrive in another wl_output +done frame. Prior to xdg-output v3, that wasn't an issue because the +compositor is required to send an xdg_output.done event after sending +xdg_output properties. + +Starting with v3, the compositor may choose not to send an +xdg_output.done event after sending xdg_output properties. Therefore, +as is, QtWayland may announce an output with bad logical geometry or +even worse without name assigned by the compositor. + +Unfortunately, that breaks applications such as plasmashell. Plasma uses +output names as a criterion to determine what kind of contents should be +displayed on a particular output. + +In order to fix the initialization sequence, this change makes every +QWaylandScreen track processed events. After all required events have +been received, the screen can be announced to the rest of Qt. + +Change-Id: If5da747edd7af277ec1364cbea105c6994f47402 +Reviewed-by: David Edmundson +(cherry picked from commit 69ea480f2e53ad4a5bbca78cde044eb8d4c48896) + +Original Ticket: https://codereview.qt-project.org/c/qt/qtwayland/+/347774 +CCBUG: 435124 +--- + src/client/qwaylandscreen.cpp | 32 +++++++++++++++++++++++--------- + src/client/qwaylandscreen_p.h | 10 ++++++++-- + 2 files changed, 31 insertions(+), 11 deletions(-) + +diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp +index 6cb337de..7c2d9be3 100644 +--- a/src/client/qwaylandscreen.cpp ++++ b/src/client/qwaylandscreen.cpp +@@ -72,7 +72,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin + qCWarning(lcQpaWayland) << "wl_output done event not supported by compositor," + << "QScreen may not work correctly"; + mWaylandDisplay->forceRoundTrip(); // Give the compositor a chance to send geometry etc. +- mOutputDone = true; // Fake the done event ++ mProcessedEvents |= OutputDoneEvent; // Fake the done event + maybeInitialize(); + } + } +@@ -83,14 +83,25 @@ QWaylandScreen::~QWaylandScreen() + zxdg_output_v1::destroy(); + } + ++uint QWaylandScreen::requiredEvents() const ++{ ++ uint ret = OutputDoneEvent; ++ ++ if (mWaylandDisplay->xdgOutputManager()) { ++ ret |= XdgOutputNameEvent; ++ ++ if (mWaylandDisplay->xdgOutputManager()->version() < 3) ++ ret |= XdgOutputDoneEvent; ++ } ++ return ret; ++} ++ + void QWaylandScreen::maybeInitialize() + { + Q_ASSERT(!mInitialized); + +- if (!mOutputDone) +- return; +- +- if (mWaylandDisplay->xdgOutputManager() && !mXdgOutputDone) ++ const uint requiredEvents = this->requiredEvents(); ++ if ((mProcessedEvents & requiredEvents) != requiredEvents) + return; + + mInitialized = true; +@@ -276,9 +287,8 @@ void QWaylandScreen::output_scale(int32_t factor) + + void QWaylandScreen::output_done() + { +- mOutputDone = true; +- if (zxdg_output_v1::isInitialized() && mWaylandDisplay->xdgOutputManager()->version() >= 3) +- mXdgOutputDone = true; ++ mProcessedEvents |= OutputDoneEvent; ++ + if (mInitialized) { + updateOutputProperties(); + if (zxdg_output_v1::isInitialized()) +@@ -339,7 +349,7 @@ void QWaylandScreen::zxdg_output_v1_done() + if (Q_UNLIKELY(mWaylandDisplay->xdgOutputManager()->version() >= 3)) + qWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor"; + +- mXdgOutputDone = true; ++ mProcessedEvents |= XdgOutputDoneEvent; + if (mInitialized) + updateXdgOutputProperties(); + else +@@ -348,7 +358,11 @@ void QWaylandScreen::zxdg_output_v1_done() + + void QWaylandScreen::zxdg_output_v1_name(const QString &name) + { ++ if (Q_UNLIKELY(mInitialized)) ++ qWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor"; ++ + mOutputName = name; ++ mProcessedEvents |= XdgOutputNameEvent; + } + + void QWaylandScreen::updateXdgOutputProperties() +diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h +index df1c94f2..050cfdc0 100644 +--- a/src/client/qwaylandscreen_p.h ++++ b/src/client/qwaylandscreen_p.h +@@ -116,6 +116,13 @@ public: + static QWaylandScreen *fromWlOutput(::wl_output *output); + + private: ++ enum Event : uint { ++ XdgOutputDoneEvent = 0x1, ++ OutputDoneEvent = 0x2, ++ XdgOutputNameEvent = 0x4, ++ }; ++ uint requiredEvents() const; ++ + void output_mode(uint32_t flags, int width, int height, int refresh) override; + void output_geometry(int32_t x, int32_t y, + int32_t width, int32_t height, +@@ -148,8 +155,7 @@ private: + QSize mPhysicalSize; + QString mOutputName; + Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; +- bool mOutputDone = false; +- bool mXdgOutputDone = false; ++ uint mProcessedEvents = 0; + bool mInitialized = false; + + #if QT_CONFIG(cursor) +-- +2.31.1 + diff --git a/qtwayland-fix-issue-with-repeated-window-size-changes.patch b/0021-Fix-issue-with-repeated-window-size-changes.patch similarity index 89% rename from qtwayland-fix-issue-with-repeated-window-size-changes.patch rename to 0021-Fix-issue-with-repeated-window-size-changes.patch index 7e6dee7..be081e2 100644 --- a/qtwayland-fix-issue-with-repeated-window-size-changes.patch +++ b/0021-Fix-issue-with-repeated-window-size-changes.patch @@ -1,7 +1,7 @@ -From 14d066c61025e548227ccd8d655e80ffa31fa15e Mon Sep 17 00:00:00 2001 +From 62494312db0f58053d1342bfacc7984186fdf3a6 Mon Sep 17 00:00:00 2001 From: Jaeyoon Jung Date: Mon, 15 Feb 2021 08:31:06 +0900 -Subject: [PATCH] Fix issue with repeated window size changes +Subject: [PATCH 21/30] Fix issue with repeated window size changes Check if the new window size is different from the size requested previously before calling wl_egl_window_resize. It addresses the issue @@ -13,13 +13,14 @@ we would mistakenly skip the resize. Change-Id: Iafe4a91cc707f854b9099b6109b6be1423d7bd29 Reviewed-by: Eskil Abrahamsen Blomfeldt +(cherry picked from commit 14d066c61025e548227ccd8d655e80ffa31fa15e) --- .../client/wayland-egl/qwaylandeglwindow.cpp | 4 +++- .../client/wayland-egl/qwaylandeglwindow.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp -index 1e8dc06f7..355aca864 100644 +index 7889f575..201b583b 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp @@ -131,14 +131,16 @@ void QWaylandEglWindow::updateSurface(bool create) @@ -41,10 +42,10 @@ index 1e8dc06f7..355aca864 100644 if (!m_eglSurface && m_waylandEglWindow && create) { diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h -index 5b1f4d56f..0079dfef8 100644 +index 5b1f4d56..0079dfef 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h -@@ -88,6 +88,7 @@ class QWaylandEglWindow : public QWaylandWindow +@@ -88,6 +88,7 @@ private: mutable QOpenGLFramebufferObject *m_contentFBO = nullptr; QSurfaceFormat m_format; @@ -52,3 +53,6 @@ index 5b1f4d56f..0079dfef8 100644 }; } +-- +2.31.1 + diff --git a/0022-Include-locale.h-for-setlocale-LC_CTYPE.patch b/0022-Include-locale.h-for-setlocale-LC_CTYPE.patch new file mode 100644 index 0000000..8334316 --- /dev/null +++ b/0022-Include-locale.h-for-setlocale-LC_CTYPE.patch @@ -0,0 +1,31 @@ +From 1ccebbab3a42690a0812e2c4c76016799bf6cf1f Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +Date: Mon, 10 May 2021 14:38:49 +0200 +Subject: [PATCH 22/30] Include locale.h for setlocale/LC_CTYPE + +Pick-to: 5.15 +Change-Id: Iced32a31a63cec71008549c1e0961d59ffc45a37 +Reviewed-by: Aleix Pol Gonzalez +(cherry picked from commit e9522eda46028f351d87311d898ab985856970b0) +--- + src/client/qwaylandinputcontext.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp +index ef5aa375..503fd735 100644 +--- a/src/client/qwaylandinputcontext.cpp ++++ b/src/client/qwaylandinputcontext.cpp +@@ -51,6 +51,10 @@ + #include "qwaylandinputmethodeventbuilder_p.h" + #include "qwaylandwindow_p.h" + ++#if QT_CONFIG(xkbcommon) ++#include ++#endif ++ + QT_BEGIN_NAMESPACE + + Q_LOGGING_CATEGORY(qLcQpaInputMethods, "qt.qpa.input.methods") +-- +2.31.1 + diff --git a/0023-Client-Connect-drags-being-accepted-to-updating-the-.patch b/0023-Client-Connect-drags-being-accepted-to-updating-the-.patch new file mode 100644 index 0000000..8b16e83 --- /dev/null +++ b/0023-Client-Connect-drags-being-accepted-to-updating-the-.patch @@ -0,0 +1,39 @@ +From fcc2f57cefa66339c8cb6632f45a47fbb99bb60d Mon Sep 17 00:00:00 2001 +From: David Edmundson +Date: Tue, 9 Feb 2021 16:09:21 +0000 +Subject: [PATCH 23/30] Client: Connect drags being accepted to updating the + source drag icon + +Currently in a multi-process drag and drop when the other client accepts +a given mimetype for dropping it calls accept, which is received by the +client, but the drag cursor is never updated. + +Instead the drag cursor was updated in the data_device_enter events +which only works if we are operating within one process. + +The code existed to handle this existed but both the targetChanged +signal and the dragSourceTargetChanged were unused. + +Change-Id: I443f31f1b2ef72d4b5eadaf7115f97544dac883a +Reviewed-by: Vlad Zahorodnii +Reviewed-by: Eskil Abrahamsen Blomfeldt +(cherry picked from commit 08e478448a97a440d5a968a5d797f0d7302140c2) +--- + src/client/qwaylanddatadevice.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp +index 19944a34..54a69c3c 100644 +--- a/src/client/qwaylanddatadevice.cpp ++++ b/src/client/qwaylanddatadevice.cpp +@@ -124,6 +124,7 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) + + m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData)); + connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled); ++ connect(m_dragSource.data(), &QWaylandDataSource::targetChanged, this, &QWaylandDataDevice::dragSourceTargetChanged); + + start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); + return true; +-- +2.31.1 + diff --git a/0024-Client-Disconnect-registry-listener-on-destruction.patch b/0024-Client-Disconnect-registry-listener-on-destruction.patch new file mode 100644 index 0000000..9fdd7ba --- /dev/null +++ b/0024-Client-Disconnect-registry-listener-on-destruction.patch @@ -0,0 +1,49 @@ +From 1b5e43a593e917610e6245f7a272ac081c508ba4 Mon Sep 17 00:00:00 2001 +From: David Edmundson +Date: Fri, 14 May 2021 13:23:24 +0100 +Subject: [PATCH 24/30] Client: Disconnect registry listener on destruction + +If a display outlives a QWaylandClientExtension and a new global is +announced we end up delivering an event to a now deleted extension which +will crash. + +Change-Id: Idc0de40be61a2f7627ab4963e1fe29b22fbf3f04 +(cherry picked from commit c4ba37cd2f8cb81b9438b56ac604fc2f3e45083c) +--- + src/client/global/qwaylandclientextension.cpp | 7 +++++++ + src/client/global/qwaylandclientextension.h | 1 + + 2 files changed, 8 insertions(+) + +diff --git a/src/client/global/qwaylandclientextension.cpp b/src/client/global/qwaylandclientextension.cpp +index 125b1e19..797b06fe 100644 +--- a/src/client/global/qwaylandclientextension.cpp ++++ b/src/client/global/qwaylandclientextension.cpp +@@ -88,6 +88,13 @@ QWaylandClientExtension::QWaylandClientExtension(const int ver) + QMetaObject::invokeMethod(this, "addRegistryListener", Qt::QueuedConnection); + } + ++QWaylandClientExtension::~QWaylandClientExtension() ++{ ++ Q_D(QWaylandClientExtension); ++ if (d->registered && !QCoreApplication::closingDown()) ++ d->waylandIntegration->display()->removeListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); ++} ++ + QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const + { + Q_D(const QWaylandClientExtension); +diff --git a/src/client/global/qwaylandclientextension.h b/src/client/global/qwaylandclientextension.h +index 98272e57..5bd28398 100644 +--- a/src/client/global/qwaylandclientextension.h ++++ b/src/client/global/qwaylandclientextension.h +@@ -63,6 +63,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject + Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) + public: + QWaylandClientExtension(const int version); ++ ~QWaylandClientExtension(); + + QtWaylandClient::QWaylandIntegration *integration() const; + int version() const; +-- +2.31.1 + diff --git a/0025-Client-Set-XdgShell-size-hints-before-the-first-comm.patch b/0025-Client-Set-XdgShell-size-hints-before-the-first-comm.patch new file mode 100644 index 0000000..74a60fc --- /dev/null +++ b/0025-Client-Set-XdgShell-size-hints-before-the-first-comm.patch @@ -0,0 +1,58 @@ +From 36a552fa530be57091e986ebd1468d75d3061743 Mon Sep 17 00:00:00 2001 +From: David Edmundson +Date: Mon, 3 May 2021 23:01:53 +0100 +Subject: [PATCH 25/30] Client: Set XdgShell size hints before the first commit + +propagateSizeHints is only called in QWindow we have platform window and +minimumSizeHint is then sent. We also need to send existing hints when +we create the shell window. + +Sending them when we apply configure is too late, we need these hints +available for the compositor to correctly configure the window. + +Change-Id: I6cbb294b11db06ecd87535fa4816bb8ad34a29c6 +Reviewed-by: Vlad Zahorodnii +Reviewed-by: Aleix Pol Gonzalez +(cherry picked from commit d6e074d0d35221b0fac14c94fc79c98363f2f6c3) +--- + src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 3 +-- + tests/auto/client/xdgshell/tst_xdgshell.cpp | 2 +- + 2 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +index 3a1569f7..7d33dabd 100644 +--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp ++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +@@ -105,8 +105,6 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() + m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); + } + +- m_xdgSurface->setSizeHints(); +- + m_applied = m_pending; + qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; + } +@@ -257,6 +255,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s + m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); + } + } ++ setSizeHints(); + } + + QWaylandXdgSurface::~QWaylandXdgSurface() +diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp +index 2277bbb8..2fdd0a7c 100644 +--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp ++++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp +@@ -505,7 +505,7 @@ void tst_xdgshell::minMaxSize() + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + +- exec([=] { xdgToplevel()->sendCompleteConfigure(); }); ++ // we don't roundtrip with our configuration the initial commit should be correct + + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(100, 100)); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000)); +-- +2.31.1 + diff --git a/0026-Fix-build.patch b/0026-Fix-build.patch new file mode 100644 index 0000000..49f8f70 --- /dev/null +++ b/0026-Fix-build.patch @@ -0,0 +1,46 @@ +From a8ddf1a7296e2d28b36231a391807226a7329ae4 Mon Sep 17 00:00:00 2001 +From: David Edmundson +Date: Mon, 14 Jun 2021 12:45:37 +0100 +Subject: [PATCH 26/30] Fix build + +1b5e43a593e917610e6245f7a272ac081c508ba4 relied on a patch that we can't +backport. + +This adds that extra internal boolean backporting just the tiny part of +d6ac8cf6. +--- + src/client/global/qwaylandclientextension.cpp | 5 ++++- + src/client/global/qwaylandclientextension_p.h | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/client/global/qwaylandclientextension.cpp b/src/client/global/qwaylandclientextension.cpp +index 797b06fe..edccfe63 100644 +--- a/src/client/global/qwaylandclientextension.cpp ++++ b/src/client/global/qwaylandclientextension.cpp +@@ -74,7 +74,10 @@ void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_regis + void QWaylandClientExtension::addRegistryListener() + { + Q_D(QWaylandClientExtension); +- d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); ++ if (!d->registered) { ++ d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this); ++ d->registered = true; ++ } + } + + QWaylandClientExtension::QWaylandClientExtension(const int ver) +diff --git a/src/client/global/qwaylandclientextension_p.h b/src/client/global/qwaylandclientextension_p.h +index 69cc46a0..9091efbe 100644 +--- a/src/client/global/qwaylandclientextension_p.h ++++ b/src/client/global/qwaylandclientextension_p.h +@@ -68,6 +68,7 @@ public: + QtWaylandClient::QWaylandIntegration *waylandIntegration = nullptr; + int version = -1; + bool active = false; ++ bool registered = false; + }; + + class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate +-- +2.31.1 + diff --git a/0027-Fix-remove-listener.patch b/0027-Fix-remove-listener.patch new file mode 100644 index 0000000..a06aec8 --- /dev/null +++ b/0027-Fix-remove-listener.patch @@ -0,0 +1,33 @@ +From d1c4a459faa1d514026c4834828cb33024ac2ceb Mon Sep 17 00:00:00 2001 +From: Zhang Liang +Date: Mon, 1 Feb 2021 19:29:43 +0800 +Subject: [PATCH 27/30] Fix: remove listener + +Add the operation for removing the listener form listener list + +Change-Id: Ief2ff1303b607eee499543303fe80e51f8f10cc5 +Reviewed-by: David Edmundson +(cherry picked from commit 16760280fd04cf70255bab16d9acecad254fdd8f) +--- + src/client/qwaylanddisplay.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp +index f10c1f79..e0dfe8b2 100644 +--- a/src/client/qwaylanddisplay.cpp ++++ b/src/client/qwaylanddisplay.cpp +@@ -452,9 +452,10 @@ void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) + + void QWaylandDisplay::removeListener(RegistryListener listener, void *data) + { +- std::remove_if(mRegistryListeners.begin(), mRegistryListeners.end(), [=](Listener l){ ++ auto iter = std::remove_if(mRegistryListeners.begin(), mRegistryListeners.end(), [=](Listener l){ + return (l.listener == listener && l.data == data); + }); ++ mRegistryListeners.erase(iter, mRegistryListeners.end()); + } + + uint32_t QWaylandDisplay::currentTimeMillisec() +-- +2.31.1 + diff --git a/0028-Hook-up-queryKeyboardModifers.patch b/0028-Hook-up-queryKeyboardModifers.patch new file mode 100644 index 0000000..f8346ff --- /dev/null +++ b/0028-Hook-up-queryKeyboardModifers.patch @@ -0,0 +1,55 @@ +From a6476d1a1c78eb7f17408241b268404e27b3e161 Mon Sep 17 00:00:00 2001 +From: David Redondo +Date: Wed, 26 May 2021 14:49:40 +0200 +Subject: [PATCH 28/30] Hook up queryKeyboardModifers + +Can be useful when upon enter a modifiers event is received but no key +event so no QKeyEvent is generated. + +Fixes: QTBUG-62786 +Change-Id: I30b57fc78ce6d54d8f644ca95ba40e7e26eb24ed +Reviewed-by: Marco Martin +Reviewed-by: David Edmundson + + +(cherry picked from commit 4fa2baba8181ade4958a94e9531ec4f6919438a9) +--- + src/client/qwaylandintegration.cpp | 8 ++++++++ + src/client/qwaylandintegration_p.h | 2 ++ + 2 files changed, 10 insertions(+) + +diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp +index c53ccb78..e5e7dd42 100644 +--- a/src/client/qwaylandintegration.cpp ++++ b/src/client/qwaylandintegration.cpp +@@ -262,6 +262,14 @@ QWaylandDisplay *QWaylandIntegration::display() const + return mDisplay.data(); + } + ++Qt::KeyboardModifiers QWaylandIntegration::queryKeyboardModifiers() const ++{ ++ if (auto *seat = mDisplay->currentInputDevice()) { ++ return seat->modifiers(); ++ } ++ return Qt::NoModifier; ++} ++ + QList QWaylandIntegration::possibleKeys(const QKeyEvent *event) const + { + if (auto *seat = mDisplay->currentInputDevice()) +diff --git a/src/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h +index ff70ae25..73b80658 100644 +--- a/src/client/qwaylandintegration_p.h ++++ b/src/client/qwaylandintegration_p.h +@@ -107,6 +107,8 @@ public: + + QWaylandDisplay *display() const; + ++ Qt::KeyboardModifiers queryKeyboardModifiers() const override; ++ + QList possibleKeys(const QKeyEvent *event) const override; + + QStringList themeNames() const override; +-- +2.31.1 + diff --git a/0029-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch b/0029-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch new file mode 100644 index 0000000..94eb655 --- /dev/null +++ b/0029-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch @@ -0,0 +1,44 @@ +From d4c41797b61a5a8da47c5821711aca72e756dcbf Mon Sep 17 00:00:00 2001 +From: Aleix Pol +Date: Tue, 13 Jul 2021 13:32:15 +0200 +Subject: [PATCH 29/30] Do not update the mask if we do not have a surface + +mMask serves as a cache to remember what we've sent, the source of truth +for the value is window()->mask(). +No need to store values that we are going to discard, because it will +confuse the state of newly created windows. + +Change-Id: I6aa3da82c7f09c7ef90d0f7060f292fb042730f0 +Pick-to: 5.15 6.2 +Reviewed-by: David Edmundson +(cherry picked from commit 962f87190c682562b369c5ebd93dc9ce0915ed7a) +--- + src/client/qwaylandwindow.cpp | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp +index e96d8fe9..bd70f4af 100644 +--- a/src/client/qwaylandwindow.cpp ++++ b/src/client/qwaylandwindow.cpp +@@ -464,14 +464,15 @@ void QWaylandWindow::lower() + + void QWaylandWindow::setMask(const QRegion &mask) + { ++ QReadLocker locker(&mSurfaceLock); ++ if (!mSurface) ++ return; ++ + if (mMask == mask) + return; + + mMask = mask; + +- if (!mSurface) +- return; +- + if (mMask.isEmpty()) { + mSurface->set_input_region(nullptr); + +-- +2.31.1 + diff --git a/0030-Correctly-detect-if-image-format-is-supported-by-QIm.patch b/0030-Correctly-detect-if-image-format-is-supported-by-QIm.patch new file mode 100644 index 0000000..8486dfb --- /dev/null +++ b/0030-Correctly-detect-if-image-format-is-supported-by-QIm.patch @@ -0,0 +1,68 @@ +From 3c420cd180397e3f42c8a436a7f1b11465925bdd Mon Sep 17 00:00:00 2001 +From: Jan Blackquill +Date: Tue, 24 Aug 2021 14:36:34 -0400 +Subject: [PATCH 30/30] Correctly detect if image format is supported by + QImageWriter + +The code queries potential image formats by stripping a mimetype of its +'image/' prefix and making the rest of the mimetype capitalised, such as +'image/png' -> 'PNG'. The problem is that this is then searched for in +QImageWriter::supportedImageFormats() by simple equality. The method +returns a list of lowercase byte arrays, not uppercase. As the codepath +can never match due to checking for an uppercase word in an array of +lowercase words, this means that images are effectively always sent as +BMP format, even if they should be sent in other formats, such as PNG +or JPEG. + +A simple inspection with GDB (or a qDebug) reveals this: + +``` +(gdb) p QImageWriter::supportedImageFormats() +$31 = {"bmp" = {...}, "bw" = {...}, "cur" = {...}, "eps" = {...}, + "epsf" = {...}, "epsi" = {...}, "icns" = {...}, + "ico" = {...}, "jp2" = {...}, "jpeg" = {...}, "jpg" = {...}, + "pbm" = {...}, "pcx" = {...}, "pgm" = {...}, + "pic" = {...}, "png" = {...}, "ppm" = {...}, + "rgb" = {...}, "rgba" = {...}, "sgi" = {...}, + "tga" = {...}, "tif" = {...}, "tiff" = {...}, + "wbmp" = {...}, "webp" = {...}, "xbm" = {...}, "xpm" = {...}} +``` + +``` +(gdb) p QImageWriter::supportedImageFormats().contains("PNG") +$32 = false +``` + +``` +(gdb) p QImageWriter::supportedImageFormats().contains("png") +$33 = true +``` + +The fix for this is simple: lowercase the remainder of the mimetype, +instead of uppercasing it, and we can start hitting the codepath that's +supposed to write non-BMP formats. + +Change-Id: Id3e9b730b7edcabcb2f1b04d8ef0a4c1fb9c9159 +Reviewed-by: David Edmundson +Reviewed-by: Qt CI Bot +(cherry picked from commit 6072c1dc87e185f30c014f764737ac97b906640f) +--- + src/shared/qwaylandmimehelper.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/shared/qwaylandmimehelper.cpp b/src/shared/qwaylandmimehelper.cpp +index a5fdd34d..051a91dc 100644 +--- a/src/shared/qwaylandmimehelper.cpp ++++ b/src/shared/qwaylandmimehelper.cpp +@@ -60,7 +60,7 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString & + buf.open(QIODevice::ReadWrite); + QByteArray fmt = "BMP"; + if (mimeType.startsWith(QLatin1String("image/"))) { +- QByteArray imgFmt = mimeType.mid(6).toUpper().toLatin1(); ++ QByteArray imgFmt = mimeType.mid(6).toLower().toLatin1(); + if (QImageWriter::supportedImageFormats().contains(imgFmt)) + fmt = imgFmt; + } +-- +2.31.1 + diff --git a/qt5-qtwayland.spec b/qt5-qtwayland.spec index 8c40c52..3c76237 100644 --- a/qt5-qtwayland.spec +++ b/qt5-qtwayland.spec @@ -5,7 +5,7 @@ Summary: Qt5 - Wayland platform support and QtCompositor module Name: qt5-%{qt_module} Version: 5.15.2 -Release: 9%{?dist} +Release: 10%{?dist} License: LGPLv3 Url: http://www.qt.io @@ -36,8 +36,18 @@ Patch16: 0016-Get-correct-decoration-margins-region.patch Patch17: 0017-xdgshell-Tell-the-compositor-the-screen-we-re-expect.patch Patch18: 0018-Fix-compilation.patch Patch19: 0019-client-Allow-QWaylandInputContext-to-accept-composed.patch +Patch20: 0020-Client-Announce-an-output-after-receiving-more-compl.patch +Patch21: 0021-Fix-issue-with-repeated-window-size-changes.patch +Patch22: 0022-Include-locale.h-for-setlocale-LC_CTYPE.patch +Patch23: 0023-Client-Connect-drags-being-accepted-to-updating-the-.patch +Patch24: 0024-Client-Disconnect-registry-listener-on-destruction.patch +Patch25: 0025-Client-Set-XdgShell-size-hints-before-the-first-comm.patch +Patch26: 0026-Fix-build.patch +Patch27: 0027-Fix-remove-listener.patch +Patch28: 0028-Hook-up-queryKeyboardModifers.patch +Patch29: 0029-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch +Patch30: 0030-Correctly-detect-if-image-format-is-supported-by-QIm.patch -Patch51: qtwayland-fix-issue-with-repeated-window-size-changes.patch Patch52: qtwayland-client-expose-toplevel-window-state.patch # Upstreamable patches @@ -167,6 +177,10 @@ popd %endif %changelog +* Mon Sep 20 2021 Jan Grulich - 5.15.2-10 +- Sync with Fedora + Resolves: bz#2003935 + * Mon Aug 23 2021 Jan Grulich - 5.15.2-9 - Client: expose toplevel window state (change from Qt6) Resolves: bz#1968292