Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retire the gdx-lwjgl3-glfw-awt-macos extension #7361

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

crykn
Copy link
Member

@crykn crykn commented Mar 8, 2024

Retire the gdx-lwjgl3-glfw-awt-macos extension in favour of LWJGL's own solution:

if (SharedLibraryLoader.isMac) {
    Configuration.GLFW_LIBRARY_NAME.set("glfw_async");
}

This fixes #6896, #6989, #7059. It also seems to fix #6987 and #6992, but those crashes were hard to reproduce since they only seemed to happen very rarely. I couldn't reproduce #6872, but it might be fixed by this as well.

@tommyettinger
Copy link
Member

When I tried this in gdx-liftoff, it didn't work any better than the AWT extension. I believe that was in the early days of LWJGL 3.3.3, and things may have changed, but you should try building a .jar version of the LWJGL3 tests and running it on Mac, resizing the window(s), moving them, etc. If it works for you, could you post that JAR here for other Mac users to test? I think so far the best solution is to do what Guacamole does and restart the JVM with the appropriate arguments for the platform. gdx-liftoff bundles StartupHelper with new LWJGL3 projects for this reason, which is mostly the same as the startup code in Guacamole. StartupHelper does also include some support for running on Windows when your username isn't all ASCII (which is a problem because LWJGL3 and libGDX copy DLLs into a temp directory by default, and that is normally inside the user's home dir, but libraries on Windows seem to only be load-able from ASCII paths).

Here's the gdx-liftoff commit where I reverted the code that would be added here, because there were still problems:

libgdx/gdx-liftoff@ee64596#diff-ca301a9d8cc4f9ff71a5578872faca1a77eeacbe59089cd6d661249b69311c9d

@crykn
Copy link
Member Author

crykn commented Mar 9, 2024

Since LWJGL 3.3.1 (when this was introduced and when liftoff seems to have used it) LWJGL has pushed a couple of fixes for their async lib which seem to have resolved the initial issues. The jar file of the libGDX tests is too big to upload it here, so anyone else who wants to try this will have to clone libGDX and adapt the tests with the code snippet in the PR description above. On my end (M1 macbook) everything works quite well.

Using the -XstartOnFirstThread argument (either manually or by restarting the JVM) still has one advantage: the window continues to be rendered when it is resized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment