Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-plasma/kscreenlocker/, kde-plasma/kscreenlocker/files/
Date: Wed, 29 Mar 2017 12:12:43
Message-Id: 1490789476.744572dc1a7741091e971105723adc4422278a54.asturm@gentoo
1 commit: 744572dc1a7741091e971105723adc4422278a54
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 29 12:10:45 2017 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 29 12:11:16 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=744572dc
7
8 kde-plasma/kscreenlocker: Multiscreen: Fix manual focus on click
9
10 Reported-by: Dmitry <dmitry.ghost99 <AT> gmail.com>
11 Gentoo-bug: 613552
12
13 Package-Manager: Portage-2.3.3, Repoman-2.3.1
14
15 .../files/kscreenlocker-5.8.6-focus.patch | 145 +++++++++++++++++++++
16 .../kscreenlocker/kscreenlocker-5.8.6-r1.ebuild | 89 +++++++++++++
17 2 files changed, 234 insertions(+)
18
19 diff --git a/kde-plasma/kscreenlocker/files/kscreenlocker-5.8.6-focus.patch b/kde-plasma/kscreenlocker/files/kscreenlocker-5.8.6-focus.patch
20 new file mode 100644
21 index 00000000000..a44c36862c5
22 --- /dev/null
23 +++ b/kde-plasma/kscreenlocker/files/kscreenlocker-5.8.6-focus.patch
24 @@ -0,0 +1,145 @@
25 +From f8043de10b5dd94b9b931a92f3aa7167188786c9 Mon Sep 17 00:00:00 2001
26 +From: Fabian Vogt <fabian@×××××××××××.de>
27 +Date: Mon, 27 Feb 2017 16:29:29 +0100
28 +Subject: Implement manual focus on click
29 +
30 +Summary:
31 +Currently only the first created screenlock window gets focus.
32 +On clicks, no focus events are sent, which makes it impossible to input
33 +passwords. This patch now makes it possible to focus to a different
34 +screenlock window (on a different monitor, for example) using a mouse
35 +button press.
36 +This should also fix newly created screenlock windows stealing the focus
37 +of already displayed ones as only the first window gains automatic focus.
38 +
39 +BUG: 348789
40 +BUG: 374289
41 +
42 +Test Plan:
43 +Locked the screen, now I can use the password input on the secondary screen
44 +as well.
45 +
46 +Reviewers: #plasma, graesslin, broulik
47 +
48 +Reviewed By: #plasma, graesslin
49 +
50 +Subscribers: hein, plasma-devel
51 +
52 +Tags: #plasma
53 +
54 +Differential Revision: https://phabricator.kde.org/D4821
55 +---
56 + greeter/greeterapp.cpp | 1 -
57 + x11locker.cpp | 26 ++++++++++++++++++++++++--
58 + x11locker.h | 2 ++
59 + 3 files changed, 26 insertions(+), 3 deletions(-)
60 +
61 +diff --git a/greeter/greeterapp.cpp b/greeter/greeterapp.cpp
62 +index 47fcb03..bcfcbdf 100644
63 +--- a/greeter/greeterapp.cpp
64 ++++ b/greeter/greeterapp.cpp
65 +@@ -372,7 +372,6 @@ void UnlockApp::getFocus()
66 + // this loop is required to make the qml/graphicsscene properly handle the shared keyboard input
67 + // ie. "type something into the box of every greeter"
68 + foreach (KQuickAddons::QuickViewSharedEngine *view, m_views) {
69 +- view->requestActivate();
70 + if (!m_testing) {
71 + view->setKeyboardGrabEnabled(true); // TODO - check whether this still works in master!
72 + }
73 +diff --git a/x11locker.cpp b/x11locker.cpp
74 +index b2d2ea4..6967a67 100644
75 +--- a/x11locker.cpp
76 ++++ b/x11locker.cpp
77 +@@ -51,6 +51,7 @@ namespace ScreenLocker
78 + X11Locker::X11Locker(QObject *parent)
79 + : AbstractLocker(parent)
80 + , QAbstractNativeEventFilter()
81 ++ , m_focusedLockWindow(XCB_WINDOW_NONE)
82 + {
83 + initialize();
84 + }
85 +@@ -229,8 +230,12 @@ void X11Locker::removeVRoot(Window win)
86 + XDeleteProperty (QX11Info::display(), win, gXA_VROOT);
87 + }
88 +
89 +-static void fakeFocusIn( WId window )
90 ++void X11Locker::fakeFocusIn( WId window )
91 + {
92 ++ if (window == m_focusedLockWindow) {
93 ++ return;
94 ++ }
95 ++
96 + // We have keyboard grab, so this application will
97 + // get keyboard events even without having focus.
98 + // Fake FocusIn to make Qt realize it has the active
99 +@@ -244,6 +249,8 @@ static void fakeFocusIn( WId window )
100 + ev.xfocus.detail = NotifyAncestor;
101 + XSendEvent( QX11Info::display(), window, False, NoEventMask, &ev );
102 + XFlush(QX11Info::display());
103 ++
104 ++ m_focusedLockWindow = window;
105 + }
106 +
107 + template< typename T>
108 +@@ -308,6 +315,11 @@ bool X11Locker::nativeEventFilter(const QByteArray &eventType, void *message, lo
109 + (x>=x_return && x<=x_return+(int)width_return)
110 + &&
111 + (y>=y_return && y<=y_return+(int)height_return) ) {
112 ++ // We need to do our own focus handling (see comment in fakeFocusIn).
113 ++ // For now: Focus on clicks inside the window
114 ++ if (responseType == XCB_BUTTON_PRESS) {
115 ++ fakeFocusIn(window);
116 ++ }
117 + const int targetX = x - x_return;
118 + const int targetY = y - y_return;
119 + if (responseType == XCB_KEY_PRESS || responseType == XCB_KEY_RELEASE) {
120 +@@ -386,6 +398,10 @@ bool X11Locker::nativeEventFilter(const QByteArray &eventType, void *message, lo
121 + else
122 + qDebug() << "Unknown toplevel for MapNotify";
123 + m_lockWindows.removeAll(xu->event);
124 ++ if (m_focusedLockWindow == xu->event && !m_lockWindows.empty()) {
125 ++ // The currently focused window vanished, just focus the first one in the list
126 ++ fakeFocusIn(m_lockWindows[0]);
127 ++ }
128 + ret = true;
129 + }
130 + break;
131 +@@ -508,8 +524,14 @@ void X11Locker::addAllowedWindow(quint32 window)
132 + // not yet shown and we have a lock window, so we show our own window
133 + m_background->show();
134 + }
135 ++
136 ++ if (m_lockWindows.empty()) {
137 ++ // Make sure to focus the first window
138 ++ m_focusedLockWindow = XCB_WINDOW_NONE;
139 ++ fakeFocusIn(window);
140 ++ }
141 ++
142 + m_lockWindows.prepend(window);
143 +- fakeFocusIn(window);
144 + stayOnTop();
145 + }
146 + }
147 +diff --git a/x11locker.h b/x11locker.h
148 +index 9a14699..d8e83d6 100644
149 +--- a/x11locker.h
150 ++++ b/x11locker.h
151 +@@ -60,6 +60,7 @@ private:
152 + void setVRoot(Window win, Window vr);
153 + void removeVRoot(Window win);
154 + int findWindowInfo(Window w);
155 ++ void fakeFocusIn(WId window);
156 + void stayOnTop() override;
157 + struct WindowInfo
158 + {
159 +@@ -69,6 +70,7 @@ private:
160 + QList<WindowInfo> m_windowInfo;
161 + QList<WId> m_lockWindows;
162 + QList<quint32> m_allowedWindows;
163 ++ WId m_focusedLockWindow;
164 + };
165 + }
166 +
167 +--
168 +cgit v0.11.2
169 +
170
171 diff --git a/kde-plasma/kscreenlocker/kscreenlocker-5.8.6-r1.ebuild b/kde-plasma/kscreenlocker/kscreenlocker-5.8.6-r1.ebuild
172 new file mode 100644
173 index 00000000000..bc5ef666852
174 --- /dev/null
175 +++ b/kde-plasma/kscreenlocker/kscreenlocker-5.8.6-r1.ebuild
176 @@ -0,0 +1,89 @@
177 +# Copyright 1999-2017 Gentoo Foundation
178 +# Distributed under the terms of the GNU General Public License v2
179 +
180 +EAPI=6
181 +
182 +KDE_TEST="forceoptional"
183 +VIRTUALX_REQUIRED="test"
184 +inherit kde5 pam
185 +
186 +DESCRIPTION="Library and components for secure lock screen architecture"
187 +KEYWORDS="~amd64 ~arm ~x86"
188 +IUSE="pam"
189 +
190 +COMMON_DEPEND="
191 + $(add_frameworks_dep kcmutils)
192 + $(add_frameworks_dep kconfig)
193 + $(add_frameworks_dep kconfigwidgets)
194 + $(add_frameworks_dep kcoreaddons)
195 + $(add_frameworks_dep kcrash)
196 + $(add_frameworks_dep kdeclarative)
197 + $(add_frameworks_dep kglobalaccel)
198 + $(add_frameworks_dep ki18n)
199 + $(add_frameworks_dep kidletime)
200 + $(add_frameworks_dep knotifications)
201 + $(add_frameworks_dep kpackage)
202 + $(add_frameworks_dep ktextwidgets)
203 + $(add_frameworks_dep kwayland)
204 + $(add_frameworks_dep kwindowsystem)
205 + $(add_frameworks_dep kxmlgui)
206 + $(add_frameworks_dep solid)
207 + $(add_qt_dep qtdbus)
208 + $(add_qt_dep qtdeclarative 'widgets')
209 + $(add_qt_dep qtgui)
210 + $(add_qt_dep qtnetwork)
211 + $(add_qt_dep qtwidgets)
212 + $(add_qt_dep qtx11extras)
213 + dev-libs/wayland
214 + x11-libs/libX11
215 + x11-libs/libXi
216 + x11-libs/libxcb
217 + x11-libs/xcb-util-keysyms
218 + pam? ( virtual/pam )
219 +"
220 +DEPEND="${COMMON_DEPEND}
221 + x11-proto/xproto
222 +"
223 +RDEPEND="${COMMON_DEPEND}
224 + $(add_plasma_dep kde-cli-tools)
225 + !<kde-plasma/kcheckpass-4.11.22-r1:4
226 + !kde-plasma/kdebase-pam:0
227 +"
228 +
229 +RESTRICT+=" test"
230 +
231 +PATCHES=( "${FILESDIR}/${P}-focus.patch" )
232 +
233 +src_prepare() {
234 + kde5_src_prepare
235 +
236 + use test || sed -i \
237 + -e "/add_subdirectory(autotests)/ s/^/#/" greeter/CMakeLists.txt || die
238 +}
239 +
240 +src_test() {
241 + # requires running environment
242 + local myctestargs=(
243 + -E x11LockerTest
244 + )
245 + kde5_src_test
246 +}
247 +
248 +src_configure() {
249 + local mycmakeargs=(
250 + $(cmake-utils_use_find_package pam PAM)
251 + )
252 + kde5_src_configure
253 +}
254 +
255 +src_install() {
256 + kde5_src_install
257 +
258 + newpamd "${FILESDIR}/kde.pam" kde
259 + newpamd "${FILESDIR}/kde-np.pam" kde-np
260 +
261 + if ! use pam; then
262 + chown root "${ED}"usr/$(get_libdir)/libexec/kcheckpass || die
263 + chmod +s "${ED}"usr/$(get_libdir)/libexec/kcheckpass || die
264 + fi
265 +}