Skip to content

Bevy caches invalid cursor settings #19627

Open
@janhohenheim

Description

@janhohenheim

Bevy version

0.16.2

What you did

Setting the cursor grab mode to Locked twice has no effect, as Bevy does not tell winit about this change when the user changes the grab mode to the same value twice.

What went wrong

There are some situations where Bevy thinks the cursor is in one state, but it is in another. A prime example is #8949. So, I want to force winit to try to lock the cursor again. However, Bevy stops me, as it thinks that the cursor is already locked. Instead, I need to first change the lock mode to a placeholder setting to clear the cache, then use the real setting.

The solution is to simply remove the caching.

Additional Information

The offending lines are around

if window.cursor_options.grab_mode != cache.window.cursor_options.grab_mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WindowingPlatform-agnostic interface layer to run your app inC-BugAn unexpected or incorrect behaviorD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions