summaryrefslogtreecommitdiff
blob: 7de71bf959c011cc4d8b59bad20b83d41697f081 (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
63
64
65
From 75fded6f11ed645b0e25bf42b05fa57b8a675197 Mon Sep 17 00:00:00 2001
From: Nate Graham <nate@kde.org>
Date: Tue, 20 Oct 2020 14:05:33 -0600
Subject: [PATCH] Revert "[focuschain/task switcher] Remove special handling
 for minimized windows"

This reverts commit cc862fa674d3407f516a89b8543acea04aa8b37d.

It turns out that some people like this behavior and we've received
various user complaints about it.
---
 abstract_client.cpp |  1 +
 focuschain.cpp      | 12 +++++++++++-
 focuschain.h        |  3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/abstract_client.cpp b/abstract_client.cpp
index 35b7fcb61..e44da4725 100644
--- a/abstract_client.cpp
+++ b/abstract_client.cpp
@@ -703,6 +703,7 @@ void AbstractClient::minimize(bool avoid_animation)
     doMinimize();
 
     updateWindowRules(Rules::Minimize);
+    FocusChain::self()->update(this, FocusChain::MakeFirstMinimized);
     // TODO: merge signal with s_minimized
     addWorkspaceRepaint(visibleRect());
     emit clientMinimized(this, !avoid_animation);
diff --git a/focuschain.cpp b/focuschain.cpp
index 66d209709..a68e6d3c6 100644
--- a/focuschain.cpp
+++ b/focuschain.cpp
@@ -227,7 +227,17 @@ AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint deskt
 void FocusChain::makeFirstInChain(AbstractClient *client, Chain &chain)
 {
     chain.removeAll(client);
-    chain.append(client);
+    if (client->isMinimized()) { // add it before the first minimized ...
+        for (int i = chain.count()-1; i >= 0; --i) {
+            if (chain.at(i)->isMinimized()) {
+                chain.insert(i+1, client);
+                return;
+            }
+        }
+        chain.prepend(client); // ... or at end of chain
+    } else {
+        chain.append(client);
+    }
 }
 
 void FocusChain::makeLastInChain(AbstractClient *client, Chain &chain)
diff --git a/focuschain.h b/focuschain.h
index 8baf3ea32..9a7c7e25d 100644
--- a/focuschain.h
+++ b/focuschain.h
@@ -41,7 +41,8 @@ class FocusChain : public QObject
     enum Change {
         MakeFirst,
         MakeLast,
-        Update
+        Update,
+        MakeFirstMinimized = MakeFirst
     };
     ~FocusChain() override;
     /**