diff --git a/compositor/x11/x11.mbt b/compositor/x11/x11.mbt index 4ddb328..97453fd 100644 --- a/compositor/x11/x11.mbt +++ b/compositor/x11/x11.mbt @@ -748,9 +748,17 @@ pub fn X11Window::open( let a_wm_check = self.intern("_NET_SUPPORTING_WM_CHECK") let a_pid = self.intern("_NET_WM_PID") // A window manager announces itself on the root window (EWMH); without one, take the screen. + // The property outlives a window manager that was killed, so also check that the window it + // names still exists and points at itself (EWMH). let has_wm = match self.get_prop(root, a_wm_check) { - Some(_) => true - None => false + Some(v) if v.length() >= 4 => { + let child = get32(v, 0) + match self.get_prop(child, a_wm_check) { + Some(c) if c.length() >= 4 && get32(c, 0) == child => true + _ => false + } + } + _ => false } self.session = !has_wm if self.session { @@ -1027,7 +1035,8 @@ fn X11Window::dispatch(self : X11Window, off : Int) -> Int { self.seg_attached = false self.frame_pending = false self.redraw = true - } else if self.errors_logged < 20 { + } else if self.errors_logged < 20 && !(major == 20 && err == 3) { + // (BadWindow from GetProperty is the window-manager check finding a stale window.) self.errors_logged = self.errors_logged + 1 @sys.log( "x11: X error " + diff --git a/docs/x11.md b/docs/x11.md index fb9ec95..6907007 100644 --- a/docs/x11.md +++ b/docs/x11.md @@ -59,6 +59,15 @@ nested backend speaks Wayland: no libX11 or libxcb, and the same code runs in th * **Input injection** (XTest, `xdotool`, Selkies, VNC servers) works, since it arrives as ordinary X events. +## Tested on NVIDIA + +2026-11-26 on a Vast.ai rig (GeForce GTX 1650, driver 595.91.07, the gamerig-tiny image's headless +NVIDIA Xorg on `:0`, depth 24, MIT-SHM): under Openbox with `--fullscreen`, on the whole screen +with no window manager (also after the window manager was killed and left a stale +`_NET_SUPPORTING_WM_CHECK`), following `xrandr --output DVI-D-0 --mode 1024x768`, and typing into +foot through XTest (`xdotool`, the way Selkies injects input). Not yet tried: a physical NVIDIA +desktop through a display manager. + ## Limits * **Apps don't get the NVIDIA GPU through Chandra.** Chandra composes on the CPU and its Wayland