1 |
commit: ab025d7059241a0f9d775a518534b78fd6308734 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 28 23:45:06 2023 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 29 00:12:13 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab025d70 |
7 |
|
8 |
kde-frameworks/kguiaddons: Fix clipboard in Wayland session |
9 |
|
10 |
Upstream commit dcb254dc6b4e5b76e04a5ee8b4db8177aff10d29 |
11 |
|
12 |
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=463199 |
13 |
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=461903 |
14 |
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=463323 |
15 |
|
16 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
17 |
|
18 |
.../kguiaddons-5.102.0-fix-waylandclipboard.patch | 47 ++++++++++++++++++++++ |
19 |
.../kguiaddons/kguiaddons-5.102.0-r1.ebuild | 47 ++++++++++++++++++++++ |
20 |
2 files changed, 94 insertions(+) |
21 |
|
22 |
diff --git a/kde-frameworks/kguiaddons/files/kguiaddons-5.102.0-fix-waylandclipboard.patch b/kde-frameworks/kguiaddons/files/kguiaddons-5.102.0-fix-waylandclipboard.patch |
23 |
new file mode 100644 |
24 |
index 000000000000..e8b157abebec |
25 |
--- /dev/null |
26 |
+++ b/kde-frameworks/kguiaddons/files/kguiaddons-5.102.0-fix-waylandclipboard.patch |
27 |
@@ -0,0 +1,47 @@ |
28 |
+From dcb254dc6b4e5b76e04a5ee8b4db8177aff10d29 Mon Sep 17 00:00:00 2001 |
29 |
+From: David Redondo <kde@×××××××××××××.de> |
30 |
+Date: Fri, 27 Jan 2023 13:17:43 +0100 |
31 |
+Subject: [PATCH] waylandclipboard: roundtrip to get accurate focus state |
32 |
+ |
33 |
+The current approach is too complicated and not correct anyway. |
34 |
+To summarize QGuiApplication::focusWindow is delayed so the focus |
35 |
+watcher was introduced, however when the window is hidden and |
36 |
+setMimeData called before Wayland events have been processed, |
37 |
+then focusWatcher is naturally out of sync, so the check |
38 |
+was complicated to work around this state. However the same |
39 |
+issue arises when the window is deleted before calling |
40 |
+setMimeData. |
41 |
+Instead of introducing more complicated checks and workaround |
42 |
+roundtrip so the focusWatcher state is up to date before setting |
43 |
+the clipboard. |
44 |
+BUG:463199 |
45 |
+FIXED-IN: 5.103 |
46 |
+--- |
47 |
+ src/systemclipboard/waylandclipboard.cpp | 11 ++++++++--- |
48 |
+ 1 file changed, 8 insertions(+), 3 deletions(-) |
49 |
+ |
50 |
+diff --git a/src/systemclipboard/waylandclipboard.cpp b/src/systemclipboard/waylandclipboard.cpp |
51 |
+index 4c68904..d6c4c08 100644 |
52 |
+--- a/src/systemclipboard/waylandclipboard.cpp |
53 |
++++ b/src/systemclipboard/waylandclipboard.cpp |
54 |
+@@ -591,9 +591,14 @@ void WaylandClipboard::setMimeData(QMimeData *mime, QClipboard::Mode mode) |
55 |
+ if (!m_device) { |
56 |
+ return; |
57 |
+ } |
58 |
+- // If the application is focused, use the normal mechanism so a future paste will not deadlock itself |
59 |
+- // On enter Qt delays processing of the enter event but when a window is hidden the leave event arrives after hiding the window |
60 |
+- if (const auto fw = QGuiApplication::focusWindow(); (fw && fw->isVisible()) || (!fw && m_keyboardFocusWatcher->hasFocus())) { |
61 |
++ |
62 |
++ // roundtrip to have accurate focus state when losing focus but setting mime data before processing wayland events. |
63 |
++ auto native = qGuiApp->platformNativeInterface(); |
64 |
++ auto display = static_cast<struct ::wl_display *>(native->nativeResourceForIntegration("wl_display")); |
65 |
++ wl_display_roundtrip(display); |
66 |
++ |
67 |
++ // If the application is focused, use the normal mechanism so a future paste will not deadlock itselfs |
68 |
++ if (m_keyboardFocusWatcher->hasFocus()) { |
69 |
+ QGuiApplication::clipboard()->setMimeData(mime, mode); |
70 |
+ return; |
71 |
+ } |
72 |
+-- |
73 |
+GitLab |
74 |
+ |
75 |
|
76 |
diff --git a/kde-frameworks/kguiaddons/kguiaddons-5.102.0-r1.ebuild b/kde-frameworks/kguiaddons/kguiaddons-5.102.0-r1.ebuild |
77 |
new file mode 100644 |
78 |
index 000000000000..5d03529205c3 |
79 |
--- /dev/null |
80 |
+++ b/kde-frameworks/kguiaddons/kguiaddons-5.102.0-r1.ebuild |
81 |
@@ -0,0 +1,47 @@ |
82 |
+# Copyright 1999-2023 Gentoo Authors |
83 |
+# Distributed under the terms of the GNU General Public License v2 |
84 |
+ |
85 |
+EAPI=8 |
86 |
+ |
87 |
+ECM_NONGUI="false" |
88 |
+QTMIN=5.15.5 |
89 |
+VIRTUALX_REQUIRED="test" |
90 |
+inherit ecm frameworks.kde.org |
91 |
+ |
92 |
+DESCRIPTION="Framework providing assorted high-level user interface components" |
93 |
+ |
94 |
+LICENSE="LGPL-2+" |
95 |
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" |
96 |
+IUSE="dbus wayland X" |
97 |
+ |
98 |
+# slot op: includes qpa/qplatformnativeinterface.h |
99 |
+RDEPEND=" |
100 |
+ >=dev-qt/qtgui-${QTMIN}:5 |
101 |
+ dbus? ( >=dev-qt/qtdbus-${QTMIN}:5 ) |
102 |
+ wayland? ( |
103 |
+ dev-libs/wayland |
104 |
+ >=dev-qt/qtgui-${QTMIN}:5=[wayland] |
105 |
+ >=dev-qt/qtwayland-${QTMIN}:5 |
106 |
+ ) |
107 |
+ X? ( |
108 |
+ >=dev-qt/qtx11extras-${QTMIN}:5 |
109 |
+ x11-libs/libX11 |
110 |
+ ) |
111 |
+" |
112 |
+DEPEND="${RDEPEND} |
113 |
+ x11-base/xorg-proto |
114 |
+ wayland? ( >=dev-libs/plasma-wayland-protocols-1.7.0 ) |
115 |
+ X? ( x11-libs/libxcb ) |
116 |
+" |
117 |
+BDEPEND="wayland? ( >=dev-qt/qtwaylandscanner-${QTMIN}:5 )" |
118 |
+ |
119 |
+PATCHES=( "${FILESDIR}/${P}-fix-waylandclipboard.patch" ) # KDE-bug 463199 |
120 |
+ |
121 |
+src_configure() { |
122 |
+ local mycmakeargs=( |
123 |
+ -DWITH_DBUS=$(usex dbus) |
124 |
+ -DWITH_WAYLAND=$(usex wayland) |
125 |
+ -DWITH_X11=$(usex X) |
126 |
+ ) |
127 |
+ ecm_src_configure |
128 |
+} |