zed-industries/zed · error

window is focused by pointer

Error message

window is focused by pointer

What it means

When applying a cursor style on Wayland, the code expects a focused window under the pointer when the cursor-shape protocol is unavailable and the legacy cursor path runs; the expect fires if mouse_focused_window is None at that point, meaning cursor updates were requested without a pointer-entered window — a serial/state tracking bug.

Source

Thrown at crates/gpui_linux/src/linux/wayland/client.rs:1082

                    let serial = state
                        .serial_tracker
                        .get(SerialKind::MousePress)
                        .as_raw()
                        .max(state.serial_tracker.get(SerialKind::KeyPress).as_raw());
                    (serial != 0).then(|| (serial, state.wl_seat.clone()))
                });
                (Some(parent), popup_grab.flatten())
            }
            _ => (state.keyboard_focused_window.clone(), None),
        };

        let target_output = params.display_id.and_then(|display_id| {
            let target_protocol_id: u64 = display_id.into();
            state
                .wl_outputs
                .iter()
                .find(|(id, _)| id.protocol_id() as u64 == target_protocol_id)
                .map(|(_, output)| output.clone())
        });

        let appearance = state.common.appearance;
        let compositor_gpu = state.compositor_gpu.take();

        let (window, surface_id) = WaylandWindow::new(
            handle,
            state.globals.clone(),
            state.gpu_context.clone(),
            compositor_gpu,
            WaylandClientStatePtr(Rc::downgrade(&self.0)),
            params,
            appearance,
            parent,
            popup_grab,
            target_output,
        )?;

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Verify SerialKind::MouseEnter is tracked and cleared correctly on pointer leave
  2. Guard cursor style application on the existence of a pointer-focused window
  3. Check that set_cursor requests only come from pointer-entered surfaces
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/gpui_linux/src/linux/wayland/client.rs:1076 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/80d25d846d7b3fce. Report an issue: GitHub.