-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Unified method for detecting a Wayland session #2848
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
base: master
Are you sure you want to change the base?
Changes from all commits
4b897ee
5df37f4
bf77ed6
9000136
6b3faa1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2009-2021 jMonkeyEngine | ||
| * Copyright (c) 2009-2026 jMonkeyEngine | ||
| * All rights reserved. | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
|
|
@@ -159,13 +159,13 @@ public boolean isDeviceRumbleSupported() { | |
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public void rumble(float amountHigh, float amountLow, float duration) { | ||
| } | ||
|
|
||
| public final AssetManager newAssetManager(URL configFile) { | ||
| return new DesktopAssetManager(configFile); | ||
| } | ||
| @Override | ||
| public void rumble(float amountHigh, float amountLow, float duration) { | ||
| } | ||
| public final AssetManager newAssetManager(URL configFile) { | ||
| return new DesktopAssetManager(configFile); | ||
| } | ||
|
|
||
| public final AssetManager newAssetManager() { | ||
| return new DesktopAssetManager(null); | ||
|
|
@@ -309,6 +309,14 @@ public Platform getPlatform() { | |
| } | ||
| } | ||
|
|
||
| public boolean isWaylandSession() { | ||
| // The following matches the test GLFW does to enable the Wayland backend. | ||
| if ("wayland".equalsIgnoreCase(System.getenv("XDG_SESSION_TYPE")) && System.getenv("WAYLAND_DISPLAY") != null) { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
Comment on lines
+312
to
+318
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The public boolean isWaylandSession() {
try {
Platform platform = getPlatform();
if (platform == Platform.Linux64 || platform == Platform.Linux_ARM64) {
return "wayland".equalsIgnoreCase(System.getenv("XDG_SESSION_TYPE"))
&& System.getenv("WAYLAND_DISPLAY") != null;
}
} catch (SecurityException | UnsupportedOperationException e) {
// Safe fallback for restricted environments or unsupported platforms
}
return false;
}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Users must first determine which platform they are on and then use this method: if (JmeSystem.getPlatform().getOs() == Platform.Os.Linux) {
if (JmeSystem.isWaylandSession()) {
...
}
}Since |
||
|
|
||
| public String getBuildInfo() { | ||
| StringBuilder sb = new StringBuilder(); | ||
| sb.append("Running on ").append(getFullName()).append("\n"); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.