Skip to content

Commit

Permalink
fix(bgfx) demo init on Wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
Spasi committed Dec 9, 2024
1 parent 994887c commit 316143d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
13 changes: 10 additions & 3 deletions modules/samples/src/test/java/org/lwjgl/demo/bgfx/HelloBGFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,16 @@ public static void main(String[] args) {
switch (Platform.get()) {
case FREEBSD:
case LINUX:
init.platformData()
.ndt(GLFWNativeX11.glfwGetX11Display())
.nwh(GLFWNativeX11.glfwGetX11Window(window));
if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) {
init.platformData()
.ndt(GLFWNativeWayland.glfwGetWaylandDisplay())
.nwh(GLFWNativeWayland.glfwGetWaylandWindow(window))
.type(BGFX_NATIVE_WINDOW_HANDLE_TYPE_WAYLAND);
} else {
init.platformData()
.ndt(GLFWNativeX11.glfwGetX11Display())
.nwh(GLFWNativeX11.glfwGetX11Window(window));
}
break;
case MACOSX:
init.platformData()
Expand Down
13 changes: 10 additions & 3 deletions modules/samples/src/test/java/org/lwjgl/demo/bgfx/HelloBGFXMT.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,16 @@ private static class GraphicsRenderer implements AutoCloseable {
switch (Platform.get()) {
case FREEBSD:
case LINUX:
init.platformData()
.ndt(GLFWNativeX11.glfwGetX11Display())
.nwh(GLFWNativeX11.glfwGetX11Window(window));
if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) {
init.platformData()
.ndt(GLFWNativeWayland.glfwGetWaylandDisplay())
.nwh(GLFWNativeWayland.glfwGetWaylandWindow(window))
.type(BGFX_NATIVE_WINDOW_HANDLE_TYPE_WAYLAND);
} else {
init.platformData()
.ndt(GLFWNativeX11.glfwGetX11Display())
.nwh(GLFWNativeX11.glfwGetX11Window(window));
}
break;
case MACOSX:
init.platformData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,16 @@ public static void main(String[] args) {
switch (Platform.get()) {
case FREEBSD:
case LINUX:
init.platformData()
.ndt(GLFWNativeX11.glfwGetX11Display())
.nwh(GLFWNativeX11.glfwGetX11Window(window));
if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) {
init.platformData()
.ndt(GLFWNativeWayland.glfwGetWaylandDisplay())
.nwh(GLFWNativeWayland.glfwGetWaylandWindow(window))
.type(BGFX_NATIVE_WINDOW_HANDLE_TYPE_WAYLAND);
} else {
init.platformData()
.ndt(GLFWNativeX11.glfwGetX11Display())
.nwh(GLFWNativeX11.glfwGetX11Window(window));
}
break;
case MACOSX:
init.platformData()
Expand Down

0 comments on commit 316143d

Please sign in to comment.