Commit 38367efd authored by David Edmundson's avatar David Edmundson
Browse files

Fix Logout screen countdown not cancelling on multi-monitor setups

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

Reviewers: #plasma

Subscribers: zzag, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D12893
parent 69a0e05b
......@@ -26,6 +26,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kcoreaddons 1.0 as KCoreAddons
import "../components"
import "timer.js" as AutoTriggerTimer
PlasmaCore.ColorScope {
id: root
......@@ -81,6 +82,11 @@ PlasmaCore.ColorScope {
repeat: true
interval: 1000
onTriggered: remainingTime--
Component.onCompleted: {
AutoTriggerTimer.addCancelAutoTriggerCallback(function() {
countDownTimer.running = false;
});
}
}
function isLightColor(color) {
......
......@@ -23,6 +23,7 @@ import QtQuick.Layouts 1.2
import org.kde.plasma.core 2.0 as PlasmaCore
import "../components"
import "timer.js" as AutoTriggerTimer
ActionButton {
property var action
......@@ -37,5 +38,5 @@ ActionButton {
easing.type: Easing.InOutQuad
}
}
Keys.onPressed: countDownTimer.running = false
Keys.onPressed: AutoTriggerTimer.cancelAutoTrigger();
}
/***************************************************************************
* Copyright (C) 2018 David Edmundson <davidedmundson@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
.pragma library
//written as a library to share knowledge of when a key was pressed
//between the multiple views, so pressing a key on one cancels all timers
var callbacks = [];
function addCancelAutoTriggerCallback(callback) {
callbacks.push(callback);
}
function cancelAutoTrigger() {
callbacks.forEach(function(c) {
if (!c) {
return;
}
c();
});
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment