https://bugs.kde.org/show_bug.cgi?id=527821
Bug ID: 527821
Summary: Scripting: expose a window's requested geometry, so a
script can tell a stale committed frame from the
window's real geometry
Classification: Plasma
Product: kwin
Version First 6.7.5
Reported In:
Platform: Fedora RPMs
OS: Linux
Status: REPORTED
Severity: wishlist
Priority: NOR
Component: scripting
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
KWin scripts can read a window's committed geometry (frameGeometry,
clientGeometry, bufferGeometry) and the requested tile (Window.tile reads
requestedTile()). They cannot read the requested geometry
(moveResizeGeometry()) or whether a configure is still outstanding. Because
Wayland geometry changes are asynchronous, a script cannot tell a frame the
client is about to replace from the window's real geometry.
This matters for window placement memory scripts, which save a window's
floating geometry when it closes and restore it on the next open (the wish in
bug 15329). We maintain such a script in Plasma Fusion:
https://github.com/archledger/plasma-fusion/tree/main/packages/kwin/scripts/plasmafusion-placement
STEPS (legal xdg-shell order: a client may acknowledge a configure and commit
later)
1. A floating window sits at A = (73,91,430,310). The script records A, since
Window.tile is null.
2. The window is tiled (Tile.manage). KWin sends a configure for the tile size.
3. The client acknowledges that configure but has not committed yet.
4. The window is untiled (Tile.unmanage). KWin sends a configure for A, and
Window.tile is now null.
5. The client commits the acknowledged tile-size buffer.
6. The window closes before answering the configure for A.
OBSERVED
After step 5 the script sees a window that is not tiled, with frameGeometry
(144,128,792,512), the superseded tile frame. It records that as the window's
floating place, so the next open would restore the window at the tile size. If
the client answers the configure for A before closing, the wrong value is
corrected, but it was still recorded for a moment.
Reproduced on KWin 6.7.5 and 6.7.91 (Qt 6.11.2, Fedora), in otherwise stock
virtual-backend sessions (kwin_wayland --virtual), with a controlled xdg-shell
client that acknowledges and commits on command. The tiling and untiling were
done by a small in-process test plugin calling Tile::manage() and
Tile::unmanage(), the same calls scripts have. Checked against master at
62222dbf: Window still has no such property.
EXPECTED
A script can tell that the committed frame is not the geometry KWin has
requested, and skip it until the client catches up, without guessing with
timers.
PROPOSAL (names illustrative)
Either would be enough:
1. A read-only Window.requestedGeometry property, backed by
moveResizeGeometry(), with a change signal. A script treats the window as
settled when frameGeometry equals it.
2. A read-only Window.geometryPending boolean with a change signal, true while
a geometry-changing configure has not been acknowledged and committed.
Option 1 is the smaller change and exposes an existing accessor. Both are
additive and read-only. It would also help the asynchronous-geometry case
discussed in bug 469834, where a script needs the requested rather than the
committed geometry.
I can prepare a merge request for option 1, with an integration test that holds
a Test::XdgToplevel through steps 2 to 5 and checks the property until the
restore commit, if this direction is acceptable.
--
You are receiving this mail because:
You are watching all bug changes.