rust-windowing / rust-windowing/winit
X11: outer_position() returns different value than what was set via set_outer_position()
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
Description
Summary
On X11, after calling set_outer_position(pos), both outer_position() and WindowEvent::Moved report a position offset from what was set. On my system, the Y coordinate is consistently offset by 56 pixels (the title bar height × scale factor 2).
Repro
I've created an example demonstrating this: https://github.com/natepiano/winit/blob/x11-outer-position-frame-mismatch/winit/examples/x11_outer_position_mismatch.rs
WAYLAND_DISPLAY= cargo run --example x11_outer_position_mismatch
Press 'T' to run the test. Output:
=== Test 1 ===
Calling set_outer_position(PhysicalPosition { x: 200, y: 250 })
Moved event reported (200, 306) - Y is offset by 56 pixels from what we set.
Querying positions after the move:
outer_position() = Some(PhysicalPosition { x: 200, y: 306 })
surface_position() = PhysicalPosition { x: 0, y: 0 }
On this system, every set_outer_position/outer_position cycle
adds 56 pixels to Y. With surface_position() returning (0, 0),
there's no way to determine the actual frame position.
Expected behavior
- set_outer_position(pos) sets the window position to pos
- outer_position() returns pos
- WindowEvent::Moved reports pos
Actual behavior
- set_outer_position(pos) moves the window (frame appears at the requested position visually)
- outer_position() returns pos + (0, 56)
- WindowEvent::Moved reports pos + (0, 56)
- surface_position() returns (0, 0)
Impact
Applications cannot reliably read back window positions. Any code that saves a position and later restores it will see the window drift by the title bar height on each cycle.
OS and window mananger
Operating System: Fedora Linux Asahi Remix 42 (Forty Two [Adams])
Kernel: Linux 6.17.12-400.asahi.fc42.aarch64+16k
Architecture: arm64
Window Manager: KWin
Winit version
0.31.0-beta.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked examples/x11_outer_position_mismatch.rs and run WAYLAND_DISPLAY= cargo run --example x11_outer_position_mismatch to reproduce the offset. Then trace the X11 implementations of set_outer_position(), outer_position(), and WindowEvent::Moved; done means the reported and queried outer position match the position passed to set_outer_position().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100