Mojira Archive
MC-55045

Race condition in linux fullscreen toggle

LWJGL dev/contributor here.

This is about Minecraft cannot reliably enter fullscreen on linux, and about LWJGL being blamed for it.

I tried to fix this issue in LWJGL once and for all only to discover that it is in fact a Minecraft issue

You are calling Display.setFullscreen(true) when the user presses F11 (which is correct), but shortly after this you check if the window lost its focus. If Display.isActive() return false you disable fullscreen.

The problem is that switching to fullscreen can take a while and LWJGL returns false on Display.isActive() while the switching happens (during which the window is destroyed and re-created, so this is technically correct).

This leads to a race-condition where sometimes LWJGL is fast enough and the game enters fullscreen as expected and sometimes Minecraft decides the game lost focus before fullscreen is reached and switches back to window mode.

More or less related:
MC-33903
MC-19751

Related ticket in LWJGL bug tracker:
https://github.com/LWJGL/lwjgl/issues/38