Skip to content

Support for switching platforms (from Wayland EGL to X11 GLX) #2500

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

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

Conversation

JNightRider
Copy link
Contributor

PR where support is implemented to change the default GLFW platform on Linux distributions or derivatives that support Wayland to use X11 (enable GLX).

This will open the ability to reposition windows and set icons for them, as Wayland currently does not have support for this, this works if you have XWayland enabled to have a bridge.

Wayland uses EGL by default to create GL contexts, which is great, but sometimes we need to use GLX for our applications, which is very useful. XWaylanda for GLX context.

@yaRnMcDonuts yaRnMcDonuts added this to the v3.9.0 milestone Jun 16, 2025
@riccardobl
Copy link
Member

nice, i suggest to change the setting to

  • setPreferX11Session(boolean) : prefer x11 session when possible

i think "native platform" is not very self explanatory.
This also makes clear that jme will "try" but not guarantee an x11 session if x11 is not available.

@capdevon
Copy link
Contributor

capdevon commented Jun 17, 2025

        if (glfwPlatformSupported(GLFW_PLATFORM_WAYLAND)) {
            /*
             * Change the platform GLFW uses to enable GLX on Wayland as long as you 
             * have XWayland (X11 compatibility)
             */
            if (!settings.isNativePlatform() && glfwPlatformSupported(GLFW_PLATFORM_X11)) {
                glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
            }
        }

The code snippet explicitly checks for X11 compatibility within a Wayland platform.
The method name should reflect this specific check.

So, settings.isX11PlatformPreferred() and settings.setX11PlatformPreferred(boolean) would be a significant improvement.

@JNightRider
Copy link
Contributor Author

@riccardobl , @capdevon . Thank you for your suggestions and for reviewing this PR.

In the end I think setX11PlatformPreferred() would be a better name for this option when enabling GLX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants