[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 55585514f9.

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
This commit is contained in:
Nate Graham 2019-05-08 08:57:08 -06:00
parent db12cb6742
commit 4dd4ca8f1c
3 changed files with 17 additions and 1 deletions

View file

@ -719,6 +719,11 @@ void PresentWindowsEffect::mouseActionWindow(WindowMouseAction& action)
m_highlightedWindow->minimize();
}
break;
case WindowCloseAction:
if (m_highlightedWindow) {
m_highlightedWindow->closeWindow();
}
break;
default:
break;
}

View file

@ -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

View file

@ -208,6 +208,11 @@
<string>(Un-)Minimize window</string>
</property>
</item>
<item>
<property name="text">
<string>Close window</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
@ -252,6 +257,11 @@
<string>(Un-)Minimize window</string>
</property>
</item>
<item>
<property name="text">
<string>Close window</string>
</property>
</item>
</widget>
</item>
</layout>