Skip to content

X11: outer_position() returns different value than what was set via set_outer_position() #4445

@natepiano

Description

@natepiano

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedDS - x11Affects the X11 backend, or generally free Unix platforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions