rust-windowing / rust-windowing/winit

X11: Missing Moved event when window manager moves+resizes window together

Open
#4,443 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

B - bug DS - x11
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

Description

On KDE Plasma (X11), when the window manager moves and resizes a window via keyboard shortcuts (Meta+Arrow snap/tile), winit emits SurfaceResized but not Moved, even though the window position changed.

This may affect other X11 window managers that send real (non-synthetic) ConfigureNotify events for move+resize operations. Per ICCCM, WMs should send synthetic ConfigureNotify, but KDE appears to send real ones for keyboard snap operations.

Reproduction

git clone https://github.com/natepiano/winit.git
cd winit
WAYLAND_DISPLAY= cargo run --example x11_missing_move_on_resize
  1. Use keyboard snap (KDE: Meta+Arrow)
  2. Bug is detected: SurfaceResized fires but Moved does not

Expected Behavior

Moved event should be emitted when the window position changes.

Actual Behavior

Moved is only emitted for synthetic ConfigureNotify events. Real ConfigureNotify events never emit Moved.

Root Cause

In winit-x11/src/event_processor.rs, the configure_notify handler (~line 611-626):

let moved = if is_synthetic {
      util::maybe_change(&mut shared_state_lock.inner_position, new_inner_position)
  } else {
      // ...
      false  // Real events never emit Moved
  };

Suggested Fix

For real ConfigureNotify events, query the root-relative position using translate_coords_root() (which outer_position() already uses), compare against the cached position, and emit Moved if it changed.

Workaround

Query window.outer_position() after SurfaceResized events.

OS and window mananger
  • OS: Asahi Linux (Fedora 42) on Apple Silicon
  • Window Manager: KDE Plasma (X11 via XWayland)
Winit version

0.31.0-beta.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in winit-x11/src/event_processor.rs at the configure_notify handler around lines 611–626, then inspect outer_position() and translate_coords_root(). Reproduce with examples/x11_missing_move_on_resize on KDE X11 and verify that a move+resize ConfigureNotify emits both SurfaceResized and Moved when the root-relative position changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.