mojira.dev
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

Related issues

Comments

CubeTheThird

Thank you for the detailed explanation. This very accurately describes the behaviour I experience when putting the game in full screen on Linux.

migrated

Please someone work on this! Most annoying bug in the game atm :/

EDIT: Still there in 14w29b.
EDIT2: Still there in 14w30b.
EDIT3: And btw, this does not only affect Archlinux, but literally every Linux distribution.
EDIT4: Still there in 14w30c. This bug affects every Linux-desktop with a compositor.

migrated

Updated Environment to make clear most linux desktops are affected.
Still present in 14w31a

migrated

A note to the devs: It is probably a good idea to upgrade LWJGL to 2.9.2 (nightly).
There are some important fixes in there also related to linux fullscreen. (the one this ticket is about is still a minecraft bug, though)

Also, still there in 14w34a

Erik Broes

I've removed the whole 'when we're not active please toggle fullscreen'-bunch of code. I cannot really see a reason for it to be there :/

I really hope this doesn't break something badly but we'll see 😃

The race condition should at least be gone now.

migrated

Confirmed, 14w34d works.

migrated

There is a serious problem with this fix on Ubuntu 14.04 using the default Unity compositor.
When I am running Minecraft in fullscreen and I press my volume up-down / mute or PrtScrn (not the Minecraft F2 screenshot key), Minecraft will leave FS mode to show the Notify OSD message box or screenshot dialogue. It is now impossible to return to Minecraft. Minecraft is still running, but the only option is to kill the process.

Previous versions pre 14w34d, would leave fullscreen, show the notification or dialogue, then I can press F11 to return to fullscreen mode.

Would be better if when the volume / mute keys did not exit fullscreen mode, and show the notification as normal.

CubeTheThird

@Arthur,
I'm not sure if the issue is exactly the same using Gnome Shell, but when I do things such as changing the volume, the notification comes up, and the window disappears. To restore it, a simple Alt + Tab works for me.

migrated

No, when I alt-tab, the unity-compiz compositor tries to full screen Minecraft, as i can see the zoom effect, but then I'm just left with the desktop.

If I volume up-down on the Minecraft title screen, I can use the Unity launcher icon to quit Minecraft, but if I volume up-down whilst in the game, this does not work, and I have to kill the minecraft process using the command line.

migrated

This is still a problem in 1.8. New bug opened ( MC-70651 ). Fullscreen only works approximately every third time.

migrated

Same problem. Latest version of OpenJDK on Ubuntu 14.04 64-bit.

migrated

I'm running Ubuntu Linux 16.04, kernel version 4.4.0-62-generic, 64 bit.
Minecraft 1.11.2.

I can start the game in full-screen reliably.
If I leave the window for any reason, when I come back the window is either minimized or all black. Once I'm in this mode it's tricky to get back to the normal game display. (I can do Alt-tab to return to the game. I can also use the command line to kill the process and restart it.)

Steps to reproduce:
1. command line: java -cp ./Minecraft.jar net.minecraft.bootstrap.Bootstrap
2. Wait for game to load. (The screen with options for single player, multiplayer, realms, etc. Or playing the single-player game.)
3. Leave the window or minimize it. Examples: (a) switch to another window in the window manager, then return to this window. (b) use media keys to change volume, which is MC-69793. (c) use my laptop's keyboard controls to change display brightness.
The common thread seems to be that I'm either switching away from the window or overlaying something on top of the current window, which means Minecraft no longer has exclusive control of the display.

Note: the sound is unaffected and continues normally.

IMHO this issue should be reopened and MC-69793 should be marked as a duplicate of this one. Thanks for reading my report and please fix the bug!

migrated

I don't think that's the same issue, please create a new ticket for this.

migrated

Erik Broes

Confirmed

Minecraft 1.7.9, Minecraft 14w19a, Minecraft 14w25b, Minecraft 1.7.10, Minecraft 14w28b, ..., Minecraft 14w32a, Minecraft 14w32b, Minecraft 14w34a, Minecraft 14w34b, Minecraft 14w34c

Minecraft 14w34d

Retrieved