Fix Logout screen countdown not cancelling on multi-monitor setups
ClosedPublic

Authored by davidedmundson on May 15 2018, 9:38 AM.

Details

Summary

The logout greeter theme has a timer that invokes the current action if
no keyboard interaction has taken place.

This cancel on keyboard nav is broken on multiple monitor setups as even
if a user is interacting with one, the timer from another can still
fire.

Fix is via JS singleton library as the timer is very theme specific. I
didn't want to add anything in shutdowndlg.cpp as it would be breaking
layering.

BUG: 394249

Test Plan

Had multi monitor setup
Pressed key on one screen. All timer UIs cleared, nothing happened after 30 seconds

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.May 15 2018, 9:38 AM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 15 2018, 9:38 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson requested review of this revision.May 15 2018, 9:38 AM

This is both genius and evil. I like that you kept it all in the theme.

lookandfeel/contents/logout/timer.js
25

var callbacks = [];

27–34

Name it add as first reading the QML file I thought you were overwriting the callback every time

32

I recall for .. in with JS Arrays being bad. I don't remember why, though.
Perhaps do

callbacks.forEach(function(c) { ... })
zzag added a subscriber: zzag.May 15 2018, 11:15 AM

@broulik: for ... in iterates over the enumerable properties. This would lead to "weird unexpected"(not really) results. ECMAScript 2015 introduced for ... of statement that iterates over data. In most cases, for ... of should be preferred over for ... in, unless someone wants to iterate over properties.

AFAIK, QML JavaScript doesn't support let, arrow functions, spread operator, for ... of statement, and other "new" cool features in JavaScript.

davidedmundson marked 2 inline comments as done.

Address all comments

mart accepted this revision.May 16 2018, 10:12 AM
This revision is now accepted and ready to land.May 16 2018, 10:12 AM
This revision was automatically updated to reflect the committed changes.