feat(wm): drag to swap

A window the user drags with the pointer onto the tile of another window swaps
places with it, and a window let go where there is no tile goes back to its own.
It is the first thing komorebi does about what the user does with the pointer.

KWin reports the start and the end of a drag on the window
(interactiveMoveResizeStarted and Finished). The bridge sends both with the
window's frame, and the end with the position of the pointer: the window manager
asks where the pointer is right after a drag, and when the bridge does not
answer that in time, the table's last position is the one the drag ended at. The
table turns a move into MoveStart and MoveEnd; a resize raises nothing yet. The
bridge also stops asking KWin again for the position komorebi gave the window,
which is the user's now.

Where the window is let go decides the rest. On another monitor it goes there,
with its stack, in the place of the container under the pointer. With the window
container behavior Append it joins the container under the pointer instead of
swapping with it, and with the float override on it floats where it was let go.
A terminal that keeps its frame a few pixels short of its tile is not taken for
a move on its own monitor, as in the spike; the usage page says so.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:49 -07:00
1 parent 2b116ea2a3
commit f5933d1ff8
18 files changed
+1111 -26

No files matched your search

+10
View File
@@ -532,3 +532,13 @@ working without komorebi, with the settings the stock effect has:
The patches are derivative works of the effects and are under the effects' license, the GNU
General Public License version 3 ([PLATFORM.md](PLATFORM.md#the-patches)).
## Why does the end of a drag carry the position of the pointer?
A window dragged onto another tile swaps places with the window there, and one dragged onto
another monitor goes to that monitor. The window manager finds the tile and the monitor by
asking the backend where the pointer is. Only the bridge can read the pointer, so the KWin
backend asks it through the held call, and returns the last position the table has when no
answer comes within 250 ms. The end of a drag is the moment the window manager asks, and the
event that reports it brings the position of the pointer with it, so the last position the
table has is the one that counts.