summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2024-07-12 00:30:03 -0400
committerIonen Wolkens <ionen@gentoo.org>2024-07-12 00:30:03 -0400
commit7bf9c926594fa620acf118a873672d61dd98b252 (patch)
tree333d0bf4134bcdf0def64196ce08ad239a4c9e43 /dev-qt/qtwayland
parentdev-python/cryptography: Readd 32-bit fix to 42.0.8 (diff)
downloadgentoo-7bf9c926594fa620acf118a873672d61dd98b252.tar.gz
gentoo-7bf9c926594fa620acf118a873672d61dd98b252.tar.bz2
gentoo-7bf9c926594fa620acf118a873672d61dd98b252.zip
dev-qt/qtwayland: backport more fixes to help plasma
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'dev-qt/qtwayland')
-rw-r--r--dev-qt/qtwayland/files/qtwayland-6.7.2-drag-drop.patch67
-rw-r--r--dev-qt/qtwayland/files/qtwayland-6.7.2-thread-safety.patch65
-rw-r--r--dev-qt/qtwayland/qtwayland-6.7.2-r2.ebuild67
3 files changed, 199 insertions, 0 deletions
diff --git a/dev-qt/qtwayland/files/qtwayland-6.7.2-drag-drop.patch b/dev-qt/qtwayland/files/qtwayland-6.7.2-drag-drop.patch
new file mode 100644
index 000000000000..6141d95cb834
--- /dev/null
+++ b/dev-qt/qtwayland/files/qtwayland-6.7.2-drag-drop.patch
@@ -0,0 +1,67 @@
+Backport from upcoming 6.7.3[1][2] for [3][4].
+
+[1] https://github.com/qt/qtwayland/commit/85ec3ae70b905ddf9e16d86c468446d74867743f
+[2] https://codereview.qt-project.org/c/qt/qtwayland/+/565408
+[3] https://bugs.kde.org/show_bug.cgi?id=482770
+[4] https://bugs.kde.org/show_bug.cgi?id=490059
+
+From: =?UTF-8?q?Niccol=C3=B2=20Venerandi?= <niccolo@venerandi.com>
+Date: Mon, 3 Jun 2024 12:19:59 +0200
+Subject: [PATCH] Emit a LeaveEvent on drag and drop start
+
+All focused windows will now receive a LeaveEvent when a drag and drop starts.
+This makes sure that the dragged element does not preserve any hover decoration
+during the drag and drop, and that other elements that happen to take place
+of the dragged elements don't become hovered too.
+--- a/src/client/qwaylanddnd.cpp
++++ b/src/client/qwaylanddnd.cpp
+@@ -29,4 +29,9 @@
+ void QWaylandDrag::startDrag()
+ {
++ // Some compositors do not send a pointer leave before starting a drag, some do.
++ // This is discussed upstream at: https://gitlab.freedesktop.org/wayland/wayland/-/issues/444
++ // For consistency between compositors we emit the leave event here, upon drag start.
++ m_display->currentInputDevice()->handleStartDrag();
++
+ QBasicDrag::startDrag();
+ QWaylandWindow *icon = static_cast<QWaylandWindow *>(shapedPixmapWindow()->handle());
+--- a/src/client/qwaylandinputdevice.cpp
++++ b/src/client/qwaylandinputdevice.cpp
+@@ -524,4 +524,10 @@
+ }
+
++void QWaylandInputDevice::handleStartDrag()
++{
++ if (mPointer)
++ mPointer->leavePointers();
++}
++
+ #if QT_CONFIG(wayland_datadevice)
+ void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device)
+@@ -880,4 +886,12 @@
+ window->handleMouse(mParent, e);
+ }
++}
++
++void QWaylandInputDevice::Pointer::leavePointers()
++{
++ if (auto *window = focusWindow()) {
++ LeaveEvent e(focusWindow(), mSurfacePos, mGlobalPos);
++ window->handleMouse(mParent, e);
++ }
+ }
+
+--- a/src/client/qwaylandinputdevice_p.h
++++ b/src/client/qwaylandinputdevice_p.h
+@@ -93,4 +93,5 @@
+ void setCursor(const QCursor *cursor, const QSharedPointer<QWaylandBuffer> &cachedBuffer = {}, int fallbackOutputScale = 1);
+ #endif
++ void handleStartDrag();
+ void handleEndDrag();
+
+@@ -321,4 +322,5 @@
+ public:
+ void releaseButtons();
++ void leavePointers();
+
+ QWaylandInputDevice *mParent = nullptr;
diff --git a/dev-qt/qtwayland/files/qtwayland-6.7.2-thread-safety.patch b/dev-qt/qtwayland/files/qtwayland-6.7.2-thread-safety.patch
new file mode 100644
index 000000000000..92be3b81d5b0
--- /dev/null
+++ b/dev-qt/qtwayland/files/qtwayland-6.7.2-thread-safety.patch
@@ -0,0 +1,65 @@
+Backport from 6.8 branch which should later land in 6.7.3 in [1] for [2].
+
+[1] https://codereview.qt-project.org/c/qt/qtwayland/+/574983
+[2] https://bugs.kde.org/show_bug.cgi?id=489180
+
+From: David Edmundson <davidedmundson@kde.org>
+Date: Fri, 05 Jul 2024 16:13:40 +0100
+Subject: [PATCH] Client: Improve thread safety determining window size on the render thread
+
+updateSurface is called from both the render and GUI thread. We
+therefore need every property referenced to be thread safe.
+
+Rather than guarding each property we cache the buffer size whenever the
+window geometry or scale changes and put a mutex round this one
+variable.
+--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
++++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+@@ -51,4 +51,13 @@
+ void QWaylandEglWindow::ensureSize()
+ {
++ // this is always called on the main thread
++ QMargins margins = mWindowDecoration ? frameMargins() : QMargins{};
++ QRect rect = geometry();
++ QSize sizeWithMargins = (rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale();
++ {
++ QWriteLocker lock(&m_bufferSizeLock);
++ m_bufferSize = sizeWithMargins;
++ }
++
+ updateSurface(false);
+ }
+@@ -61,12 +70,15 @@
+ // Just resize the wl_egl_window, the EGLSurface will be created
+ // the next time makeCurrent is called.
+- updateSurface(false);
++ ensureSize();
+ }
+
+ void QWaylandEglWindow::updateSurface(bool create)
+ {
+- QMargins margins = mWindowDecoration ? frameMargins() : QMargins{};
+- QRect rect = geometry();
+- QSize sizeWithMargins = (rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale();
++
++ QSize sizeWithMargins;
++ {
++ QReadLocker lock(&m_bufferSizeLock);
++ sizeWithMargins = m_bufferSize;
++ }
+
+ // wl_egl_windows must have both width and height > 0
+--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
++++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
+@@ -61,5 +61,11 @@
+
+ QSurfaceFormat m_format;
++ // Size used in the last call to wl_egl_window_resize
+ QSize m_requestedSize;
++
++ // Size of the buffer used by QWaylandWindow
++ // This is always written to from the main thread, potentially read from the rendering thread
++ QReadWriteLock m_bufferSizeLock;
++ QSize m_bufferSize;
+ };
+
diff --git a/dev-qt/qtwayland/qtwayland-6.7.2-r2.ebuild b/dev-qt/qtwayland/qtwayland-6.7.2-r2.ebuild
new file mode 100644
index 000000000000..eab3c3a8d3a5
--- /dev/null
+++ b/dev-qt/qtwayland/qtwayland-6.7.2-r2.ebuild
@@ -0,0 +1,67 @@
+# Copyright 2021-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit qt6-build
+
+DESCRIPTION="Wayland platform plugin for Qt"
+
+if [[ ${QT6_BUILD_TYPE} == release ]]; then
+ KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
+fi
+
+IUSE="accessibility compositor qml vulkan"
+
+RDEPEND="
+ dev-libs/wayland
+ ~dev-qt/qtbase-${PV}:6[accessibility=,gui,opengl,vulkan=,wayland]
+ media-libs/libglvnd
+ x11-libs/libxkbcommon
+ compositor? (
+ qml? ( ~dev-qt/qtdeclarative-${PV}:6 )
+ )
+"
+DEPEND="
+ ${RDEPEND}
+ vulkan? ( dev-util/vulkan-headers )
+"
+BDEPEND="dev-util/wayland-scanner"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-plasma-popup.patch
+ "${FILESDIR}"/${P}-drag-drop.patch
+ "${FILESDIR}"/${P}-thread-safety.patch
+)
+
+CMAKE_SKIP_TESTS=(
+ # segfaults for not-looked-into reasons, but not considered
+ # an issue given >=seatv5 exists since wayland-1.10 (2016)
+ tst_seatv4
+ # needs a compositor/opengl, skip the extra trouble
+ tst_surface
+ tst_xdgdecorationv1
+ # known failing with wayland-1.23.0 (or at least with offscreen), not
+ # believed to result in critical runtime issues so skip until this is
+ # looked at upstream (https://bugreports.qt.io/browse/QTBUG-126379)
+ tst_client
+ tst_compositor
+ tst_scaling
+)
+
+src_configure() {
+ local mycmakeargs=(
+ $(cmake_use_find_package qml Qt6Quick)
+ $(qt_feature compositor wayland_server)
+ )
+
+ qt6-build_src_configure
+}
+
+src_test() {
+ # users' session setting may break tst_clientextension (bug #927030)
+ unset DESKTOP_SESSION XDG_CURRENT_DESKTOP
+ unset GNOME_DESKTOP_SESSION_ID KDE_FULL_SESSION
+
+ qt6-build_src_test
+}