From 4dd4ca8f1c44226e0b2fc5e32ca911cc06402480 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Wed, 8 May 2019 08:57:08 -0600 Subject: [PATCH] [effects/presentwindows] Allow closing windows on middle-click Summary: Plasma's Task manager exposes an optional feature whereby the user can middle-click on a window to close it, but the Present Windows effect does not do the same. The presence of a close button you can left-click does not replace the desirable feature to be able to middle-click on a window to close it, because then the whole window becomes a click target, so it can be much much faster than having to aim for the little close button. Also it's off by default, so a user who goes out of their way to turn it on is signaling that they want to accept the risk of accidentally closing a window by accident. Finally, the feature is not allowed for left-click, so people can never accidentally wreck Present Windows for themselves by assigning it to left-click by accident and then mistakenly closing their windows. This reverts commit 55585514f926d1251148e876bfe9ce3504432997. FEATURE: 321190 FIXED-IN: 5.17.0 Test Plan: Set "Close window" in the Present windows effect, trigger effect, and middle-click on window {F6815303} Reviewers: #kwin, davidedmundson, broulik, zzag, #plasma, hein, mart Reviewed By: #kwin, #plasma, mart Subscribers: mart, abetts, apol, zzag, luebking, kossebau, graesslin, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D21083 --- effects/presentwindows/presentwindows.cpp | 5 +++++ effects/presentwindows/presentwindows.h | 3 ++- effects/presentwindows/presentwindows_config.ui | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index cfce07281a..cf92a5be69 100644 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -719,6 +719,11 @@ void PresentWindowsEffect::mouseActionWindow(WindowMouseAction& action) m_highlightedWindow->minimize(); } break; + case WindowCloseAction: + if (m_highlightedWindow) { + m_highlightedWindow->closeWindow(); + } + break; default: break; } diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h index 6e95bdada9..9f2c21fa1f 100644 --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -149,7 +149,8 @@ public: WindowExitAction = 2, // Deactivates the effect without activating new window WindowToCurrentDesktopAction = 3, // Brings window to current desktop WindowToAllDesktopsAction = 4, // Brings window to all desktops - WindowMinimizeAction = 5 // Minimize the window + WindowMinimizeAction = 5, // Minimizes the window + WindowCloseAction = 6 // Closes the window }; enum DesktopMouseAction { DesktopNoAction = 0, // nothing diff --git a/effects/presentwindows/presentwindows_config.ui b/effects/presentwindows/presentwindows_config.ui index 54bb80e18f..acd8730370 100644 --- a/effects/presentwindows/presentwindows_config.ui +++ b/effects/presentwindows/presentwindows_config.ui @@ -208,6 +208,11 @@ (Un-)Minimize window + + + Close window + + @@ -252,6 +257,11 @@ (Un-)Minimize window + + + Close window + +