Skip to content

Commit

Permalink
Provide kwin-5.20.5-r1
Browse files Browse the repository at this point in the history
  • Loading branch information
yoqto committed Jan 23, 2021
1 parent db14410 commit 8cd0efe
Show file tree
Hide file tree
Showing 5 changed files with 580 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
From b3e9c819537cf292d9b1c4d19c5ce7adde00158e Mon Sep 17 00:00:00 2001
From: Nate Graham <[email protected]>
Date: Tue, 20 Oct 2020 14:15:46 -0600
Subject: [PATCH] [focuschain/task switcher] Add hidden option to govern
repositioning minimized windows

Since some people apparently liked the old behavior of moving minimized
windows to the end of the focus chain, let's let them have it if they
set a hidden config option:

`MoveMinimizedWindowsToEndOfTabBoxFocusChain=true` in the `[TabBox]` group
of the kwinrc file.

We can add a UI for it later if needed.

BUG: 427840
FIXED-IN: 5.21
---
abstract_client.cpp | 6 +++++-
focuschain.cpp | 16 ++++++++++------
kwin.kcfg | 3 +++
options.cpp | 11 +++++++++++
options.h | 6 ++++++
5 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/abstract_client.cpp b/abstract_client.cpp
index e44da4725..01f3081f8 100644
--- a/abstract_client.cpp
+++ b/abstract_client.cpp
@@ -703,7 +703,11 @@ void AbstractClient::minimize(bool avoid_animation)
doMinimize();

updateWindowRules(Rules::Minimize);
- FocusChain::self()->update(this, FocusChain::MakeFirstMinimized);
+
+ if (options->moveMinimizedWindowsToEndOfTabBoxFocusChain()) {
+ 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 a68e6d3c6..347df3066 100644
--- a/focuschain.cpp
+++ b/focuschain.cpp
@@ -227,14 +227,18 @@ AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint deskt
void FocusChain::makeFirstInChain(AbstractClient *client, Chain &chain)
{
chain.removeAll(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;
+ if (options->moveMinimizedWindowsToEndOfTabBoxFocusChain()) {
+ 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);
}
- chain.prepend(client); // ... or at end of chain
} else {
chain.append(client);
}
diff --git a/kwin.kcfg b/kwin.kcfg
index 0b59606e3..2b06efe52 100644
--- a/kwin.kcfg
+++ b/kwin.kcfg
@@ -295,6 +295,9 @@
<entry name="LayoutName" type="String">
<default>thumbnails</default>
</entry>
+ <entry name="MoveMinimizedWindowsToEndOfTabBoxFocusChain" type="Bool">
+ <default>false</default>
+ </entry>
</group>
<group name="KDE">
<entry name="AnimationDurationFactor" type="Double">
diff --git a/options.cpp b/options.cpp
index 4bce7ee39..8014f8b78 100644
--- a/options.cpp
+++ b/options.cpp
@@ -111,6 +111,7 @@ Options::Options(QObject *parent)
, m_glPreferBufferSwap(Options::defaultGlPreferBufferSwap())
, m_glPlatformInterface(Options::defaultGlPlatformInterface())
, m_windowsBlockCompositing(true)
+ , m_MoveMinimizedWindowsToEndOfTabBoxFocusChain(false)
, OpTitlebarDblClick(Options::defaultOperationTitlebarDblClick())
, CmdActiveTitlebar1(Options::defaultCommandActiveTitlebar1())
, CmdActiveTitlebar2(Options::defaultCommandActiveTitlebar2())
@@ -679,6 +680,15 @@ void Options::setWindowsBlockCompositing(bool value)
emit windowsBlockCompositingChanged();
}

+void Options::setMoveMinimizedWindowsToEndOfTabBoxFocusChain(bool value)
+{
+ if (m_MoveMinimizedWindowsToEndOfTabBoxFocusChain == value) {
+ return;
+ }
+ m_MoveMinimizedWindowsToEndOfTabBoxFocusChain = value;
+
+}
+
void Options::setGlPreferBufferSwap(char glPreferBufferSwap)
{
if (glPreferBufferSwap == 'a') {
@@ -849,6 +859,7 @@ void Options::syncFromKcfgc()
setElectricBorderTiling(m_settings->electricBorderTiling());
setElectricBorderCornerRatio(m_settings->electricBorderCornerRatio());
setWindowsBlockCompositing(m_settings->windowsBlockCompositing());
+ setMoveMinimizedWindowsToEndOfTabBoxFocusChain(m_settings->moveMinimizedWindowsToEndOfTabBoxFocusChain());

}

diff --git a/options.h b/options.h
index 6d72017d3..0834f314e 100644
--- a/options.h
+++ b/options.h
@@ -590,6 +590,10 @@ public:
return m_windowsBlockCompositing;
}

+ bool moveMinimizedWindowsToEndOfTabBoxFocusChain() const {
+ return m_MoveMinimizedWindowsToEndOfTabBoxFocusChain;
+ }
+
QStringList modifierOnlyDBusShortcut(Qt::KeyboardModifier mod) const;

// setters
@@ -651,6 +655,7 @@ public:
void setGlPreferBufferSwap(char glPreferBufferSwap);
void setGlPlatformInterface(OpenGLPlatformInterface interface);
void setWindowsBlockCompositing(bool set);
+ void setMoveMinimizedWindowsToEndOfTabBoxFocusChain(bool set);

// default values
static WindowOperation defaultOperationTitlebarDblClick() {
@@ -881,6 +886,7 @@ private:
GlSwapStrategy m_glPreferBufferSwap;
OpenGLPlatformInterface m_glPlatformInterface;
bool m_windowsBlockCompositing;
+ bool m_MoveMinimizedWindowsToEndOfTabBoxFocusChain;

WindowOperation OpTitlebarDblClick;
WindowOperation opMaxButtonRightClick = defaultOperationMaxButtonRightClick();
--
GitLab
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
From 75fded6f11ed645b0e25bf42b05fa57b8a675197 Mon Sep 17 00:00:00 2001
From: Nate Graham <[email protected]>
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;
/**
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
From 79b781a02c6bc24dbcc74ac9a82bf987b1dd5a23 Mon Sep 17 00:00:00 2001
From: Nate Graham <[email protected]>
Date: Tue, 20 Oct 2020 14:15:46 -0600
Subject: [PATCH 2/2] [focuschain/task switcher] Add hidden option to govern
repositioning minimized windows

Since some people apparently liked the old behavior of moving minimized
windows to the end of the focus chain, let's let them have it if they
set a hidden config option:

`MoveMinimizedWindowsToEndOfTabBoxFocusChain=true` in the `[TabBox]` group
of the kwinrc file.

We can add a UI for it later if needed.

BUG: 427840
FIXED-IN: 5.21
---
abstract_client.cpp | 6 +++++-
focuschain.cpp | 16 ++++++++++------
kwin.kcfg | 3 +++
options.cpp | 11 +++++++++++
options.h | 6 ++++++
5 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/abstract_client.cpp b/abstract_client.cpp
index c3b727592..69e70f7d8 100644
--- a/abstract_client.cpp
+++ b/abstract_client.cpp
@@ -703,7 +703,11 @@ void AbstractClient::minimize(bool avoid_animation)
doMinimize();

updateWindowRules(Rules::Minimize);
- FocusChain::self()->update(this, FocusChain::MakeFirstMinimized);
+
+ if (options->moveMinimizedWindowsToEndOfTabBoxFocusChain()) {
+ 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 a68e6d3c6..347df3066 100644
--- a/focuschain.cpp
+++ b/focuschain.cpp
@@ -227,14 +227,18 @@ AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint deskt
void FocusChain::makeFirstInChain(AbstractClient *client, Chain &chain)
{
chain.removeAll(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;
+ if (options->moveMinimizedWindowsToEndOfTabBoxFocusChain()) {
+ 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);
}
- chain.prepend(client); // ... or at end of chain
} else {
chain.append(client);
}
diff --git a/kwin.kcfg b/kwin.kcfg
index 9afc7e56c..dc54f928b 100644
--- a/kwin.kcfg
+++ b/kwin.kcfg
@@ -323,6 +323,9 @@
<entry name="LayoutName" type="String">
<default>thumbnails</default>
</entry>
+ <entry name="MoveMinimizedWindowsToEndOfTabBoxFocusChain" type="Bool">
+ <default>false</default>
+ </entry>
</group>
<group name="KDE">
<entry name="AnimationDurationFactor" type="Double">
diff --git a/options.cpp b/options.cpp
index 5ef31dc91..b235803b6 100644
--- a/options.cpp
+++ b/options.cpp
@@ -122,6 +122,7 @@ Options::Options(QObject *parent)
, m_maxLatency(Options::defaultMaxLatency())
, m_minLatency(Options::defaultMinLatency())
, m_vsyncMechanism(Options::defaultVsyncMechanism())
+ , m_MoveMinimizedWindowsToEndOfTabBoxFocusChain(false)
, OpTitlebarDblClick(Options::defaultOperationTitlebarDblClick())
, CmdActiveTitlebar1(Options::defaultCommandActiveTitlebar1())
, CmdActiveTitlebar2(Options::defaultCommandActiveTitlebar2())
@@ -744,6 +745,15 @@ void Options::setVsyncMechanism(int val) {
emit vsyncMechanismChanged();
}

+void Options::setMoveMinimizedWindowsToEndOfTabBoxFocusChain(bool value)
+{
+ if (m_MoveMinimizedWindowsToEndOfTabBoxFocusChain == value) {
+ return;
+ }
+ m_MoveMinimizedWindowsToEndOfTabBoxFocusChain = value;
+
+}
+
void Options::setGlPreferBufferSwap(char glPreferBufferSwap)
{
if (glPreferBufferSwap == 'a') {
@@ -914,6 +924,7 @@ void Options::syncFromKcfgc()
setElectricBorderTiling(m_settings->electricBorderTiling());
setElectricBorderCornerRatio(m_settings->electricBorderCornerRatio());
setWindowsBlockCompositing(m_settings->windowsBlockCompositing());
+ setMoveMinimizedWindowsToEndOfTabBoxFocusChain(m_settings->moveMinimizedWindowsToEndOfTabBoxFocusChain());

setAnimationCurve(m_settings->animationCurve());
setLatencyControl(m_settings->latencyControl());
diff --git a/options.h b/options.h
index 3d7e1e520..b92ddaf64 100644
--- a/options.h
+++ b/options.h
@@ -609,6 +609,10 @@ public:
}


+ bool moveMinimizedWindowsToEndOfTabBoxFocusChain() const {
+ return m_MoveMinimizedWindowsToEndOfTabBoxFocusChain;
+ }
+
QStringList modifierOnlyDBusShortcut(Qt::KeyboardModifier mod) const;

// setters
@@ -676,6 +680,7 @@ public:
void setMaxLatency(int val);
void setMinLatency(int val);
void setVsyncMechanism(int val);
+ void setMoveMinimizedWindowsToEndOfTabBoxFocusChain(bool set);

// default values
static WindowOperation defaultOperationTitlebarDblClick() {
@@ -936,6 +941,7 @@ private:
int m_maxLatency;
int m_minLatency;
int m_vsyncMechanism;
+ bool m_MoveMinimizedWindowsToEndOfTabBoxFocusChain;

WindowOperation OpTitlebarDblClick;
WindowOperation opMaxButtonRightClick = defaultOperationMaxButtonRightClick();
--
2.30.0

Loading

0 comments on commit 8cd0efe

Please sign in to comment.