diff --git a/SOURCES/0020-Client-Announce-an-output-after-receiving-more-compl.patch b/SOURCES/0020-Client-Announce-an-output-after-receiving-more-compl.patch new file mode 100644 index 0000000..5b7e3bd --- /dev/null +++ b/SOURCES/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/SOURCES/0021-Fix-issue-with-repeated-window-size-changes.patch b/SOURCES/0021-Fix-issue-with-repeated-window-size-changes.patch new file mode 100644 index 0000000..be081e2 --- /dev/null +++ b/SOURCES/0021-Fix-issue-with-repeated-window-size-changes.patch @@ -0,0 +1,58 @@ +From 62494312db0f58053d1342bfacc7984186fdf3a6 Mon Sep 17 00:00:00 2001 +From: Jaeyoon Jung +Date: Mon, 15 Feb 2021 08:31:06 +0900 +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 +where repeated setGeometry calls between two sizes might not work as +expected. The problem occurs when wl_egl_window_get_attached_size does +not get the same size that was requested by the previous setGeometry +call. If the returned size happened to match the new size instead, +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 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) + if (!disableResizeCheck) { + wl_egl_window_get_attached_size(m_waylandEglWindow, ¤t_width, ¤t_height); + } +- if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height())) { ++ if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height()) || m_requestedSize != sizeWithMargins) { + wl_egl_window_resize(m_waylandEglWindow, sizeWithMargins.width(), sizeWithMargins.height(), mOffset.x(), mOffset.y()); ++ m_requestedSize = sizeWithMargins; + mOffset = QPoint(); + + m_resize = true; + } + } else if (create && wlSurface()) { + m_waylandEglWindow = wl_egl_window_create(wlSurface(), sizeWithMargins.width(), sizeWithMargins.height()); ++ m_requestedSize = sizeWithMargins; + } + + 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 5b1f4d56..0079dfef 100644 +--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h ++++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h +@@ -88,6 +88,7 @@ private: + mutable QOpenGLFramebufferObject *m_contentFBO = nullptr; + + QSurfaceFormat m_format; ++ QSize m_requestedSize; + }; + + } +-- +2.31.1 + diff --git a/SOURCES/0022-Include-locale.h-for-setlocale-LC_CTYPE.patch b/SOURCES/0022-Include-locale.h-for-setlocale-LC_CTYPE.patch new file mode 100644 index 0000000..8334316 --- /dev/null +++ b/SOURCES/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/SOURCES/0023-Client-Connect-drags-being-accepted-to-updating-the-.patch b/SOURCES/0023-Client-Connect-drags-being-accepted-to-updating-the-.patch new file mode 100644 index 0000000..8b16e83 --- /dev/null +++ b/SOURCES/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/SOURCES/0024-Client-Disconnect-registry-listener-on-destruction.patch b/SOURCES/0024-Client-Disconnect-registry-listener-on-destruction.patch new file mode 100644 index 0000000..9fdd7ba --- /dev/null +++ b/SOURCES/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/SOURCES/0025-Client-Set-XdgShell-size-hints-before-the-first-comm.patch b/SOURCES/0025-Client-Set-XdgShell-size-hints-before-the-first-comm.patch new file mode 100644 index 0000000..74a60fc --- /dev/null +++ b/SOURCES/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/SOURCES/0026-Fix-build.patch b/SOURCES/0026-Fix-build.patch new file mode 100644 index 0000000..49f8f70 --- /dev/null +++ b/SOURCES/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/SOURCES/0027-Fix-remove-listener.patch b/SOURCES/0027-Fix-remove-listener.patch new file mode 100644 index 0000000..a06aec8 --- /dev/null +++ b/SOURCES/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/SOURCES/0028-Hook-up-queryKeyboardModifers.patch b/SOURCES/0028-Hook-up-queryKeyboardModifers.patch new file mode 100644 index 0000000..f8346ff --- /dev/null +++ b/SOURCES/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/SOURCES/0029-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch b/SOURCES/0029-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch new file mode 100644 index 0000000..94eb655 --- /dev/null +++ b/SOURCES/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/SOURCES/0030-Correctly-detect-if-image-format-is-supported-by-QIm.patch b/SOURCES/0030-Correctly-detect-if-image-format-is-supported-by-QIm.patch new file mode 100644 index 0000000..8486dfb --- /dev/null +++ b/SOURCES/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/SOURCES/qtwayland-client-do-not-empty-clipboard-when-new-popup-or-window-is-opened.patch b/SOURCES/qtwayland-client-do-not-empty-clipboard-when-new-popup-or-window-is-opened.patch new file mode 100644 index 0000000..c500746 --- /dev/null +++ b/SOURCES/qtwayland-client-do-not-empty-clipboard-when-new-popup-or-window-is-opened.patch @@ -0,0 +1,58 @@ +From 5ac39d2d76735c5d1d28a16f7fbc8b28e39886dd Mon Sep 17 00:00:00 2001 +From: Jan Grulich +Date: Fri, 16 Jul 2021 13:00:03 +0200 +Subject: [PATCH] Client: do not empty clipboard when a new popup/window is opened + +If we open a new popup or a window within the same app we have to avoid +invalidating selection offer when losing focus, because it's still the +same client who has the focus and we might not get a new selection offer +by the compositor and therefore we would lose clipboard content. + +Fixes: QTBUG-93474 +Pick-to: 6.2 5.15 +Change-Id: Ia2ef826c2967b1daf1cdeb085e8dae66d090dbcf +--- + +diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp +index 2730311..9f595af 100644 +--- a/src/client/qwaylanddisplay.cpp ++++ b/src/client/qwaylanddisplay.cpp +@@ -597,6 +597,19 @@ void QWaylandDisplay::handleWaylandSync() + QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window(); + if (activeWindow != QGuiApplication::focusWindow()) + QWindowSystemInterface::handleWindowActivated(activeWindow); ++ ++ if (!activeWindow) { ++ if (lastInputDevice()) { ++#if QT_CONFIG(clipboard) ++ if (auto *dataDevice = lastInputDevice()->dataDevice()) ++ dataDevice->invalidateSelectionOffer(); ++#endif ++#if QT_CONFIG(wayland_client_primary_selection) ++ if (auto *device = lastInputDevice()->primarySelectionDevice()) ++ device->invalidateSelectionOffer(); ++#endif ++ } ++ } + } + + const wl_callback_listener QWaylandDisplay::syncCallbackListener = { +diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp +index ae045f4..514457e 100644 +--- a/src/client/qwaylandinputdevice.cpp ++++ b/src/client/qwaylandinputdevice.cpp +@@ -1300,14 +1300,6 @@ void QWaylandInputDevice::Keyboard::handleFocusDestroyed() + void QWaylandInputDevice::Keyboard::handleFocusLost() + { + mFocus = nullptr; +-#if QT_CONFIG(clipboard) +- if (auto *dataDevice = mParent->dataDevice()) +- dataDevice->invalidateSelectionOffer(); +-#endif +-#if QT_CONFIG(wayland_client_primary_selection) +- if (auto *device = mParent->primarySelectionDevice()) +- device->invalidateSelectionOffer(); +-#endif + mParent->mQDisplay->handleKeyboardFocusChanged(mParent); + mRepeatTimer.stop(); + } diff --git a/SOURCES/qtwayland-client-use-wl-keyboard-to-determine-active-state.patch b/SOURCES/qtwayland-client-use-wl-keyboard-to-determine-active-state.patch new file mode 100644 index 0000000..9fe3fb3 --- /dev/null +++ b/SOURCES/qtwayland-client-use-wl-keyboard-to-determine-active-state.patch @@ -0,0 +1,299 @@ +From cc54267e93851f067aba51cae015ca8fc3147c11 Mon Sep 17 00:00:00 2001 +From: Méven Car +Date: Wed, 18 Aug 2021 18:28:20 +0200 +Subject: [PATCH] Wayland client: use wl_keyboard to determine active state + +Commit f497a5bb87270174b8e0106b7eca1992d44ff15d made QWaylandDisplay +use the xdgshell's active state for QWindow::isActive(), instead of +using wl_keyboard activate/deactivate events. + +That seems to have been a misunderstanding, since xdgshell activation +is only supposed to be used to determine visual appearance, and there +is an explicit warning not to assume it means focus. + +This commit reverts this logic back to listening to wl_keyboard. +It adds a fallback when there is no wl_keyboard available to handle +activated/deactivated events through xdg-shell, in order to fix +QTBUG-53702. + +windowStates is handled so that we're not using the Xdg hint for +anything with QWindowSystemInterface::handleWindowStateChanged or +anything where we need to track only having one active. + +We are still exposing it for decorations, which is the only reason to +use the Xdghint over keyboard focus - so you can keep the toplevel +active whilst you show a popup. + +Change-Id: I4343d2ed9fb5b066cde95628ed0b4ccc84a424db +--- + +diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp +index e0dfe8b..2730311 100644 +--- a/src/client/qwaylanddisplay.cpp ++++ b/src/client/qwaylanddisplay.cpp +@@ -575,14 +575,10 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic + if (mLastKeyboardFocus == keyboardFocus) + return; + +- if (mWaylandIntegration->mShellIntegration) { +- mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus); +- } else { +- if (keyboardFocus) +- handleWindowActivated(keyboardFocus); +- if (mLastKeyboardFocus) +- handleWindowDeactivated(mLastKeyboardFocus); +- } ++ if (keyboardFocus) ++ handleWindowActivated(keyboardFocus); ++ if (mLastKeyboardFocus) ++ handleWindowDeactivated(mLastKeyboardFocus); + + mLastKeyboardFocus = keyboardFocus; + } +@@ -627,6 +623,13 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const + return mInputDevices.isEmpty() ? 0 : mInputDevices.first(); + } + ++bool QWaylandDisplay::isKeyboardAvailable() const ++{ ++ return std::any_of( ++ mInputDevices.constBegin(), mInputDevices.constEnd(), ++ [this](const QWaylandInputDevice *device) { return device->keyboard() != nullptr; }); ++} ++ + #if QT_CONFIG(cursor) + + QWaylandCursor *QWaylandDisplay::waylandCursor() +diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h +index 3b092bc..09a1736 100644 +--- a/src/client/qwaylanddisplay_p.h ++++ b/src/client/qwaylanddisplay_p.h +@@ -215,6 +215,7 @@ public: + void destroyFrameQueue(const FrameQueue &q); + void dispatchQueueWhile(wl_event_queue *queue, std::function condition, int timeout = -1); + ++ bool isKeyboardAvailable() const; + public slots: + void blockingReadEvents(); + void flushRequests(); +diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp +index e0b91dd..8d56be1 100644 +--- a/src/client/qwaylandwindow.cpp ++++ b/src/client/qwaylandwindow.cpp +@@ -96,7 +96,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) + QWaylandWindow::~QWaylandWindow() + { + mDisplay->destroyFrameQueue(mFrameQueue); +- mDisplay->handleWindowDestroyed(this); + + delete mWindowDecoration; + +@@ -266,6 +265,8 @@ void QWaylandWindow::reset() + + mMask = QRegion(); + mQueuedBuffer = nullptr; ++ ++ mDisplay->handleWindowDestroyed(this); + } + + QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) +@@ -1097,7 +1098,10 @@ Qt::WindowStates QWaylandWindow::windowStates() const + void QWaylandWindow::handleWindowStatesChanged(Qt::WindowStates states) + { + createDecoration(); +- QWindowSystemInterface::handleWindowStateChanged(window(), states, mLastReportedWindowStates); ++ Qt::WindowStates statesWithoutActive = states & ~Qt::WindowActive; ++ Qt::WindowStates lastStatesWithoutActive = mLastReportedWindowStates & ~Qt::WindowActive; ++ QWindowSystemInterface::handleWindowStateChanged(window(), statesWithoutActive, ++ lastStatesWithoutActive); + mLastReportedWindowStates = states; + } + +diff --git a/src/client/shellintegration/qwaylandshellintegration_p.h b/src/client/shellintegration/qwaylandshellintegration_p.h +index ccad004..b308ffe 100644 +--- a/src/client/shellintegration/qwaylandshellintegration_p.h ++++ b/src/client/shellintegration/qwaylandshellintegration_p.h +@@ -73,12 +73,6 @@ public: + return true; + } + virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0; +- virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { +- if (newFocus) +- m_display->handleWindowActivated(newFocus); +- if (oldFocus) +- m_display->handleWindowDeactivated(oldFocus); +- } + virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) { + Q_UNUSED(resource); + Q_UNUSED(window); +diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp +index 4e25949..cfc6093 100644 +--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp ++++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp +@@ -85,13 +85,6 @@ QWaylandShellSurface *QWaylandXdgShellV5Integration::createShellSurface(QWayland + return m_xdgShell->createXdgSurface(window); + } + +-void QWaylandXdgShellV5Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) { +- if (newFocus && qobject_cast(newFocus->shellSurface())) +- m_display->handleWindowActivated(newFocus); +- if (oldFocus && qobject_cast(oldFocus->shellSurface())) +- m_display->handleWindowDeactivated(oldFocus); +-} +- + } + + QT_END_NAMESPACE +diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h +index ce6bdb9..aed8867 100644 +--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h ++++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h +@@ -67,7 +67,6 @@ public: + QWaylandXdgShellV5Integration() {} + bool initialize(QWaylandDisplay *display) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; +- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; + + private: + QScopedPointer m_xdgShell; +diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp +index 0316431..e8da8ba 100644 +--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp ++++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp +@@ -68,20 +68,6 @@ QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWayland + return m_xdgShell->getXdgSurface(window); + } + +-void QWaylandXdgShellV6Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) +-{ +- if (newFocus) { +- auto *xdgSurface = qobject_cast(newFocus->shellSurface()); +- if (xdgSurface && !xdgSurface->handlesActiveState()) +- m_display->handleWindowActivated(newFocus); +- } +- if (oldFocus && qobject_cast(oldFocus->shellSurface())) { +- auto *xdgSurface = qobject_cast(oldFocus->shellSurface()); +- if (xdgSurface && !xdgSurface->handlesActiveState()) +- m_display->handleWindowDeactivated(oldFocus); +- } +-} +- + } + + QT_END_NAMESPACE +diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h +index 261f8cb..c1bcd5c 100644 +--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h ++++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h +@@ -65,7 +65,6 @@ public: + QWaylandXdgShellV6Integration() {} + bool initialize(QWaylandDisplay *display) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; +- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; + + private: + QScopedPointer m_xdgShell; +diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +index cf7eb4e..2c6e84b 100644 +--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp ++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +@@ -67,11 +67,6 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface) + + QWaylandXdgSurface::Toplevel::~Toplevel() + { +- if (m_applied.states & Qt::WindowActive) { +- QWaylandWindow *window = m_xdgSurface->window(); +- window->display()->handleWindowDeactivated(window); +- } +- + // The protocol spec requires that the decoration object is deleted before xdg_toplevel. + delete m_decoration; + m_decoration = nullptr; +@@ -85,17 +80,16 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() + if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) + m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size(); + +- if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) ++ if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive) ++ && !m_xdgSurface->m_window->display()->isKeyboardAvailable()) + m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); + +- if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive)) ++ if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive) ++ && !m_xdgSurface->m_window->display()->isKeyboardAvailable()) + m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window); + +- // TODO: none of the other plugins send WindowActive either, but is it on purpose? +- Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive; +- + m_xdgSurface->m_window->handleToplevelWindowTilingStatesChanged(m_toplevelStates); +- m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive); ++ m_xdgSurface->m_window->handleWindowStatesChanged(m_pending.states); + + if (m_pending.size.isEmpty()) { + // An empty size in the configure means it's up to the client to choose the size +diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +index 8769d97..da0dd6a 100644 +--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp ++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp +@@ -69,20 +69,6 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi + return m_xdgShell->getXdgSurface(window); + } + +-void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) +-{ +- if (newFocus) { +- auto *xdgSurface = qobject_cast(newFocus->shellSurface()); +- if (xdgSurface && !xdgSurface->handlesActiveState()) +- m_display->handleWindowActivated(newFocus); +- } +- if (oldFocus && qobject_cast(oldFocus->shellSurface())) { +- auto *xdgSurface = qobject_cast(oldFocus->shellSurface()); +- if (xdgSurface && !xdgSurface->handlesActiveState()) +- m_display->handleWindowDeactivated(oldFocus); +- } +-} +- + } + + QT_END_NAMESPACE +diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +index b6caa6c..2f929f9 100644 +--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h ++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h +@@ -65,7 +65,6 @@ public: + QWaylandXdgShellIntegration() {} + bool initialize(QWaylandDisplay *display) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; +- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; + + private: + QScopedPointer m_xdgShell; +diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp +index 2fdd0a7..5346b6e 100644 +--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp ++++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + using namespace MockCompositor; + +@@ -154,9 +155,12 @@ void tst_xdgshell::configureStates() + // Toplevel windows don't know their position on xdg-shell + // QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled + +-// QEXPECT_FAIL("", "configure has already been acked, we shouldn't have to wait for isActive", Continue); +-// QVERIFY(window.isActive()); +- QTRY_VERIFY(window.isActive()); // Just make sure it eventually get's set correctly ++ // window.windowstate() is driven by keyboard focus, however for decorations we want to follow ++ // XDGShell this is internal to QtWayland so it is queried directly ++ auto waylandWindow = static_cast(window.handle()); ++ Q_ASSERT(waylandWindow); ++ QTRY_VERIFY(waylandWindow->windowStates().testFlag( ++ Qt::WindowActive)); // Just make sure it eventually get's set correctly + + const QSize screenSize(640, 480); + const uint maximizedSerial = exec([=] { diff --git a/SOURCES/qtwayland-fix-issue-with-repeated-window-size-changes.patch b/SOURCES/qtwayland-fix-issue-with-repeated-window-size-changes.patch deleted file mode 100644 index 7e6dee7..0000000 --- a/SOURCES/qtwayland-fix-issue-with-repeated-window-size-changes.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 14d066c61025e548227ccd8d655e80ffa31fa15e 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 - -Check if the new window size is different from the size requested -previously before calling wl_egl_window_resize. It addresses the issue -where repeated setGeometry calls between two sizes might not work as -expected. The problem occurs when wl_egl_window_get_attached_size does -not get the same size that was requested by the previous setGeometry -call. If the returned size happened to match the new size instead, -we would mistakenly skip the resize. - -Change-Id: Iafe4a91cc707f854b9099b6109b6be1423d7bd29 -Reviewed-by: Eskil Abrahamsen Blomfeldt ---- - .../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 ---- 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) - if (!disableResizeCheck) { - wl_egl_window_get_attached_size(m_waylandEglWindow, ¤t_width, ¤t_height); - } -- if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height())) { -+ if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height()) || m_requestedSize != sizeWithMargins) { - wl_egl_window_resize(m_waylandEglWindow, sizeWithMargins.width(), sizeWithMargins.height(), mOffset.x(), mOffset.y()); -+ m_requestedSize = sizeWithMargins; - mOffset = QPoint(); - - m_resize = true; - } - } else if (create && wlSurface()) { - m_waylandEglWindow = wl_egl_window_create(wlSurface(), sizeWithMargins.width(), sizeWithMargins.height()); -+ m_requestedSize = sizeWithMargins; - } - - 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 ---- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h -+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h -@@ -88,6 +88,7 @@ class QWaylandEglWindow : public QWaylandWindow - mutable QOpenGLFramebufferObject *m_contentFBO = nullptr; - - QSurfaceFormat m_format; -+ QSize m_requestedSize; - }; - - } diff --git a/SPECS/qt5-qtwayland.spec b/SPECS/qt5-qtwayland.spec index 8c40c52..d3a88cb 100644 --- a/SPECS/qt5-qtwayland.spec +++ b/SPECS/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: 12%{?dist} License: LGPLv3 Url: http://www.qt.io @@ -36,11 +36,24 @@ 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 +# Qt6 patches +Patch60: qtwayland-client-use-wl-keyboard-to-determine-active-state.patch +Patch61: qtwayland-client-do-not-empty-clipboard-when-new-popup-or-window-is-opened.patch # filter qml provides %global __provides_exclude_from ^%{_qt5_archdatadir}/qml/.*\\.so$ @@ -66,7 +79,6 @@ BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(libinput) BuildRequires: libXext-devel -BuildRequires: tree %description %{summary}. @@ -167,6 +179,18 @@ popd %endif %changelog +* Thu Oct 14 2021 Jan Grulich - 5.15.2-12 +- Drop BR: tree + Resolves: bz#2014080 + +* Wed Oct 13 2021 Jan Grulich - 5.15.2-11 +- Sync with Fedora + Resolves: bz#2012714 + +* 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