Setting cursor position on same frame as locking cursor fails.

Abierto
#26,397 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
linux, rust
Área
desktop

Línea de trabajo

The failing call is the window cursor-position update in bevy_winit, which runs in the changed_window and changed_cursor_options systems; the issue suggests their order matters. Read those systems in the bevy_winit crate and reproduce the picking-observer scenario on Linux/Wayland. Done means setting the cursor position and the Locked grab mode in the same frame no longer logs the 'cursor position can be set only for locked cursor' error and the cursor actually moves.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

A-Windowing C-Bug D-Straightforward S-Needs-Investigation

Bevy version and features

  • Bevy 0.19.1

Relevant system information

  • Linux

What you did

// window is Query<(&mut Window, &mut CursorOptions)>

let Ok((mut window, mut cursor)) = window.get_mut(event.entity) else {
    return;
};
let mid_position = window.size() * 0.5;
window.set_cursor_position(Some(mid_position));
cursor.grab_mode = CursorGrabMode::Locked;

This is happening in a picking observer (so not at startup).

What went wrong

2026-11-01T19:42:06.399277Z ERROR bevy_winit::system: could not set cursor position: os error at /.../winit-0.30.13/src/platform_impl/linux/wayland/window/state.rs:951: cursor position can be set only for locked cursor.

Setting the grab mode on the same frame as setting the cursor position fails to move the cursor!

Additional information

It might be sufficient to just change the order of the changed_window and changed_cursor_options systems.

Lenguaje dominante
Rust
Estrellas
49.7k
Forks
5k
Merge medio
3 d 19 h
PR fusionados (30 d)
134

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bevyengine/bevy

Todos los issues de bevyengine/bevy

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.