Skip to content

fix(linux): align Wayland window_actions and X11 fullscreen/maximized WM state with GTK4 - #2293

Merged
Hona merged 1 commit into
devfrom
fix/313-wm-state-live-fixes
Nov 25, 2026
Merged

Hona merged 1 commit into
devfrom
fix/313-wm-state-live-fixes

Conversation

@Hona

@Hona Hona commented Nov 25, 2026

Copy link
Copy Markdown
Member

Refs #313

Addresses all five items from live testing #2283 on GNOME Shell 50.1 (Ubuntu 26.04, Wayland and XWayland). No vendor/winit.patch change is needed.

Changes

  1. Wayland half-tiles missing side edge — documented protocol limit (crates/rune/src/runtime/cx.rs, crates/rune/README.md, crates/rune/src/window/chrome/linux_wm_state_tests.rs):
    • Verified in GNOME/mutter (src/wayland/meta-wayland-xdg-shell.c, fill_states) that Mutter sends XDG_TOPLEVEL_STATE_TILED_* directly from window->edge_constraints, and in ubuntu/Tiling-Assistant (tilingWindowManager.js) that Ubuntu's default extension half-tiles via window.set_maximize_flags(VERTICAL) while skipping override_constraints, so Mutter only sends TILED_TOP | TILED_BOTTOM (confirmed by Wayland maximize already reporting all four edges through the same sctk/winit path).
    • Both GTK4 (gdk/wayland/gdktoplevel-wayland.c) and Chromium (ui/ozone/platform/wayland/host/wayland_window_unittest.cc) pass through the compositor's TILED_* states verbatim with zero position guessing (Wayland hides global window position). Documented this limit in Cx::tiled_edges() and crates/rune/README.md.
  2. Wayland window_actions().maximize on non-resizable windows (crates/rune/src/window/chrome/linux_wm_state.rs):
    • xdg_toplevel.wm_capabilities reports compositor capabilities, not per-window resizability (Mutter sends all four unconditionally before initial configure).
    • Combined compositor WM_CAPABILITIES_MAXIMIZE with window.is_resizable() && window.enabled_buttons().contains(WindowButtons::MAXIMIZE), matching GTK4 (gtk/gtkwindowcontrols.c, update_window_buttons), so non-resizable Wayland windows report maximize: Some(false) (agreeing with X11 and GNOME refusing Super+Up) while keeping fullscreen: Some(true) where the compositor allows it.
  3. Wayland window_actions().close (crates/rune/src/window/chrome/linux_wm_state.rs, crates/rune/src/window/wm_state.rs):
    • Reports Some(window.enabled_buttons().contains(WindowButtons::CLOSE)) (Some(true) on normal configured toplevels, None before initial configure or for overlays), matching GTK4's deletable property (gtk/gtkwindowcontrols.c) and X11 so one title bar works identically on both backends. Documented what None means for each WindowActions field.
  4. X11 titled window decoration_mode() in and right after full screen (crates/rune/src/platform/x11/wm_state.rs, crates/rune/src/window/chrome.rs, crates/rune/src/runtime/system_settings.rs):
    • In full screen on X11, mutter-x11-frames collapses frame borders to [0, 0, 0, 0], and right after leaving full screen _NET_WM_STATE_FULLSCREEN clears before _NET_FRAME_EXTENTS is asynchronously restored to [0, 0, 37, 0].
    • decode_frame_extents now preserves the prior confirmed non-fullscreen DecorationMode during full screen and across the 1-frame asynchronous restore while the titled window remains reparented in its WM frame (keeping window_actions().maximize == Some(false) in full screen as Mutter reports).
  5. X11 titled window tiled_edges() while maximized (crates/rune/src/platform/x11/wm_state.rs):
    • Always reads _GTK_EDGE_CONSTRAINTS from the reparented parent frame (priv->frame->xwindow) when has_wm_frame is true and prefers it over any stale pre-frame client property, and reports Some(TiledEdges::ALL) when _NET_WM_STATE has both MAXIMIZED_HORZ and MAXIMIZED_VERT — matching GTK4, Mutter's update_edge_constraints, Chromium's X11Window::GetTiledState, borderless X11, and Wayland.

Verification

  • Added live GNOME 50.1 fixtures in crates/rune/src/window/chrome/linux_wm_state_tests.rs and crates/rune/src/platform/x11/wm_state_tests.rs.
  • Passed on Windows (unit tests, doctests, cargo check-wasm, cargo check-webgl, cargo lint-wasm, cargo lint-webgl, cargo clippy), macOS (46 unit tests covering window::chrome::, window::wm_state::, platform::x11::wm_state::, runtime::input::titlebar::, plus check and clippy), and Linux container (check -p rune -p rune-kit --examples --benches --tests and clippy -p rune --lib --bins --tests --example custom_titlebar).
  • Not run live: no live Wayland or X11 desktop session here; Linux container checks compiled all tests and examples (full rune lib test linking in the container hits OOM).

@Hona
Hona merged commit cb2f500 into dev Nov 25, 2026
1 check passed
@Hona
Hona deleted the fix/313-wm-state-live-fixes branch November 25, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant