Repository navigation
Description
Windows build number:
Microsoft Windows [Version 10.0.26300.9818]
Your Distribution version:
Ubuntu 22.04.5 LTS
Your WSL versions:
WSL version: 3.0.3.0
Kernel version: 6.18.54.1-1
WSLg version: 1.0.79
MSRDC version: 1.2.7391
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26300.9818
Steps to reproduce:
I found this with a JUCE app (AgIsoVirtualTerminal). Its window moves 32 px up and left every time a menu or dialog opens. The same app doesn't move on native Windows. I could reproduce the offset with a plain Xlib script, so it is not toolkit specific.
-
pip install python-xlib -
Run this script:
import time
from Xlib import X, Xatom, displayd = display.Display()
s = d.screen()
root = s.rootw = root.create_window(0, 0, 400, 300, 0, s.root_depth, background_pixel=s.white_pixel)
w.set_wm_name("frame-extents-repro")
w.map()
d.sync()
time.sleep(1.5)left, right, top, bottom = w.get_full_property(d.intern_atom("_NET_FRAME_EXTENTS"), Xatom.CARDINAL).value
print(f"_NET_FRAME_EXTENTS left={left} right={right} top={top} bottom={bottom}")def client_origin():
d.sync()
t = w.translate_coords(root, 0, 0)
return -t.x, -t.ywant_x, want_y = 300, 300
w.configure(x=want_x, y=want_y)
d.sync()
time.sleep(1)
x, y = client_origin()
print(f"configure({want_x}, {want_y}) -> client at ({x}, {y}), offset ({x - want_x:+d}, {y - want_y:+d})")w.configure(x=want_x - left, y=want_y - top)
d.sync()
time.sleep(1)
x, y = client_origin()
print(f"configure({want_x - left}, {want_y - top}) (minus extents) -> client at ({x}, {y}), offset ({x - want_x:+d}, {y - want_y:+d})")
WSL logs:
No response
WSL dumps:
No response
Expected behavior:
If I move a window by the _NET_FRAME_EXTENTS the window manager reports, the client should end up where I wanted it.
Actual behavior:
Output on my machine:
_NET_FRAME_EXTENTS left=38 right=38 top=59 bottom=38
configure(300, 300) -> client at (306, 327), offset (+6, +27)
configure(262, 241) (minus extents) -> client at (268, 268), offset (-32, -32)
So the client is placed at +6, +27 from the position I ask for, but the extents say 38, 59. The difference is exactly 32 px on each axis.
I think the extents include the 32 px transparent shadow margin of the Weston frame (theme->margin, see microsoft/weston-mirror#178), but the window is not placed with that margin.
Toolkits use the extents to convert between the client position and the frame position. JUCE does this when it re-sends the window position after it rebuilds its paint buffer, for example after a dialog opens. Each time the window moves 32 px up and left, and it adds up (x went 533, 501, 469, 437, 405 over four dialogs). I checked with gdb on XMoveResizeWindow and there is only one call per dialog, so the app is not moving it by itself.
This looks related to the shadow being part of the window, like in #1008 and #1050. Is the shadow margin supposed to be part of _NET_FRAME_EXTENTS? If yes, I think the client should be placed 38, 59 from the requested position and not 6, 27.
Activity