Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jme3-examples/src/main/java/jme3test/awt/TestCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ public void windowClosed(WindowEvent e) {
@SuppressWarnings("unchecked")
public static void createCanvas(String appClass){
AppSettings settings = new AppSettings(true);

// Note: Only for Linux and Wayland platforms, forces you to
// use XWayland (x11) with awt.
settings.setX11PlatformPreferred(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While the PR description explains the reason for this change, it would be beneficial to add a comment here in the code. This example serves as a reference for users, and a comment would clarify why this setting is necessary for AWT canvas integration on platforms like Wayland.

Suggested change
settings.setX11PlatformPreferred(true);
// On Linux with Wayland, AWT/Swing requires an X11 context.
// This forces the jME context to use X11 (via GLX) to be compatible.
settings.setX11PlatformPreferred(true);

settings.setWidth(640);
settings.setHeight(480);

Expand Down
Loading