Bug 387273 - rotating a widescreen resolution should rotate the half-screen tiling snap
Summary: rotating a widescreen resolution should rotate the half-screen tiling snap
Status: ASSIGNED
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: 5.11.3
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Harald Sitter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-24 17:03 UTC by Harald Sitter
Modified: 2017-11-28 09:57 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
video (2.89 MB, video/x-matroska)
2017-11-24 17:03 UTC, Harald Sitter
Details
picture (41.00 KB, image/png)
2017-11-24 17:04 UTC, Harald Sitter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2017-11-24 17:03:44 UTC
Created attachment 109042 [details]
video

(video attached for illustration; also full disclosure: I have no clue if kwin is actually at fault here, may be kscreen for all I know)

kwin has the handy tiling feature that when dragging a window to a side of the screen you can snap it into a reasonable place depending on where you drag it.

by default we snap all-left, all-right and four corners. which is lovely under the assumption that a screen has more width than height.
when rotating a 16:9 secondary screen 90 degrees (using kscreen; on x11) this becomes awkwardly unsuitable though.
when rotated the most space efficient usage would be all-top, all-bottom and four corners as the screen is now much high than wide.

more generally put: the midline fold should always be on the longest axis of the screen, currently it is always on the X axis which is wrong when the screen is rotated as you'd then snap a super tall, albeit way too narrow window.

I am also going to add a quick drawing to show what I think this should look like.
Comment 1 Harald Sitter 2017-11-24 17:04:15 UTC
Created attachment 109043 [details]
picture
Comment 2 Martin Flöser 2017-11-24 22:10:54 UTC
I don't think we have sufficient information for that.
Comment 3 Harald Sitter 2017-11-25 00:13:57 UTC
I was assuming you'd at least know the (rotated) screen resolution. The way I see it you would need to `if maxX>=maxY then splitHorizontal else splitVertical` and the split would always yield smart space usage. The fact that the screen is rotated doesn't really matter in the end, you only need to know the "aspect orientation", for lack of a better word, and that can easily be checked through the resolution.
Comment 4 Martin Flöser 2017-11-25 05:46:23 UTC
If you are interested, you could try to implement yourself. We have a complete test coverage for quick tiling in autotest/integration/test_quick_tiling.cpp and implementation should be in geometry.cpp
Comment 5 Harald Sitter 2017-11-28 09:57:58 UTC
The pertinent logic actually seems to live in `AbstractClient::checkQuickTilingMaximizationZones`.

I do have some code which implements the alternate logic but it is fairly spaghetti. I'll have to think about it a bit more.

I also found the existing code rather meh to read because of the manual border checking, so I was thinking about QRecting the entire thing until I realized that the current method operates on the maximized size of the client (i.e. excluding the panel) which made qrect rather unusable unless one extends them well beyond the maximized area coordinates so as to cover potential panels on each side.

All fairly meh.