Bug 383434

Summary: Maximized window button behavior should also apply to tiled windows
Product: [Plasma] Breeze Reporter: Nate Graham <nate>
Component: window decorationAssignee: Hugo Pereira Da Costa <hugo.pereira.da.costa>
Status: RESOLVED FIXED    
Severity: wishlist CC: hugo.pereira.da.costa, kwin-bugs-null, simonandric5
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screen recording showing the issue

Description Nate Graham 2017-08-12 17:39:25 UTC
CONFIGURATION:
Kwin 5.9.4 on Kubuntu 17.04


SUMMARY:
When a window is maximized, the buttons in the top-left and top-right corners get their click areas extended so that they can easily be triggered by a click in the screen's corner pixels. This behavior should also apply to windows that are tiled.


STEPS TO REPRODUCE:
1. Maximize a window
2. Slam your cursor into the top-right corner of the screen and click
3. Observe that the close button is triggered and the window closes, even though the cursor was a few pixels away from the close button (thereby correctly taking advantage of Fitt's Law https://en.wikipedia.org/wiki/Fitts's_law)
4. Tile a window so that it takes up the right side of the screen or the top-right corner and the close button is in the same place as it would be if the window was maximized
5. Slam your cursor into the top-right corner of the screen and click


EXPECTED RESULTS:
The close button is triggered and the window closes, just as if it were maximized.


ACTUAL RESULTS:
The close button is not triggered, because its click area is not extended to cover the corner pixel. Instead a window resize operation begins.
Comment 1 Martin Flöser 2017-08-12 20:28:00 UTC
Which window decoration are you using?
Comment 2 Nate Graham 2017-08-12 21:52:16 UTC
The standard set of buttons with the Breeze theme/window decoration.
Comment 3 Nate Graham 2017-08-12 22:05:03 UTC
Created attachment 107239 [details]
Screen recording showing the issue

I'm attaching a screen recording in case my description is unclear.
Comment 4 Hugo Pereira Da Costa 2017-08-13 17:54:50 UTC
Hi, 
Thanks for posting the suggestion, it is a valid point.

I have code here that adds the requested feature, but (and this is why I re-add kwin in cc):

1/ for buttons on the left, it does not work, never did it seems, because there seems to be a "dead" one pixel on the side. (also true with plastique, and any decoration I have tested)

2/ for buttons on the right, it works, except that if you put the cursor in the top right corner, although the button appears hovered (and react as it should on press), the mouse cursor is still changed to the "diagonal" one, indicating that you could "resize" the window (which you cant)
As far as I know, which cursor is drawn in which location is handled by kwin (or kdecoration2), not by the decoration itself, so I have no control over this. Martin: can you have a look ? 

If that helps I can commit the code I have written, even if imperfect.

Best,

Hugo
Comment 5 Nate Graham 2017-08-13 17:58:17 UTC
Hi Hugo,
Thanks for working on this! Feel free to post your patch on phabricator for review and suggestions.

https://phabricator.kde.org/