mojira.dev
MC-307253

Cursor does not consistently reset to center on Wayland.

When running Minecraft with the recently added native Wayland support, enabled using: -DMC_DEBUG_PREFER_WAYLAND,

The mouse cursor is expected to reset to the center of the screen when opening certain GUIs (e.g., pause menu, chest, inventory).

However, this behavior is inconsistent: Sometimes the cursor correctly resets to the center (as expected).

Other times it remains at its previous position instead.

Steps to reproduce:

1, A Linux installation with a Wayland compositor.

2, Launch Minecraft with,

-DMC_DEBUG_ENABLED

-DMC_DEBUG_PREFER_WAYLAND

3, Join a world or server.

4, Open the pause menu or anything that shows the mouse cursor, like a chest, the chat etc.

5, Observe the mouse cursor’s position

The cursor should always reset to the center of the screen when opening GUI screens. But the cursor only sometimes resets to the center; other times it stays where it was previously.

This behavior appears completely inconsistent/random.

Solutions:

Since you are already modernizing the game's code, consider migrating input/window handling to SDL, which provides a more stable and consistent Wayland behavior, and it's also universally compatible. Works both with Linux (Wayland and X11), MacOS, Windows. This was also mentioned as a suggestion here.

https://feedback.minecraft.net/hc/en-us/community/posts/44503913285005-Wayland-Cursor-Lock-Broken-on-Linux-Add-SDL-Input-Support-Instead-of-GLFW

Or, apply some cursor patches like they did here, https://github.com/BoyOrigin/glfw-wayland (This was also the way to unnofficialy run the game natively on Wayland before 26.1/26.1.1)

Environment

Linux (Wayland), JVM Minecraft debug flag '-DMC_DEBUG_PREFER_WAYLAND'

Comments 0

No comments.

Astr4x

(Unassigned)

Unconfirmed

(Unassigned)

26.1.1

Retrieved