mojira.dev
MC-263368

Cursor Position is not set correctly in the center of the window after resize

steps to reproduce:

  • make game window unmaximized

  • load up world

  • when in world before pausing or opening any other screens, maximize game window

  • open inventory

or

  • load up world

  • turn pause on lost focus off

  • alt-tab to another window

  • move cursor position

  • alt-tab back in

  • open inventory

you will see that the cursor is somewhere up and to the left of the center of the screen.

code analysis (credit: jojoe77777):

this is caused by InputMappings$grabOrReleaseMouse calling GLFW$glfwSetInputMode before calling GLFW$glfwSetCursorPos. If these calls are reversed and glfwSetCursorPos is called first, the cursor is placed as expected in both cases to reproduce as outlined above.

This bug was introduced sometime between 1.13.2 and 1.14.0 per my testing, which makes a lot of sense.

Comments 3

Do either MC-150164 or MC-261980 describe your issue?

Yes sorry, it's an extension of MC-150164 with additional situations. I thought I searched "cursor position" and didn't see any, interesting.

Can confirm in 24w21b and 1.20.6.

tildejustin

(Unassigned)

Confirmed

Platform

Low

UI

1.20, 1.20.1 Release Candidate 1, 1.20.1, 1.20.6, 24w21b, 1.21.4, 1.21.7 Release Candidate 2

Retrieved