Skip to content

Commit f84f52e

Browse files
committed
Pass display pointer in wayland
1 parent 6dbbfde commit f84f52e

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

core/src/processing/webgpu/PSurfaceGLFW.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package processing.webgpu;
22

3-
import org.lwjgl.glfw.GLFW;
4-
import org.lwjgl.glfw.GLFWErrorCallback;
5-
import org.lwjgl.glfw.GLFWFramebufferSizeCallback;
6-
import org.lwjgl.glfw.GLFWNativeCocoa;
7-
import org.lwjgl.glfw.GLFWNativeWin32;
8-
import org.lwjgl.glfw.GLFWWindowPosCallback;
3+
import org.lwjgl.glfw.*;
94
import org.lwjgl.system.MemoryUtil;
105
import org.lwjgl.system.Platform;
116

@@ -30,6 +25,7 @@ public class PSurfaceGLFW implements PSurface {
3025
protected PGraphics graphics;
3126

3227
protected long window;
28+
protected long display;
3329
protected boolean running = false;
3430

3531
protected boolean paused;
@@ -78,6 +74,8 @@ public void initFrame(PApplet sketch) {
7874
throw new RuntimeException("Failed to create GLFW window");
7975
}
8076

77+
display = GLFW.glfwGetPrimaryMonitor();
78+
8179
windowCount.incrementAndGet();
8280

8381
// event callbacks
@@ -124,6 +122,24 @@ public long getWindowHandle() {
124122
return GLFWNativeCocoa.glfwGetCocoaWindow(window);
125123
} else if (Platform.get() == Platform.WINDOWS) {
126124
return GLFWNativeWin32.glfwGetWin32Window(window);
125+
} else if (Platform.get() == Platform.LINUX) {
126+
// TODO: need to check if x11 or wayland
127+
return GLFWNativeWayland.glfwGetWaylandWindow(window);
128+
} else {
129+
throw new UnsupportedOperationException("Window handle retrieval not implemented for this platform");
130+
}
131+
}
132+
133+
public long getDisplayHandle() {
134+
if (Platform.get() == Platform.MACOSX) {
135+
// TODO: Currently unsupported
136+
return 0;
137+
} else if (Platform.get() == Platform.WINDOWS) {
138+
// TODO: Currently unsupported
139+
return 0;
140+
} else if (Platform.get() == Platform.LINUX) {
141+
// TODO: need to check if x11 or wayland
142+
return GLFWNativeWayland.glfwGetWaylandDisplay();
127143
} else {
128144
throw new UnsupportedOperationException("Window handle retrieval not implemented for this platform");
129145
}

0 commit comments

Comments
 (0)