Gentoo Archives: gentoo-commits

From: David Heidelberger <d.okias@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/kde:master commit in: kde-base/ksmserver/files/, kde-base/ksmserver/
Date: Mon, 02 Dec 2013 18:50:29
Message-Id: 1386009867.eaa6f9664ca0a52d635978b96123f917f18a832c.okias@gentoo
1 commit: eaa6f9664ca0a52d635978b96123f917f18a832c
2 Author: David Heidelberger <david.heidelberger <AT> ixit <DOT> cz>
3 AuthorDate: Mon Dec 2 18:44:27 2013 +0000
4 Commit: David Heidelberger <d.okias <AT> gmail <DOT> com>
5 CommitDate: Mon Dec 2 18:44:27 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kde.git;a=commit;h=eaa6f966
7
8 kde-base/ksmserver: 4.11.3-r1, get qmllockscreen work on multi screen setup (picked from 4.11.4)
9
10 ---
11 .../files/ksmserver-4.11.3-fixmultimonitor.patch | 210 +++++++++++++++++++++
12 kde-base/ksmserver/ksmserver-4.11.3-r1.ebuild | 39 ++++
13 2 files changed, 249 insertions(+)
14
15 diff --git a/kde-base/ksmserver/files/ksmserver-4.11.3-fixmultimonitor.patch b/kde-base/ksmserver/files/ksmserver-4.11.3-fixmultimonitor.patch
16 new file mode 100644
17 index 0000000..061868a
18 --- /dev/null
19 +++ b/kde-base/ksmserver/files/ksmserver-4.11.3-fixmultimonitor.patch
20 @@ -0,0 +1,210 @@
21 +From 3a4a7ac959c17ffd08b104bc4c5d550b5f1dfcb6 Mon Sep 17 00:00:00 2001
22 +From: =?UTF-8?q?Thomas=20L=C3=BCbking?= <thomas.luebking@×××××.com>
23 +Date: Sat, 26 Jan 2013 22:27:48 +0100
24 +Subject: [PATCH] improve screenlocker multiscreen behavior
25 +
26 +- pass focus to greeter under the mouse
27 +- share keyboard events
28 +- let through keyboard events for one hidden locker
29 + (mouse wakeup case)
30 +- remove double filtering
31 +
32 +BUG: 311188
33 +FIXED-IN: 4.11.4
34 +REVIEW: 113971
35 +---
36 + ksmserver/screenlocker/greeter/greeterapp.cpp | 92 +++++++++++++++++++++++++--
37 + ksmserver/screenlocker/greeter/greeterapp.h | 1 +
38 + 2 files changed, 87 insertions(+), 6 deletions(-)
39 +
40 +diff --git a/ksmserver/screenlocker/greeter/greeterapp.cpp b/ksmserver/screenlocker/greeter/greeterapp.cpp
41 +index 30987c1..c5e2f85 100644
42 +--- a/ksmserver/screenlocker/greeter/greeterapp.cpp
43 ++++ b/ksmserver/screenlocker/greeter/greeterapp.cpp
44 +@@ -32,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
45 + #include <KDE/KDebug>
46 + #include <KDE/KStandardDirs>
47 + #include <KDE/KUser>
48 ++#include <KDE/KWindowSystem>
49 + #include <Solid/PowerManagement>
50 + #include <kdeclarative.h>
51 + //Plasma
52 +@@ -52,6 +53,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
53 + #include <X11/Xlib.h>
54 + #include <fixx11h.h>
55 +
56 ++// this is usable to fake a "screensaver" installation for testing
57 ++// *must* be "0" for every public commit!
58 ++#define TEST_SCREENSAVER 0
59 ++
60 + namespace ScreenLocker
61 + {
62 +
63 +@@ -98,7 +103,11 @@ void UnlockApp::initialize()
64 + KCrash::setDrKonqiEnabled(false);
65 +
66 + KScreenSaverSettings::self()->readConfig();
67 ++#if TEST_SCREENSAVER
68 ++ m_showScreenSaver = true;
69 ++#else
70 + m_showScreenSaver = KScreenSaverSettings::legacySaverEnabled();
71 ++#endif
72 +
73 + m_structure = Plasma::PackageStructure::load("Plasma/Generic");
74 + m_package = new Plasma::Package(KStandardDirs::locate("data", "ksmserver/screenlocker/"), KScreenSaverSettings::greeterQML(), m_structure);
75 +@@ -148,7 +157,6 @@ void UnlockApp::desktopResized()
76 + this, SLOT(viewStatusChanged(QDeclarativeView::Status)));
77 + view->setWindowFlags(Qt::X11BypassWindowManagerHint);
78 + view->setFrameStyle(QFrame::NoFrame);
79 +- view->installEventFilter(this);
80 +
81 + // engine stuff
82 + KDeclarative kdeclarative;
83 +@@ -232,11 +240,15 @@ void UnlockApp::desktopResized()
84 + ScreenSaverWindow *screensaverWindow = m_screensaverWindows.at(i);
85 + screensaverWindow->setGeometry(view->geometry());
86 +
87 ++#if TEST_SCREENSAVER
88 ++ screensaverWindow->setAutoFillBackground(true);
89 ++#else
90 + QPixmap backgroundPix(screensaverWindow->size());
91 + QPainter p(&backgroundPix);
92 + view->render(&p);
93 + p.end();
94 + screensaverWindow->setBackground(backgroundPix);
95 ++#endif
96 + screensaverWindow->show();
97 + screensaverWindow->activateWindow();
98 + connect(screensaverWindow, SIGNAL(hidden()), this, SLOT(getFocus()));
99 +@@ -244,14 +256,52 @@ void UnlockApp::desktopResized()
100 + }
101 + // random state update, actually rather required on init only
102 + QMetaObject::invokeMethod(this, "getFocus", Qt::QueuedConnection);
103 ++ // getFocus on the next event cycle does not work as expected for multiple views
104 ++ // if there's no screensaver, hiding it won't happen and thus not trigger getFocus either
105 ++ // so we call it again in a few miliseconds - the value is nearly random but "must cross some event cycles"
106 ++ // while 150ms worked for me, 250ms gets us a bit more padding without being notable to a human user
107 ++ if (nScreens > 1 && m_screensaverWindows.isEmpty()) {
108 ++ QTimer::singleShot(250, this, SLOT(getFocus()));
109 ++ }
110 + capsLocked();
111 + }
112 +
113 + void UnlockApp::getFocus()
114 + {
115 +- if (!m_views.isEmpty()) {
116 +- m_views.first()->activateWindow();
117 ++ if (m_views.isEmpty()) {
118 ++ return;
119 + }
120 ++ QWidget *w = 0;
121 ++ // this loop is required to make the qml/graphicsscene properly handle the shared keyboard input
122 ++ // ie. "type something into the box of every greeter"
123 ++ foreach (QDeclarativeView *view, m_views) {
124 ++ view->activateWindow();
125 ++ view->grabKeyboard();
126 ++ view->setFocus(Qt::OtherFocusReason);
127 ++ }
128 ++ // determine which window should actually be active and have the real input focus/grab
129 ++ foreach (QDeclarativeView *view, m_views) {
130 ++ if (view->underMouse()) {
131 ++ w = view;
132 ++ break;
133 ++ }
134 ++ }
135 ++ if (!w) { // try harder
136 ++ foreach (QDeclarativeView *view, m_views) {
137 ++ if (view->geometry().contains(QCursor::pos())) {
138 ++ w = view;
139 ++ break;
140 ++ }
141 ++ }
142 ++ }
143 ++ if (!w) { // fallback solution
144 ++ w = m_views.first();
145 ++ }
146 ++ // activate window and grab input to be sure it really ends up there.
147 ++ // focus setting is still required for proper internal QWidget state (and eg. visual reflection)
148 ++ w->grabKeyboard();
149 ++ w->activateWindow();
150 ++ w->setFocus(Qt::OtherFocusReason);
151 + }
152 +
153 + void UnlockApp::setLockedPropertyOnViews()
154 +@@ -354,14 +404,15 @@ bool UnlockApp::eventFilter(QObject *obj, QEvent *event)
155 +
156 + static bool ignoreNextEscape = false;
157 + if (event->type() == QEvent::KeyPress) { // react if saver is visible
158 +- bool saverVisible = false;
159 ++ bool saverVisible = !m_screensaverWindows.isEmpty();
160 + foreach (ScreenSaverWindow *screensaverWindow, m_screensaverWindows) {
161 +- if (screensaverWindow->isVisible()) {
162 +- saverVisible = true;
163 ++ if (!screensaverWindow->isVisible()) {
164 ++ saverVisible = false;
165 + break;
166 + }
167 + }
168 + if (!saverVisible) {
169 ++ shareEvent(event, qobject_cast<QDeclarativeView*>(obj));
170 + return false; // we don't care
171 + }
172 + ignoreNextEscape = bool(static_cast<QKeyEvent *>(event)->key() == Qt::Key_Escape);
173 +@@ -378,6 +429,7 @@ bool UnlockApp::eventFilter(QObject *obj, QEvent *event)
174 + return false;
175 + }
176 + if (ke->key() != Qt::Key_Escape) {
177 ++ shareEvent(event, qobject_cast<QDeclarativeView*>(obj));
178 + return false; // irrelevant
179 + }
180 + if (ignoreNextEscape) {
181 +@@ -428,6 +480,34 @@ void UnlockApp::capsLocked()
182 + }
183 + }
184 +
185 ++/*
186 ++ * This function forwards an event from one greeter window to all others
187 ++ * It's used to have the keyboard operate on all greeter windows (on every screen)
188 ++ * at once so that the user gets visual feedback on the screen he's looking at -
189 ++ * even if the focus is actually on a powered off screen.
190 ++ */
191 ++
192 ++void UnlockApp::shareEvent(QEvent *e, QDeclarativeView *from)
193 ++{
194 ++ // from can be NULL any time (because the parameter is passed as qobject_cast)
195 ++ // m_views.contains(from) is atm. supposed to be true but required if any further
196 ++ // QDeclarativeViews are added (which are not part of m_views)
197 ++ // this makes "from" an optimization (nullptr check aversion)
198 ++ if (from && m_views.contains(from)) {
199 ++ // NOTICE any recursion in the event sharing will prevent authentication on multiscreen setups!
200 ++ // Any change in regarded event processing shall be tested thoroughly!
201 ++ removeEventFilter(this); // prevent recursion!
202 ++ const bool accepted = e->isAccepted(); // store state
203 ++ foreach (QDeclarativeView *view, m_views) {
204 ++ if (view != from) {
205 ++ QApplication::sendEvent(view, e);
206 ++ e->setAccepted(accepted);
207 ++ }
208 ++ }
209 ++ installEventFilter(this);
210 ++ }
211 ++}
212 ++
213 + } // namespace
214 +
215 + #include "greeterapp.moc"
216 +diff --git a/ksmserver/screenlocker/greeter/greeterapp.h b/ksmserver/screenlocker/greeter/greeterapp.h
217 +index 76b9824..8b79188 100644
218 +--- a/ksmserver/screenlocker/greeter/greeterapp.h
219 ++++ b/ksmserver/screenlocker/greeter/greeterapp.h
220 +@@ -63,6 +63,7 @@ private Q_SLOTS:
221 + private:
222 + void initialize();
223 + void capsLocked();
224 ++ void shareEvent(QEvent *e, QDeclarativeView *from);
225 +
226 + QString m_mainQmlPath;
227 + QList<QDeclarativeView*> m_views;
228 +--
229 +1.8.4.4
230 +
231
232 diff --git a/kde-base/ksmserver/ksmserver-4.11.3-r1.ebuild b/kde-base/ksmserver/ksmserver-4.11.3-r1.ebuild
233 new file mode 100644
234 index 0000000..4c34cbf
235 --- /dev/null
236 +++ b/kde-base/ksmserver/ksmserver-4.11.3-r1.ebuild
237 @@ -0,0 +1,39 @@
238 +# Copyright 1999-2013 Gentoo Foundation
239 +# Distributed under the terms of the GNU General Public License v2
240 +# $Header: $
241 +
242 +EAPI=5
243 +
244 +DECLARATIVE_REQUIRED="always"
245 +KMNAME="kde-workspace"
246 +inherit kde4-meta
247 +
248 +DESCRIPTION="The reliable KDE session manager that talks the standard X11R6"
249 +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
250 +IUSE="debug"
251 +
252 +DEPEND="
253 + $(add_kdebase_dep kcminit)
254 + $(add_kdebase_dep libkworkspace)
255 + media-libs/qimageblitz
256 + x11-libs/libICE
257 + x11-libs/libSM
258 + x11-libs/libX11
259 + x11-libs/libXrender
260 +"
261 +RDEPEND="${DEPEND}"
262 +
263 +KMEXTRACTONLY="
264 + kcminit/main.h
265 + libs/kdm/kgreeterplugin.h
266 + kcheckpass/
267 + libs/kephal/
268 + libs/kworkspace/
269 +"
270 +
271 +KMLOADLIBS="libkworkspace"
272 +
273 +PATCHES=(
274 + "${FILESDIR}/${PN}-4.10.50-noplasmalock.patch"
275 + "${FILESDIR}/${P}-fixmultimonitor.patch" # picked from 4.11.4
276 +)