summaryrefslogtreecommitdiff
blob: a495b075ca6b1d6b82c70a790c363de8ee80f710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From c1f3b45cabe0cf89e13a5b1c9b7a673992320826 Mon Sep 17 00:00:00 2001
From: Thomas Surrel <thomas.surrel@protonmail.com>
Date: Tue, 22 May 2018 14:20:25 -0600
Subject: Activity switcher auto-hide when using Meta-Tab

Summary:
Commit 174aa217180434ab93b899d9c7cf967bd2daff7e created a new
issue where the activity switcher would not hide anymore when
switching activities with the Meta-Tab global shortcut and
releasing the keys under one second.

This patch fixes this by unconditionnal toggling the activity
switcher visibility if it should be hidden, but keeping the
timestamp condition before showing it, so that both Meta-q and
Meta-Tab behaves correctly.

BUG: 393912

Reviewers: mart, ngraham

Reviewed By: mart, ngraham

Subscribers: ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D13012
---
 desktoppackage/contents/views/Desktop.qml | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/desktoppackage/contents/views/Desktop.qml b/desktoppackage/contents/views/Desktop.qml
index 3272a89..3539050 100644
--- a/desktoppackage/contents/views/Desktop.qml
+++ b/desktoppackage/contents/views/Desktop.qml
@@ -73,17 +73,16 @@ Item {
     property int lastToggleActivityManagerTimestamp: 0
 
     function toggleActivityManager() {
-        var currentTimestamp = new Date().getTime() / 1000;
+        if (sidePanelStack.state == "activityManager") {
+            sidePanelStack.state = "closed";
+        } else {
+            var currentTimestamp = new Date().getTime() / 1000;
 
-        if (currentTimestamp - lastToggleActivityManagerTimestamp > 1) {
-            if (sidePanelStack.state == "activityManager") {
-                sidePanelStack.state = "closed";
-            } else {
+            if (currentTimestamp - lastToggleActivityManagerTimestamp > 1) {
                 sidePanelStack.state = "activityManager";
                 sidePanelStack.setSource(Qt.resolvedUrl("../activitymanager/ActivityManager.qml"))
+                lastToggleActivityManagerTimestamp = currentTimestamp;
             }
-
-            lastToggleActivityManagerTimestamp = currentTimestamp;
         }
     }
 
-- 
cgit v0.11.2