Setting cursor position on same frame as locking cursor fails.

オープン
#26,397 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
linux, rust
領域
desktop

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
49.7k
フォーク
5k
平均マージ
3日 19時間
マージ済み PR(30日)
134

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bevyengine/bevy のほかの issue

bevyengine/bevy の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。