rust-windowing / rust-windowing/winit

configure_window(ABOVE) after map_window prevents focus on Cinnamon X11

Open Beginner friendly
#4,479 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

On Cinnamon's window manager (Muffin), winit windows do not receive focus when mapped. This affects all winit-based applications on Cinnamon X11 (e.g. alacritty — see alacritty/alacritty#8832).

Root Cause

When mapping a window, winit calls configure_window(stack_mode: ABOVE) immediately after map_window, both in set_visible(true) and during initial window creation:

https://github.com/rust-windowing/winit/blob/v0.30.12/src/platform_impl/linux/x11/window.rs#L1137-L1145

self.xconn.xcb_connection().map_window(self.xwindow)...;
self.xconn.xcb_connection().configure_window(
    self.xwindow,
    &xproto::ConfigureWindowAux::new().stack_mode(xproto::StackMode::ABOVE),
)...;

This mimics XMapRaised. Muffin interprets the configure_window(ABOVE) as a focus-steal attempt and suppresses focus for the window.

Verification

Minimal reproduction with raw Xlib calls confirms the issue:

  • XMapWindow alone → window receives focus ✓
  • XMapWindow + XConfigureWindow(CWStackMode, Above) → window does not receive focus ✗

Building alacritty against a patched winit with the configure_window(ABOVE) removed from set_visible fixes the issue completely.

Suggested Fix

Remove the configure_window(ABOVE) call after map_window. It is redundant for new windows — newly mapped windows already appear at the top of the stack by default per ICCCM. The same code path exists in both set_visible(true) (line 1139) and initial window creation (line 510).

Related

This is a continuation of #1160 / #1176, which removed an XSetInputFocus call that was also causing focus-stealing. The configure_window(ABOVE) was left in place at the time.

Environment

  • Cinnamon 6.6.6 (Muffin window manager)
  • Linux Mint 22.3 / X11
  • winit 0.30.12

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 src/platform_impl/linux/x11/window.rs at the window-creation code around line 510 and set_visible(true) around line 1139. Compare the map_window and configure_window(ABOVE) calls with the reported raw Xlib reproduction. Done means the redundant ABOVE configuration is removed from both paths and Cinnamon X11 windows receive focus when mapped.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.