Bug 462276 - Quick-tiling from half to quarter incorrectly moves window to adjacent monitor
Summary: Quick-tiling from half to quarter incorrectly moves window to adjacent monitor
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (other bugs)
Version First Reported In: git master
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2022-11-26 16:16 UTC by Natalie Clarius
Modified: 2022-11-30 19:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Natalie Clarius 2022-11-26 16:16:35 UTC
SUMMARY
***
When a window is half-tiled on an a side that is adjacent to another screen, and a combined keyboard shortcut is invoked to quarter-tile the window on the same side, the window is incorrectly moved to the other screen.
***


STEPS TO REPRODUCE
1. Multi-monitor setup with screen A on the left and screen B on the right
2.  Quick-tile window to right half on screen A
3.  Meta+right+top to quick-tile the window to the right-top quarter

OBSERVED RESULT
Window is quick-tiled to top-right of screen B

EXPECTED RESULT
Window is quarter-tiled to top-right quarter of Screen A

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
The reason is that in https://invent.kde.org/plasma/kwin/-/blob/master/src/placement.cpp#L832, quick tiling gets invoked no matter if the combining timer has already timed out or not. This means that combined shortcuts trigger quick tiling is twice, once with only with the Right flag and once with the Right and Top flag. In the first iteration, the window is already tiled half right and gets tiled half right again, which causes https://invent.kde.org/plasma/kwin/-/blob/master/src/window.cpp#L3833 to move the window to the next screen. The next iteration with the Right and Top flags then quick-tiles the window to the top-right of the screen it is currently on, which by that time is already screen B.

I'm not sure how one would best solve this without delaying all quick tiling until the combine timer timed out, which would annoyingly make all quick tiling operations have a lag. Maybe one could delay only the screen moving until the timer timed out and then readjust the tile to that screen's geometry.

Another possibility that would be better but I'm not sure is technically possible would be to delay quick tiling until the modifier key is released.  This would also have the advantage that the window doesn't briefly get tiled to the the other half while pressing the first key in a combination (e.g. Meta+top+right would briefly tile the window to the top half before it gets tiled to the top-right quarter) and solve the problem with screen assignment, but I don't understand the shortcut system well enough to tell whether this is possible.

The bug can be worked around by pressing the arrow keys in the order such that the first key is the side that doesn't have a screen adjacent, i.e. Meta+top-right rather than Meta+right+top in the example given above, provided that there aren't screens in both directions.
Comment 1 Natalie Clarius 2022-11-26 16:19:11 UTC
Forgot the sytem info:
Operating System: Arch Linux
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.7
Kernel Version: 6.0.8-arch1-1 (64-bit)
Graphics Platform: X11