Merge lp:~lukas-kde/unity8/screenInhibitions into lp:unity8
- screenInhibitions
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~lukas-kde/unity8/screenInhibitions |
Merge into: | lp:unity8 |
Diff against target: |
722 lines (+323/-64) 10 files modified
plugins/Unity/Session/CMakeLists.txt (+2/-0) plugins/Unity/Session/dbusunitysessionservice.cpp (+237/-28) plugins/Unity/Session/dbusunitysessionservice.h (+37/-2) qml/Components/Dialogs.qml (+3/-3) qml/Shell.qml (+1/-19) qml/Stage/Stage.qml (+39/-4) src/libunity8-private/unitydbusobject.cpp (+1/-6) src/libunity8-private/unitydbusobject.h (+0/-1) tests/plugins/Unity/Session/CMakeLists.txt (+2/-0) tests/plugins/Unity/Session/LogindServer.h (+1/-1) |
To merge this branch: | bzr merge lp:~lukas-kde/unity8/screenInhibitions |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Needs Fixing | |
Michael Zanetti | Pending | ||
Review via email: mp+309796@code.launchpad.net |
This proposal supersedes a proposal from 2016-10-14.
Commit message
Implement the FDO Inhibit DBUS API
Description of the change
This implements the de-facto freedesktop.org inhibit standard, as described in https:/
For the actual screenlock/saver keyboard shortcuts and dialogs, do not overpass the backend.
Simplify the *name* methods, add some missing documentation.
Checklist:
* Are there any related MPs required for this MP to build/function as expected? Please list.
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
N/A (no GUI change)
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
> In general it works, even from Firefox in libertine when watching a youtube video. However, if you close firefox while it's playing a video, it won't dispatch the Uninhibit call and the screen stays lit...
Oh yeah we totally need to track the requests and pop the ones where
requesters are gone.
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2662
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
looks better in handling bad/crashing/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2664
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2682
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 2683. By Lukáš Tinkl
-
use ual instead of qtmir::AppMan for the whitelisting of PIDs
Gerry Boland (gerboland) wrote : | # |
If you need an api in AppMan to wrap UAL's hasPid(), I'm happy to add it to qtmir. I just don't want to expose a list of PIDs for shell use.
- 2684. By Lukáš Tinkl
-
merge trunk
- 2685. By Lukáš Tinkl
-
merge trunk
- 2686. By Lukáš Tinkl
-
merge trunk
Unmerged revisions
- 2686. By Lukáš Tinkl
-
merge trunk
- 2685. By Lukáš Tinkl
-
merge trunk
- 2684. By Lukáš Tinkl
-
merge trunk
- 2683. By Lukáš Tinkl
-
use ual instead of qtmir::AppMan for the whitelisting of PIDs
- 2682. By Lukáš Tinkl
-
implement pidsForApplicat
ionid() - 2681. By Lukáš Tinkl
-
merge trunk
- 2680. By Lukáš Tinkl
-
fix PID type, get rid of Upstart
- 2679. By Lukáš Tinkl
-
don't take minimized delegates into account for the whitelist
- 2678. By Lukáš Tinkl
-
fix the whitelist checking
PID is different for DBUS and container apps :/
- 2677. By Lukáš Tinkl
-
fix the pid prop properly
Preview Diff
1 | === modified file 'plugins/Unity/Session/CMakeLists.txt' | |||
2 | --- plugins/Unity/Session/CMakeLists.txt 2016-06-21 14:23:49 +0000 | |||
3 | +++ plugins/Unity/Session/CMakeLists.txt 2016-11-22 09:36:12 +0000 | |||
4 | @@ -3,6 +3,7 @@ | |||
5 | 3 | ${CMAKE_CURRENT_BINARY_DIR} | 3 | ${CMAKE_CURRENT_BINARY_DIR} |
6 | 4 | ${GIO_INCLUDE_DIRS} | 4 | ${GIO_INCLUDE_DIRS} |
7 | 5 | ${GLIB_INCLUDE_DIRS} | 5 | ${GLIB_INCLUDE_DIRS} |
8 | 6 | ${UAL_INCLUDE_DIRS} | ||
9 | 6 | ${libunity8-private_SOURCE_DIR} | 7 | ${libunity8-private_SOURCE_DIR} |
10 | 7 | ) | 8 | ) |
11 | 8 | 9 | ||
12 | @@ -23,6 +24,7 @@ | |||
13 | 23 | unity8-private | 24 | unity8-private |
14 | 24 | ${GIO_LDFLAGS} | 25 | ${GIO_LDFLAGS} |
15 | 25 | ${GLIB_LIBRARIES} | 26 | ${GLIB_LIBRARIES} |
16 | 27 | ${UAL_LIBRARIES} | ||
17 | 26 | ) | 28 | ) |
18 | 27 | 29 | ||
19 | 28 | # export the qmldir and qmltypes files | 30 | # export the qmldir and qmltypes files |
20 | 29 | 31 | ||
21 | === modified file 'plugins/Unity/Session/dbusunitysessionservice.cpp' | |||
22 | --- plugins/Unity/Session/dbusunitysessionservice.cpp 2016-06-22 13:38:16 +0000 | |||
23 | +++ plugins/Unity/Session/dbusunitysessionservice.cpp 2016-11-22 09:36:12 +0000 | |||
24 | @@ -1,5 +1,5 @@ | |||
25 | 1 | /* | 1 | /* |
27 | 2 | * Copyright (C) 2014, 2015 Canonical, Ltd. | 2 | * Copyright (C) 2014-2016 Canonical, Ltd. |
28 | 3 | * | 3 | * |
29 | 4 | * This program is free software: you can redistribute it and/or modify it under | 4 | * This program is free software: you can redistribute it and/or modify it under |
30 | 5 | * the terms of the GNU Lesser General Public License version 3, as published by | 5 | * the terms of the GNU Lesser General Public License version 3, as published by |
31 | @@ -21,6 +21,7 @@ | |||
32 | 21 | #include <sys/types.h> | 21 | #include <sys/types.h> |
33 | 22 | #include <unistd.h> | 22 | #include <unistd.h> |
34 | 23 | #include <pwd.h> | 23 | #include <pwd.h> |
35 | 24 | #include <algorithm> | ||
36 | 24 | 25 | ||
37 | 25 | // Qt | 26 | // Qt |
38 | 26 | #include <QDebug> | 27 | #include <QDebug> |
39 | @@ -29,6 +30,14 @@ | |||
40 | 29 | #include <QElapsedTimer> | 30 | #include <QElapsedTimer> |
41 | 30 | #include <QDateTime> | 31 | #include <QDateTime> |
42 | 31 | #include <QDBusUnixFileDescriptor> | 32 | #include <QDBusUnixFileDescriptor> |
43 | 33 | #include <QDBusServiceWatcher> | ||
44 | 34 | #include <QDBusConnectionInterface> | ||
45 | 35 | #include <QPointer> | ||
46 | 36 | |||
47 | 37 | // ual | ||
48 | 38 | #include <ubuntu-app-launch/appid.h> | ||
49 | 39 | #include <ubuntu-app-launch/application.h> | ||
50 | 40 | #include <ubuntu-app-launch/registry.h> | ||
51 | 32 | 41 | ||
52 | 33 | // Glib | 42 | // Glib |
53 | 34 | #include <glib.h> | 43 | #include <glib.h> |
54 | @@ -41,16 +50,39 @@ | |||
55 | 41 | #define ACTIVE_KEY QStringLiteral("Active") | 50 | #define ACTIVE_KEY QStringLiteral("Active") |
56 | 42 | #define IDLE_SINCE_KEY QStringLiteral("IdleSinceHint") | 51 | #define IDLE_SINCE_KEY QStringLiteral("IdleSinceHint") |
57 | 43 | 52 | ||
58 | 53 | #define UNITY_SCREEN_SERVICE QStringLiteral("com.canonical.Unity.Screen") | ||
59 | 54 | #define UNITY_SCREEN_PATH QStringLiteral("/com/canonical/Unity/Screen") | ||
60 | 55 | #define UNITY_SCREEN_IFACE QStringLiteral("com.canonical.Unity.Screen") | ||
61 | 56 | |||
62 | 57 | namespace ual = ubuntu::app_launch; | ||
63 | 58 | |||
64 | 59 | struct InhibitionInfo { | ||
65 | 60 | int cookie{0}; | ||
66 | 61 | QString dbusAppName; | ||
67 | 62 | QString dbusReason; | ||
68 | 63 | QString dbusService; | ||
69 | 64 | pid_t pid{0}; | ||
70 | 65 | }; | ||
71 | 66 | |||
72 | 44 | class DBusUnitySessionServicePrivate: public QObject | 67 | class DBusUnitySessionServicePrivate: public QObject |
73 | 45 | { | 68 | { |
74 | 46 | Q_OBJECT | 69 | Q_OBJECT |
75 | 47 | public: | 70 | public: |
76 | 48 | QString logindSessionPath; | 71 | QString logindSessionPath; |
78 | 49 | bool isSessionActive = true; | 72 | bool isSessionActive{true}; |
79 | 50 | QElapsedTimer screensaverActiveTimer; | 73 | QElapsedTimer screensaverActiveTimer; |
80 | 51 | QDBusUnixFileDescriptor m_systemdInhibitFd; | 74 | QDBusUnixFileDescriptor m_systemdInhibitFd; |
81 | 52 | 75 | ||
83 | 53 | DBusUnitySessionServicePrivate(): QObject() { | 76 | // inhibit stuff |
84 | 77 | QPointer<QDBusServiceWatcher> busWatcher; | ||
85 | 78 | std::list<InhibitionInfo> inhibitions; | ||
86 | 79 | QStringList screenInhibitionsWhitelist; // list of appIds | ||
87 | 80 | std::shared_ptr<ual::Registry> m_ualRegistry{std::make_shared<ual::Registry>()}; | ||
88 | 81 | |||
89 | 82 | DBusUnitySessionServicePrivate(): | ||
90 | 83 | QObject() | ||
91 | 84 | , busWatcher(new QDBusServiceWatcher(this)) | ||
92 | 85 | { | ||
93 | 54 | init(); | 86 | init(); |
94 | 55 | checkActive(); | 87 | checkActive(); |
95 | 56 | } | 88 | } |
96 | @@ -80,6 +112,11 @@ | |||
97 | 80 | } else { | 112 | } else { |
98 | 81 | qWarning() << "Failed to get logind session path" << reply.error().message(); | 113 | qWarning() << "Failed to get logind session path" << reply.error().message(); |
99 | 82 | } | 114 | } |
100 | 115 | |||
101 | 116 | // watch services | ||
102 | 117 | busWatcher->setConnection(QDBusConnection::sessionBus()); | ||
103 | 118 | busWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); | ||
104 | 119 | connect(busWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &DBusUnitySessionServicePrivate::onServiceUnregistered); | ||
105 | 83 | } | 120 | } |
106 | 84 | 121 | ||
107 | 85 | void setupSystemdInhibition() | 122 | void setupSystemdInhibition() |
108 | @@ -128,6 +165,7 @@ | |||
109 | 128 | QDBusConnection::SM_BUSNAME().asyncCall(msg); | 165 | QDBusConnection::SM_BUSNAME().asyncCall(msg); |
110 | 129 | } | 166 | } |
111 | 130 | 167 | ||
112 | 168 | // set the session as active or inactive | ||
113 | 131 | void setActive(bool active) | 169 | void setActive(bool active) |
114 | 132 | { | 170 | { |
115 | 133 | isSessionActive = active; | 171 | isSessionActive = active; |
116 | @@ -211,6 +249,139 @@ | |||
117 | 211 | QDBusConnection::SM_BUSNAME().asyncCall(msg); | 249 | QDBusConnection::SM_BUSNAME().asyncCall(msg); |
118 | 212 | } | 250 | } |
119 | 213 | 251 | ||
120 | 252 | /** | ||
121 | 253 | * Register inhibition, enable it if on whitelist | ||
122 | 254 | * | ||
123 | 255 | * @return the inhibition cookie, or 0 if the call didn't succeed | ||
124 | 256 | */ | ||
125 | 257 | int addInhibition(const QString &service, int pid, const QString &appName, const QString &reason) | ||
126 | 258 | { | ||
127 | 259 | InhibitionInfo inh; | ||
128 | 260 | inh.dbusAppName = appName; | ||
129 | 261 | inh.dbusReason = reason; | ||
130 | 262 | inh.dbusService = service; | ||
131 | 263 | inh.pid = static_cast<pid_t>(pid); | ||
132 | 264 | |||
133 | 265 | int cookie = 0; | ||
134 | 266 | |||
135 | 267 | if (whiteListCheck(pid)) { | ||
136 | 268 | cookie = addInhibitionHelper(); | ||
137 | 269 | if (cookie > 0) { | ||
138 | 270 | inh.cookie = cookie; | ||
139 | 271 | } | ||
140 | 272 | } else | ||
141 | 273 | qDebug() << "!!! Whitelist doesn't contain pid:" << pid << screenInhibitionsWhitelist; | ||
142 | 274 | |||
143 | 275 | if (!busWatcher.isNull() && !service.isEmpty() && !busWatcher->watchedServices().contains(service)) { | ||
144 | 276 | qDebug() << "!!! Started watching service:" << service; | ||
145 | 277 | busWatcher->addWatchedService(service); | ||
146 | 278 | } | ||
147 | 279 | |||
148 | 280 | qDebug() << "!!! addInhibition, cookie:" << cookie; | ||
149 | 281 | |||
150 | 282 | inhibitions.push_back(inh); | ||
151 | 283 | return cookie; | ||
152 | 284 | } | ||
153 | 285 | |||
154 | 286 | /** | ||
155 | 287 | * Ask repowerd to keep the display on (enable the inhibition), start watching the service | ||
156 | 288 | * @return cookie, 0 in failure | ||
157 | 289 | */ | ||
158 | 290 | int addInhibitionHelper() | ||
159 | 291 | { | ||
160 | 292 | QDBusMessage msg = QDBusMessage::createMethodCall(UNITY_SCREEN_SERVICE, UNITY_SCREEN_PATH, UNITY_SCREEN_IFACE, QStringLiteral("keepDisplayOn")); | ||
161 | 293 | QDBusReply<int> cookie = QDBusConnection::SM_BUSNAME().call(msg); | ||
162 | 294 | if (cookie.isValid()) { | ||
163 | 295 | return cookie; | ||
164 | 296 | } else { | ||
165 | 297 | qWarning() << "Failed to inhibit screen blanking" << cookie.error().message(); | ||
166 | 298 | } | ||
167 | 299 | |||
168 | 300 | return 0; | ||
169 | 301 | } | ||
170 | 302 | |||
171 | 303 | /** | ||
172 | 304 | * Release the repowerd screen inhibition based on @p cookie | ||
173 | 305 | */ | ||
174 | 306 | void removeInhibition(int cookie) | ||
175 | 307 | { | ||
176 | 308 | qDebug() << "!!! removeInhibition, cookie:" << cookie; | ||
177 | 309 | QDBusMessage msg = QDBusMessage::createMethodCall(UNITY_SCREEN_SERVICE, UNITY_SCREEN_PATH, UNITY_SCREEN_IFACE, QStringLiteral("removeDisplayOnRequest")); | ||
178 | 310 | msg << cookie; | ||
179 | 311 | QDBusReply<void> reply = QDBusConnection::SM_BUSNAME().call(msg); | ||
180 | 312 | if (!reply.isValid()) { | ||
181 | 313 | qWarning() << "Failed to release screen blanking inhibition" << reply.error().message(); | ||
182 | 314 | } | ||
183 | 315 | } | ||
184 | 316 | |||
185 | 317 | /** | ||
186 | 318 | * Drop the inhibition from the list with the matching @p cookie, cleaning up the bus watcher as well if needed | ||
187 | 319 | */ | ||
188 | 320 | void removeInhibitionHelper(int cookie) | ||
189 | 321 | { | ||
190 | 322 | qDebug() << "!!! removeInhibitionHelper, cookie:" << cookie; | ||
191 | 323 | // drop the inhibition from the list with the matching cookie | ||
192 | 324 | QString service; | ||
193 | 325 | inhibitions.remove_if([&service, cookie](const InhibitionInfo & inh) {service = inh.dbusService; return inh.cookie == cookie;}); | ||
194 | 326 | |||
195 | 327 | qDebug() << "!!! Removed inhibition for service?:" << service; | ||
196 | 328 | |||
197 | 329 | if (!busWatcher.isNull() && std::none_of(inhibitions.cbegin(), inhibitions.cend(), | ||
198 | 330 | [service](const InhibitionInfo & inh){return inh.dbusService == service;})) { | ||
199 | 331 | // no cookies from service left | ||
200 | 332 | qDebug() << "!!! Stopped watching service:" << service; | ||
201 | 333 | busWatcher->removeWatchedService(service); | ||
202 | 334 | } | ||
203 | 335 | } | ||
204 | 336 | |||
205 | 337 | /** | ||
206 | 338 | * Enable/disable inhibitions dynamically as the whitelist changes | ||
207 | 339 | */ | ||
208 | 340 | void updateInhibitions() | ||
209 | 341 | { | ||
210 | 342 | qDebug() << "!!! Update inhibitions, empty?" << inhibitions.empty(); | ||
211 | 343 | if (inhibitions.empty()) // no inhibitions set up, bail out | ||
212 | 344 | return; | ||
213 | 345 | |||
214 | 346 | qDebug() << "!!! Update inhibitions, whitelist of PIDs:" << screenInhibitionsWhitelist; | ||
215 | 347 | |||
216 | 348 | for (InhibitionInfo inh: inhibitions) { | ||
217 | 349 | if (!whiteListCheck(inh.pid)) { // not on whitelist anymore, disable temporarily | ||
218 | 350 | qDebug() << "!!! Disabling inhibition, not on whitelist:" << inh.dbusService; | ||
219 | 351 | removeInhibition(inh.cookie); | ||
220 | 352 | inh.cookie = 0; // reset the cookie | ||
221 | 353 | } else if (whiteListCheck(inh.pid) && inh.cookie == 0) { // on whitelist but not enabled | ||
222 | 354 | qDebug() << "!!! Enabling inhibition, on whitelist but not enabled:" << inh.dbusService; | ||
223 | 355 | inh.cookie = addInhibitionHelper(); | ||
224 | 356 | } | ||
225 | 357 | } | ||
226 | 358 | } | ||
227 | 359 | |||
228 | 360 | bool whiteListCheck(pid_t pid) const { | ||
229 | 361 | Q_FOREACH(const QString &appId, screenInhibitionsWhitelist) { | ||
230 | 362 | ual::AppID ualAppId = ual::AppID::find(m_ualRegistry, appId.toStdString()); | ||
231 | 363 | if (ualAppId.empty()) { | ||
232 | 364 | continue; | ||
233 | 365 | } | ||
234 | 366 | |||
235 | 367 | std::shared_ptr<ual::Application> ualApp; | ||
236 | 368 | try { | ||
237 | 369 | ualApp = ual::Application::create(ualAppId, m_ualRegistry); | ||
238 | 370 | } | ||
239 | 371 | catch (std::runtime_error &e) { | ||
240 | 372 | qWarning() << "Couldn't find UAL application object for" << appId << "-" << e.what(); | ||
241 | 373 | continue; | ||
242 | 374 | } | ||
243 | 375 | if (ualApp) { | ||
244 | 376 | if (std::any_of(ualApp->instances().cbegin(), ualApp->instances().cend(), | ||
245 | 377 | [pid](const std::shared_ptr<ual::Application::Instance> &inst){ return inst && inst->hasPid(pid); })) { | ||
246 | 378 | return true; | ||
247 | 379 | } | ||
248 | 380 | } | ||
249 | 381 | } | ||
250 | 382 | return false; | ||
251 | 383 | } | ||
252 | 384 | |||
253 | 214 | private Q_SLOTS: | 385 | private Q_SLOTS: |
254 | 215 | void onPropertiesChanged(const QString &iface, const QVariantMap &changedProps, const QStringList &invalidatedProps) | 386 | void onPropertiesChanged(const QString &iface, const QVariantMap &changedProps, const QStringList &invalidatedProps) |
255 | 216 | { | 387 | { |
256 | @@ -232,6 +403,19 @@ | |||
257 | 232 | } | 403 | } |
258 | 233 | } | 404 | } |
259 | 234 | 405 | ||
260 | 406 | void onServiceUnregistered(const QString &service) | ||
261 | 407 | { | ||
262 | 408 | // cleanup inhibitions | ||
263 | 409 | qDebug() << "!!! Cleanup inhibitions"; | ||
264 | 410 | Q_FOREACH(InhibitionInfo inh, inhibitions) { | ||
265 | 411 | if (inh.dbusService == service) { | ||
266 | 412 | qDebug() << "!!! Cleaning up cookie" << inh.cookie << ", after service:" << inh.dbusService; | ||
267 | 413 | removeInhibition(inh.cookie); | ||
268 | 414 | removeInhibitionHelper(inh.cookie); | ||
269 | 415 | } | ||
270 | 416 | } | ||
271 | 417 | } | ||
272 | 418 | |||
273 | 235 | Q_SIGNALS: | 419 | Q_SIGNALS: |
274 | 236 | void screensaverActiveChanged(bool active); | 420 | void screensaverActiveChanged(bool active); |
275 | 237 | void prepareForSleep(); | 421 | void prepareForSleep(); |
276 | @@ -245,7 +429,7 @@ | |||
277 | 245 | if (!d->logindSessionPath.isEmpty()) { | 429 | if (!d->logindSessionPath.isEmpty()) { |
278 | 246 | // connect our PromptLock() slot to the logind's session Lock() signal | 430 | // connect our PromptLock() slot to the logind's session Lock() signal |
279 | 247 | QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Lock"), this, SLOT(PromptLock())); | 431 | QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Lock"), this, SLOT(PromptLock())); |
281 | 248 | // ... and our Unlocked() signal to the logind's session Unlock() signal | 432 | // ... and our doUnlock() slot to the logind's session Unlock() signal |
282 | 249 | // (lightdm handles the unlocking by calling logind's Unlock method which in turn emits this signal we connect to) | 433 | // (lightdm handles the unlocking by calling logind's Unlock method which in turn emits this signal we connect to) |
283 | 250 | QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SLOT(doUnlock())); | 434 | QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SLOT(doUnlock())); |
284 | 251 | connect(d, &DBusUnitySessionServicePrivate::prepareForSleep, this, &DBusUnitySessionService::PromptLock); | 435 | connect(d, &DBusUnitySessionServicePrivate::prepareForSleep, this, &DBusUnitySessionService::PromptLock); |
285 | @@ -254,6 +438,22 @@ | |||
286 | 254 | } | 438 | } |
287 | 255 | } | 439 | } |
288 | 256 | 440 | ||
289 | 441 | QStringList DBusUnitySessionService::screenInhibitionsWhitelist() const | ||
290 | 442 | { | ||
291 | 443 | return d->screenInhibitionsWhitelist; | ||
292 | 444 | } | ||
293 | 445 | |||
294 | 446 | void DBusUnitySessionService::setScreenInhibitionsWhitelist(const QStringList &screenInhibitionsWhitelist) | ||
295 | 447 | { | ||
296 | 448 | qDebug() << "!!! Update whitelist, new one:" << screenInhibitionsWhitelist << ", old one:" << d->screenInhibitionsWhitelist; | ||
297 | 449 | if (std::is_permutation(screenInhibitionsWhitelist.begin(), screenInhibitionsWhitelist.end(), d->screenInhibitionsWhitelist.begin())) | ||
298 | 450 | return; | ||
299 | 451 | |||
300 | 452 | d->screenInhibitionsWhitelist = screenInhibitionsWhitelist; | ||
301 | 453 | Q_EMIT screenInhibitionsWhitelistChanged(); | ||
302 | 454 | d->updateInhibitions(); | ||
303 | 455 | } | ||
304 | 456 | |||
305 | 257 | void DBusUnitySessionService::Logout() | 457 | void DBusUnitySessionService::Logout() |
306 | 258 | { | 458 | { |
307 | 259 | // TODO ask the apps to quit and then emit the signal | 459 | // TODO ask the apps to quit and then emit the signal |
308 | @@ -263,11 +463,11 @@ | |||
309 | 263 | 463 | ||
310 | 264 | void DBusUnitySessionService::EndSession() | 464 | void DBusUnitySessionService::EndSession() |
311 | 265 | { | 465 | { |
317 | 266 | const QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("com.ubuntu.Upstart"), | 466 | const QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE, |
318 | 267 | QStringLiteral("/com/ubuntu/Upstart"), | 467 | d->logindSessionPath, |
319 | 268 | QStringLiteral("com.ubuntu.Upstart0_6"), | 468 | LOGIN1_SESSION_IFACE, |
320 | 269 | QStringLiteral("EndSession")); | 469 | QStringLiteral("Terminate")); |
321 | 270 | QDBusConnection::sessionBus().asyncCall(msg); | 470 | QDBusConnection::SM_BUSNAME().asyncCall(msg); |
322 | 271 | } | 471 | } |
323 | 272 | 472 | ||
324 | 273 | bool DBusUnitySessionService::CanHibernate() const | 473 | bool DBusUnitySessionService::CanHibernate() const |
325 | @@ -307,27 +507,12 @@ | |||
326 | 307 | 507 | ||
327 | 308 | QString DBusUnitySessionService::RealName() const | 508 | QString DBusUnitySessionService::RealName() const |
328 | 309 | { | 509 | { |
339 | 310 | struct passwd *p = getpwuid(geteuid()); | 510 | return QString::fromUtf8(g_get_real_name()); |
330 | 311 | if (p) { | ||
331 | 312 | const QString gecos = QString::fromLocal8Bit(p->pw_gecos); | ||
332 | 313 | if (!gecos.isEmpty()) { | ||
333 | 314 | const QStringList splitGecos = gecos.split(QLatin1Char(',')); | ||
334 | 315 | return splitGecos.first(); | ||
335 | 316 | } | ||
336 | 317 | } | ||
337 | 318 | |||
338 | 319 | return QString(); | ||
340 | 320 | } | 511 | } |
341 | 321 | 512 | ||
342 | 322 | QString DBusUnitySessionService::HostName() const | 513 | QString DBusUnitySessionService::HostName() const |
343 | 323 | { | 514 | { |
351 | 324 | char hostName[512]; | 515 | return QString::fromUtf8(g_get_host_name()); |
345 | 325 | if (gethostname(hostName, sizeof(hostName)) == -1) { | ||
346 | 326 | qWarning() << "Could not determine local hostname"; | ||
347 | 327 | return QString(); | ||
348 | 328 | } | ||
349 | 329 | hostName[sizeof(hostName) - 1] = '\0'; | ||
350 | 330 | return QString::fromLocal8Bit(hostName); | ||
352 | 331 | } | 516 | } |
353 | 332 | 517 | ||
354 | 333 | void DBusUnitySessionService::PromptLock() | 518 | void DBusUnitySessionService::PromptLock() |
355 | @@ -337,6 +522,7 @@ | |||
356 | 337 | // user session. | 522 | // user session. |
357 | 338 | Q_EMIT LockRequested(); | 523 | Q_EMIT LockRequested(); |
358 | 339 | Q_EMIT lockRequested(); | 524 | Q_EMIT lockRequested(); |
359 | 525 | d->setActive(false); | ||
360 | 340 | } | 526 | } |
361 | 341 | 527 | ||
362 | 342 | void DBusUnitySessionService::Lock() | 528 | void DBusUnitySessionService::Lock() |
363 | @@ -395,6 +581,7 @@ | |||
364 | 395 | { | 581 | { |
365 | 396 | Q_EMIT Unlocked(); | 582 | Q_EMIT Unlocked(); |
366 | 397 | Q_EMIT unlocked(); | 583 | Q_EMIT unlocked(); |
367 | 584 | d->setActive(true); | ||
368 | 398 | } | 585 | } |
369 | 399 | 586 | ||
370 | 400 | bool DBusUnitySessionService::IsLocked() const | 587 | bool DBusUnitySessionService::IsLocked() const |
371 | @@ -528,7 +715,7 @@ | |||
372 | 528 | 715 | ||
373 | 529 | void DBusGnomeScreensaverWrapper::SimulateUserActivity() | 716 | void DBusGnomeScreensaverWrapper::SimulateUserActivity() |
374 | 530 | { | 717 | { |
376 | 531 | d->setIdleHint(false); | 718 | d->setActive(true); |
377 | 532 | } | 719 | } |
378 | 533 | 720 | ||
379 | 534 | 721 | ||
380 | @@ -570,7 +757,29 @@ | |||
381 | 570 | 757 | ||
382 | 571 | void DBusScreensaverWrapper::SimulateUserActivity() | 758 | void DBusScreensaverWrapper::SimulateUserActivity() |
383 | 572 | { | 759 | { |
385 | 573 | d->setIdleHint(false); | 760 | d->setActive(true); |
386 | 761 | } | ||
387 | 762 | |||
388 | 763 | uint DBusScreensaverWrapper::Inhibit(const QString &appName, const QString &reason) | ||
389 | 764 | { | ||
390 | 765 | QString service; | ||
391 | 766 | int pid = 0; | ||
392 | 767 | if (calledFromDBus()) { | ||
393 | 768 | service = message().service(); | ||
394 | 769 | pid = connection().interface()->servicePid(service); | ||
395 | 770 | } | ||
396 | 771 | qDebug() << "!!! INHIBIT (appName, reason, dbusService, pid)" << appName << reason << service << pid; | ||
397 | 772 | uint cookie = static_cast<uint>(d->addInhibition(service, pid, appName, reason)); | ||
398 | 773 | d->checkActive(); | ||
399 | 774 | return cookie; | ||
400 | 775 | } | ||
401 | 776 | |||
402 | 777 | void DBusScreensaverWrapper::UnInhibit(uint cookie) | ||
403 | 778 | { | ||
404 | 779 | qDebug() << "!!! UNINHIBIT (cookie)" << cookie; | ||
405 | 780 | d->removeInhibition(cookie); | ||
406 | 781 | d->removeInhibitionHelper(cookie); | ||
407 | 782 | d->checkActive(); | ||
408 | 574 | } | 783 | } |
409 | 575 | 784 | ||
410 | 576 | #include "dbusunitysessionservice.moc" | 785 | #include "dbusunitysessionservice.moc" |
411 | 577 | 786 | ||
412 | === modified file 'plugins/Unity/Session/dbusunitysessionservice.h' | |||
413 | --- plugins/Unity/Session/dbusunitysessionservice.h 2016-06-22 13:38:16 +0000 | |||
414 | +++ plugins/Unity/Session/dbusunitysessionservice.h 2016-11-22 09:36:12 +0000 | |||
415 | @@ -1,5 +1,5 @@ | |||
416 | 1 | /* | 1 | /* |
418 | 2 | * Copyright (C) 2014, 2015 Canonical, Ltd. | 2 | * Copyright (C) 2014-2016 Canonical, Ltd. |
419 | 3 | * | 3 | * |
420 | 4 | * This program is free software: you can redistribute it and/or modify it under | 4 | * This program is free software: you can redistribute it and/or modify it under |
421 | 5 | * the terms of the GNU Lesser General Public License version 3, as published by | 5 | * the terms of the GNU Lesser General Public License version 3, as published by |
422 | @@ -17,6 +17,7 @@ | |||
423 | 17 | #ifndef DBUSUNITYSESSIONSERVICE_H | 17 | #ifndef DBUSUNITYSESSIONSERVICE_H |
424 | 18 | #define DBUSUNITYSESSIONSERVICE_H | 18 | #define DBUSUNITYSESSIONSERVICE_H |
425 | 19 | 19 | ||
426 | 20 | #include <QDBusContext> | ||
427 | 20 | #include <QDBusObjectPath> | 21 | #include <QDBusObjectPath> |
428 | 21 | 22 | ||
429 | 22 | #include "unitydbusobject.h" | 23 | #include "unitydbusobject.h" |
430 | @@ -36,6 +37,12 @@ | |||
431 | 36 | Q_OBJECT | 37 | Q_OBJECT |
432 | 37 | Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.Session") | 38 | Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.Session") |
433 | 38 | 39 | ||
434 | 40 | /** | ||
435 | 41 | * List of PIDs allowed to request screen inhibition | ||
436 | 42 | */ | ||
437 | 43 | Q_PROPERTY(QStringList screenInhibitionsWhitelist READ screenInhibitionsWhitelist WRITE setScreenInhibitionsWhitelist | ||
438 | 44 | NOTIFY screenInhibitionsWhitelistChanged) | ||
439 | 45 | |||
440 | 39 | public: | 46 | public: |
441 | 40 | DBusUnitySessionService(); | 47 | DBusUnitySessionService(); |
442 | 41 | ~DBusUnitySessionService() = default; | 48 | ~DBusUnitySessionService() = default; |
443 | @@ -48,6 +55,10 @@ | |||
444 | 48 | 55 | ||
445 | 49 | // TODO: remove duplicate signals and split D-Bus and QML API's | 56 | // TODO: remove duplicate signals and split D-Bus and QML API's |
446 | 50 | // Apparently QML needs the signals in lowercase, while DBUS spec needs the uppercase version | 57 | // Apparently QML needs the signals in lowercase, while DBUS spec needs the uppercase version |
447 | 58 | |||
448 | 59 | QStringList screenInhibitionsWhitelist() const; | ||
449 | 60 | void setScreenInhibitionsWhitelist(const QStringList &screenInhibitionsWhitelist); | ||
450 | 61 | |||
451 | 51 | Q_SIGNALS: | 62 | Q_SIGNALS: |
452 | 52 | /** | 63 | /** |
453 | 53 | * LogoutRequested signal | 64 | * LogoutRequested signal |
454 | @@ -108,6 +119,8 @@ | |||
455 | 108 | Q_SCRIPTABLE void Unlocked(); | 119 | Q_SCRIPTABLE void Unlocked(); |
456 | 109 | void unlocked(); | 120 | void unlocked(); |
457 | 110 | 121 | ||
458 | 122 | void screenInhibitionsWhitelistChanged(); | ||
459 | 123 | |||
460 | 111 | public Q_SLOTS: | 124 | public Q_SLOTS: |
461 | 112 | /** | 125 | /** |
462 | 113 | * Logout the system. | 126 | * Logout the system. |
463 | @@ -313,13 +326,16 @@ | |||
464 | 313 | */ | 326 | */ |
465 | 314 | Q_SCRIPTABLE quint32 GetActiveTime() const; | 327 | Q_SCRIPTABLE quint32 GetActiveTime() const; |
466 | 315 | 328 | ||
467 | 329 | /** | ||
468 | 330 | * Simulate user activity, thus interrupting the screensaver | ||
469 | 331 | */ | ||
470 | 316 | Q_SCRIPTABLE void SimulateUserActivity(); | 332 | Q_SCRIPTABLE void SimulateUserActivity(); |
471 | 317 | 333 | ||
472 | 318 | Q_SIGNALS: | 334 | Q_SIGNALS: |
473 | 319 | void ActiveChanged(bool active); | 335 | void ActiveChanged(bool active); |
474 | 320 | }; | 336 | }; |
475 | 321 | 337 | ||
477 | 322 | class DBusScreensaverWrapper: public UnityDBusObject | 338 | class DBusScreensaverWrapper: public UnityDBusObject, protected QDBusContext |
478 | 323 | { | 339 | { |
479 | 324 | Q_OBJECT | 340 | Q_OBJECT |
480 | 325 | Q_CLASSINFO("D-Bus Interface", "org.freedesktop.ScreenSaver") | 341 | Q_CLASSINFO("D-Bus Interface", "org.freedesktop.ScreenSaver") |
481 | @@ -354,8 +370,27 @@ | |||
482 | 354 | */ | 370 | */ |
483 | 355 | Q_SCRIPTABLE quint32 GetSessionIdleTime() const; | 371 | Q_SCRIPTABLE quint32 GetSessionIdleTime() const; |
484 | 356 | 372 | ||
485 | 373 | /** | ||
486 | 374 | * Simulate user activity, thus interrupting the screensaver | ||
487 | 375 | */ | ||
488 | 357 | Q_SCRIPTABLE void SimulateUserActivity(); | 376 | Q_SCRIPTABLE void SimulateUserActivity(); |
489 | 358 | 377 | ||
490 | 378 | /** | ||
491 | 379 | * Inhibit idleness (ie screen blanking) for the caller application. | ||
492 | 380 | * | ||
493 | 381 | * @param appName A unique identifier for the application, usually a reverse domain (such as 'org.freedesktop.example'). | ||
494 | 382 | * @param reason A human-readable and possibly translated string explaining the reason why idleness is inhibited (such as 'Playing a movie'). | ||
495 | 383 | * @return A cookie uniquely representing the inhibition request, to be passed to UnInhibit when done; 0 in case of error | ||
496 | 384 | */ | ||
497 | 385 | Q_SCRIPTABLE uint Inhibit(const QString &appName, const QString &reason); | ||
498 | 386 | |||
499 | 387 | /** | ||
500 | 388 | * Disable inhibit idleness for the caller application. | ||
501 | 389 | * | ||
502 | 390 | * @param cookie A cookie representing the inhibition request, as returned by the 'Inhibit' function. | ||
503 | 391 | */ | ||
504 | 392 | Q_SCRIPTABLE void UnInhibit(uint cookie); | ||
505 | 393 | |||
506 | 359 | Q_SIGNALS: | 394 | Q_SIGNALS: |
507 | 360 | void ActiveChanged(bool active); | 395 | void ActiveChanged(bool active); |
508 | 361 | }; | 396 | }; |
509 | 362 | 397 | ||
510 | === modified file 'qml/Components/Dialogs.qml' | |||
511 | --- qml/Components/Dialogs.qml 2016-07-15 19:37:39 +0000 | |||
512 | +++ qml/Components/Dialogs.qml 2016-11-22 09:36:12 +0000 | |||
513 | @@ -112,12 +112,12 @@ | |||
514 | 112 | 112 | ||
515 | 113 | GlobalShortcut { // lock screen | 113 | GlobalShortcut { // lock screen |
516 | 114 | shortcut: Qt.Key_ScreenSaver | 114 | shortcut: Qt.Key_ScreenSaver |
518 | 115 | onTriggered: LightDMService.greeter.showGreeter() | 115 | onTriggered: root.unitySessionService.PromptLock() |
519 | 116 | } | 116 | } |
520 | 117 | 117 | ||
521 | 118 | GlobalShortcut { // lock screen | 118 | GlobalShortcut { // lock screen |
522 | 119 | shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L | 119 | shortcut: Qt.ControlModifier|Qt.AltModifier|Qt.Key_L |
524 | 120 | onTriggered: LightDMService.greeter.showGreeter() | 120 | onTriggered: root.unitySessionService.PromptLock() |
525 | 121 | } | 121 | } |
526 | 122 | 122 | ||
527 | 123 | QtObject { | 123 | QtObject { |
528 | @@ -151,7 +151,7 @@ | |||
529 | 151 | Button { | 151 | Button { |
530 | 152 | text: i18n.ctr("Button: Lock the system", "Lock") | 152 | text: i18n.ctr("Button: Lock the system", "Lock") |
531 | 153 | onClicked: { | 153 | onClicked: { |
533 | 154 | LightDMService.greeter.showGreeter() | 154 | root.unitySessionService.PromptLock() |
534 | 155 | logoutDialog.hide(); | 155 | logoutDialog.hide(); |
535 | 156 | } | 156 | } |
536 | 157 | } | 157 | } |
537 | 158 | 158 | ||
538 | === modified file 'qml/Shell.qml' | |||
539 | --- qml/Shell.qml 2016-11-09 15:07:26 +0000 | |||
540 | +++ qml/Shell.qml 2016-11-22 09:36:12 +0000 | |||
541 | @@ -375,15 +375,6 @@ | |||
542 | 375 | } | 375 | } |
543 | 376 | } | 376 | } |
544 | 377 | 377 | ||
545 | 378 | Timer { | ||
546 | 379 | // See powerConnection for why this is useful | ||
547 | 380 | id: showGreeterDelayed | ||
548 | 381 | interval: 1 | ||
549 | 382 | onTriggered: { | ||
550 | 383 | greeter.forceShow(); | ||
551 | 384 | } | ||
552 | 385 | } | ||
553 | 386 | |||
554 | 387 | Connections { | 378 | Connections { |
555 | 388 | id: callConnection | 379 | id: callConnection |
556 | 389 | target: callManager | 380 | target: callManager |
557 | @@ -410,16 +401,7 @@ | |||
558 | 410 | onStatusChanged: { | 401 | onStatusChanged: { |
559 | 411 | if (Powerd.status === Powerd.Off && reason !== Powerd.Proximity && | 402 | if (Powerd.status === Powerd.Off && reason !== Powerd.Proximity && |
560 | 412 | !callManager.hasCalls && !wizard.active) { | 403 | !callManager.hasCalls && !wizard.active) { |
571 | 413 | // We don't want to simply call greeter.showNow() here, because | 404 | DBusUnitySessionService.PromptLock(); |
562 | 414 | // that will take too long. Qt will delay button event | ||
563 | 415 | // handling until the greeter is done loading and may think the | ||
564 | 416 | // user held down the power button the whole time, leading to a | ||
565 | 417 | // power dialog being shown. Instead, delay showing the | ||
566 | 418 | // greeter until we've finished handling the event. We could | ||
567 | 419 | // make the greeter load asynchronously instead, but that | ||
568 | 420 | // introduces a whole host of timing issues, especially with | ||
569 | 421 | // its animations. So this is simpler. | ||
570 | 422 | showGreeterDelayed.start(); | ||
572 | 423 | } | 405 | } |
573 | 424 | } | 406 | } |
574 | 425 | } | 407 | } |
575 | 426 | 408 | ||
576 | === modified file 'qml/Stage/Stage.qml' | |||
577 | --- qml/Stage/Stage.qml 2016-11-12 16:05:40 +0000 | |||
578 | +++ qml/Stage/Stage.qml 2016-11-22 09:36:12 +0000 | |||
579 | @@ -17,6 +17,7 @@ | |||
580 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
581 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.3 |
582 | 19 | import Unity.Application 0.1 | 19 | import Unity.Application 0.1 |
583 | 20 | import Unity.Session 0.1 | ||
584 | 20 | import "../Components/PanelState" | 21 | import "../Components/PanelState" |
585 | 21 | import "../Components" | 22 | import "../Components" |
586 | 22 | import Utils 0.1 | 23 | import Utils 0.1 |
587 | @@ -346,6 +347,31 @@ | |||
588 | 346 | } | 347 | } |
589 | 347 | 348 | ||
590 | 348 | readonly property real virtualKeyboardHeight: root.inputMethodRect.height | 349 | readonly property real virtualKeyboardHeight: root.inputMethodRect.height |
591 | 350 | |||
592 | 351 | function updateScreenInhibitionsWhiteList() { | ||
593 | 352 | var result = []; | ||
594 | 353 | if (root.state == "staged" && priv.mainStageDelegate) { | ||
595 | 354 | result.push(priv.mainStageDelegate.appId); | ||
596 | 355 | } else if (root.state == "stagedWithSideStage") { | ||
597 | 356 | if (priv.mainStageDelegate) { | ||
598 | 357 | result.push(priv.mainStageDelegate.appId); | ||
599 | 358 | } | ||
600 | 359 | if (priv.sideStageDelegate) { | ||
601 | 360 | result.push(priv.sideStageDelegate.appId); | ||
602 | 361 | } | ||
603 | 362 | } else if (root.state == "windowed") { | ||
604 | 363 | for (var i = 0; i < appRepeater.count; i++) { | ||
605 | 364 | var appDelegate = appRepeater.itemAt(i); | ||
606 | 365 | if (appDelegate && !appDelegate.minimized) { | ||
607 | 366 | result.push(appDelegate.appId); | ||
608 | 367 | } | ||
609 | 368 | } | ||
610 | 369 | } | ||
611 | 370 | |||
612 | 371 | print("!!! Inhibition whitelist updated:", result); | ||
613 | 372 | |||
614 | 373 | DBusUnitySessionService.screenInhibitionsWhitelist = result; | ||
615 | 374 | } | ||
616 | 349 | } | 375 | } |
617 | 350 | 376 | ||
618 | 351 | Component.onCompleted: priv.updateMainAndSideStageIndexes(); | 377 | Component.onCompleted: priv.updateMainAndSideStageIndexes(); |
619 | @@ -521,9 +547,16 @@ | |||
620 | 521 | }, | 547 | }, |
621 | 522 | Transition { | 548 | Transition { |
622 | 523 | to: "stagedWithSideStage" | 549 | to: "stagedWithSideStage" |
624 | 524 | ScriptAction { script: priv.updateMainAndSideStageIndexes(); } | 550 | ScriptAction { script: { priv.updateMainAndSideStageIndexes(); priv.updateScreenInhibitionsWhiteList(); }} |
625 | 551 | }, | ||
626 | 552 | Transition { | ||
627 | 553 | to: "staged" | ||
628 | 554 | ScriptAction { script: priv.updateScreenInhibitionsWhiteList(); } | ||
629 | 555 | }, | ||
630 | 556 | Transition { | ||
631 | 557 | to: "windowed" | ||
632 | 558 | ScriptAction { script: priv.updateScreenInhibitionsWhiteList(); } | ||
633 | 525 | } | 559 | } |
634 | 526 | |||
635 | 527 | ] | 560 | ] |
636 | 528 | 561 | ||
637 | 529 | MouseArea { | 562 | MouseArea { |
638 | @@ -571,10 +604,12 @@ | |||
639 | 571 | 604 | ||
640 | 572 | Connections { | 605 | Connections { |
641 | 573 | target: root.topLevelSurfaceList | 606 | target: root.topLevelSurfaceList |
643 | 574 | onListChanged: priv.updateMainAndSideStageIndexes() | 607 | onListChanged: { |
644 | 608 | priv.updateMainAndSideStageIndexes(); | ||
645 | 609 | priv.updateScreenInhibitionsWhiteList(); | ||
646 | 610 | } | ||
647 | 575 | } | 611 | } |
648 | 576 | 612 | ||
649 | 577 | |||
650 | 578 | DropArea { | 613 | DropArea { |
651 | 579 | objectName: "MainStageDropArea" | 614 | objectName: "MainStageDropArea" |
652 | 580 | anchors { | 615 | anchors { |
653 | 581 | 616 | ||
654 | === modified file 'src/libunity8-private/unitydbusobject.cpp' | |||
655 | --- src/libunity8-private/unitydbusobject.cpp 2015-09-14 09:11:08 +0000 | |||
656 | +++ src/libunity8-private/unitydbusobject.cpp 2016-11-22 09:36:12 +0000 | |||
657 | @@ -42,11 +42,6 @@ | |||
658 | 42 | m_connection.unregisterObject(path()); | 42 | m_connection.unregisterObject(path()); |
659 | 43 | } | 43 | } |
660 | 44 | 44 | ||
661 | 45 | QDBusConnection UnityDBusObject::connection() const | ||
662 | 46 | { | ||
663 | 47 | return m_connection; | ||
664 | 48 | } | ||
665 | 49 | |||
666 | 50 | QString UnityDBusObject::path() const | 45 | QString UnityDBusObject::path() const |
667 | 51 | { | 46 | { |
668 | 52 | return m_path; | 47 | return m_path; |
669 | @@ -70,7 +65,7 @@ | |||
670 | 70 | message << changedProps; | 65 | message << changedProps; |
671 | 71 | message << QStringList(); | 66 | message << QStringList(); |
672 | 72 | 67 | ||
674 | 73 | connection().send(message); | 68 | m_connection.send(message); |
675 | 74 | } | 69 | } |
676 | 75 | 70 | ||
677 | 76 | void UnityDBusObject::registerObject() | 71 | void UnityDBusObject::registerObject() |
678 | 77 | 72 | ||
679 | === modified file 'src/libunity8-private/unitydbusobject.h' | |||
680 | --- src/libunity8-private/unitydbusobject.h 2014-10-09 21:29:00 +0000 | |||
681 | +++ src/libunity8-private/unitydbusobject.h 2016-11-22 09:36:12 +0000 | |||
682 | @@ -28,7 +28,6 @@ | |||
683 | 28 | explicit UnityDBusObject(const QString &path, const QString &service = QString(), bool async = true, QObject *parent = 0); | 28 | explicit UnityDBusObject(const QString &path, const QString &service = QString(), bool async = true, QObject *parent = 0); |
684 | 29 | ~UnityDBusObject(); | 29 | ~UnityDBusObject(); |
685 | 30 | 30 | ||
686 | 31 | QDBusConnection connection() const; | ||
687 | 32 | QString path() const; | 31 | QString path() const; |
688 | 33 | 32 | ||
689 | 34 | protected: | 33 | protected: |
690 | 35 | 34 | ||
691 | === modified file 'tests/plugins/Unity/Session/CMakeLists.txt' | |||
692 | --- tests/plugins/Unity/Session/CMakeLists.txt 2016-06-21 14:23:49 +0000 | |||
693 | +++ tests/plugins/Unity/Session/CMakeLists.txt 2016-11-22 09:36:12 +0000 | |||
694 | @@ -13,6 +13,7 @@ | |||
695 | 13 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Session | 13 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Session |
696 | 14 | ${libunity8-private_SOURCE_DIR} | 14 | ${libunity8-private_SOURCE_DIR} |
697 | 15 | ${GLIB_INCLUDE_DIRS} | 15 | ${GLIB_INCLUDE_DIRS} |
698 | 16 | ${UAL_INCLUDE_DIRS} | ||
699 | 16 | ) | 17 | ) |
700 | 17 | 18 | ||
701 | 18 | add_definitions(-DSM_BUSNAME=sessionBus) | 19 | add_definitions(-DSM_BUSNAME=sessionBus) |
702 | @@ -38,6 +39,7 @@ | |||
703 | 38 | target_link_libraries(sessionbackendtestExec | 39 | target_link_libraries(sessionbackendtestExec |
704 | 39 | unity8-private | 40 | unity8-private |
705 | 40 | ${GLIB_LIBRARIES} | 41 | ${GLIB_LIBRARIES} |
706 | 42 | ${UAL_LIBRARIES} | ||
707 | 41 | ) | 43 | ) |
708 | 42 | qt5_use_modules(sessionbackendtestExec Test Core Qml DBus) | 44 | qt5_use_modules(sessionbackendtestExec Test Core Qml DBus) |
709 | 43 | 45 | ||
710 | 44 | 46 | ||
711 | === modified file 'tests/plugins/Unity/Session/LogindServer.h' | |||
712 | --- tests/plugins/Unity/Session/LogindServer.h 2016-06-22 13:38:16 +0000 | |||
713 | +++ tests/plugins/Unity/Session/LogindServer.h 2016-11-22 09:36:12 +0000 | |||
714 | @@ -37,7 +37,7 @@ | |||
715 | 37 | Q_SIGNALS: | 37 | Q_SIGNALS: |
716 | 38 | void Lock(); | 38 | void Lock(); |
717 | 39 | void Unlock(); | 39 | void Unlock(); |
719 | 40 | void PrepareForSleep(); | 40 | void PrepareForSleep(bool); |
720 | 41 | }; | 41 | }; |
721 | 42 | 42 | ||
722 | 43 | #endif | 43 | #endif |
In general it works, even from Firefox in libertine when watching a youtube video. However, if you close firefox while it's playing a video, it won't dispatch the Uninhibit call and the screen stays lit...