Support for switching platforms (from Wayland EGL to X11 GLX)
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.
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.
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.
@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.
Hi @JNightRider thanks for this PR and for quickly addressing reviews! If everything is ready, then I'll merge this PR in the next couple of days. (I meant to merge it for alhpa2 a few days ago, but it got lost amongst many others and I've had a busy week, so I apologize for the delay)
If everything is ready, then I'll merge this PR in the next couple of days
With this final confirmation (to add a message to users indicating whether the changes have been applied to the platform), you should be all set!
Thank you for your patience.