mojira.dev
MC-1519

Key gets stuck when toggling fullscreen

When pressing down a key (i.e. "W") and pressing F11 to toggle fullscreen at the same time will cause the action that key handles to continue, when the key is released.

I expected the action (moving forward) to stop as I released the key.

What that actually happened was that the action (moving forward) kept on until I pressed another key.

Steps to Reproduce:
1. Press and hold down a key that performs a moving action. Do not release it.
2. Press F11
3. Release F11
4. Release the key you pressed in (1.).
5. Watch. The movement will not stop.
6. Press and release another key on your keyboard.
7. The action stops.

Code analysis

Based on 1.11 decompiled using MCP 9.35 rc1 and https://github.com/LWJGL/lwjgl on 14. December 2016

When fullscreen mode is toggled the following methods are called in this order:

  1. org.lwjgl.opengl.Display.setFullscreen(boolean)

  2. org.lwjgl.opengl.Display.destroyWindow()

  3. org.lwjgl.input.Keyboard.destroy()

  4. org.lwjgl.input.Keyboard.reset()

And org.lwjgl.input.Keyboard.reset() resets the pressed keys. Therefor the keyboard never registers that the keys which were previously pressed are unpressed now.
This can be solved in Minecraft by calling the method net.minecraft.client.settings.KeyBinding.unPressAllKeys() before returning from the method net.minecraft.client.Minecraft.toggleFullscreen().

Linked issues

MC-7185 keybord, press any key bug Resolved MC-25109 Fullscreen mode looks movement keys Resolved MC-28952 Freezing mouse (possible to switch over to another window) Resolved MC-39201 Mouse buttons stop working after activating Mission Control Resolved MC-40258 Walking while toggling full screen makes you keep walking Resolved

Comments 16

This might be a LWJGL issue and not a Minecraft one, try updating to the newest version of LWJGL and try again perhaps.

I guess this bug's scope just got wider. It also affects mouse buttons and also occurs when doing actions other than fullscreen.

And still occurring with the combination of OS X 10.9, Java 7u45, Minecraft 1.7.2.

Rafael might be right about it being LWJGL. It could also be Java itself, because there is a similar quirk in AWT/Swing where if you press the mouse on a window and release it outside the window, the application gets a mousePressed but no mouseReleased event. Applications (and frameworks) have been working around it by listening for other events. That issue itself supposed got fixed in Java 8 but I'm not sure if it got back-ported to 7.

Is this still a concern in the latest Minecraft version 14w30c? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

I can't speak for this ticket itself, but the issue I reported which was marked as a duplicate (MC-39201) appears to have been fixed some time before 14w30c. The current behaviour is that letting go of the mouse button while Mission Control is up immediately stops the mouse action, so no buttons are down on re-entering Minecraft.

6 more comments

Confirmed for 1.12

also works when you press F3 instead of F11. If your also holding space, then the player will continue both jumping and walking

argh this was a great bug and there's no alternative way in game can this be added as a feature

This can still be used by entering mission control while holding the key, like w, then letting go while in mission control, and then exiting mission control. This can be used as an exploit to auto mine by holding left click, using f3+t to reload resource packs, and letting go of left click while it is loading. This will make you keep mining, and then you can do the mission control thing to automatically walk, and you will be mining.

I don't know what you mean with "mission control", but that's a different bug. This is about actually holding a key manually and the effect (like opening/closing inventory) happening over and over.

Deuphic

Fry

Confirmed

controls, fullscreen, keyboard, lwjgl

Minecraft 1.4.2, Minecraft 1.4.7, Snapshot 13w05b, Minecraft 1.5, Minecraft 1.5.1, ..., Minecraft 16w33a, Minecraft 16w35a, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12

Minecraft 17w43a

Retrieved