summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd/wayland/display_server_wayland.cpp
diff options
context:
space:
mode:
authorRiteo <riteo@posteo.net>2024-01-26 16:27:44 +0100
committerRiteo <riteo@posteo.net>2024-01-31 11:57:05 +0100
commitd8658df94e09a3ed82c66eb5085c89ece1239d0c (patch)
tree3dba7c693ca2b8438c30d856d978cec423c0e8ce /platform/linuxbsd/wayland/display_server_wayland.cpp
parent313f623b9d102cc8c411ae7cab9518f98c2f87f2 (diff)
downloadredot-engine-d8658df94e09a3ed82c66eb5085c89ece1239d0c.tar.gz
Wayland: implement `window_get_native_handle`
This will be the most useful for stuff like OpenXR, although we'd need a way to eventually also expose the EGL handles.
Diffstat (limited to 'platform/linuxbsd/wayland/display_server_wayland.cpp')
-rw-r--r--platform/linuxbsd/wayland/display_server_wayland.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/platform/linuxbsd/wayland/display_server_wayland.cpp b/platform/linuxbsd/wayland/display_server_wayland.cpp
index e22eddd08e..556c260360 100644
--- a/platform/linuxbsd/wayland/display_server_wayland.cpp
+++ b/platform/linuxbsd/wayland/display_server_wayland.cpp
@@ -557,6 +557,37 @@ Vector<DisplayServer::WindowID> DisplayServerWayland::get_window_list() const {
return ret;
}
+int64_t DisplayServerWayland::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const {
+ MutexLock mutex_lock(wayland_thread.mutex);
+
+ switch (p_handle_type) {
+ case DISPLAY_HANDLE: {
+ return (int64_t)wayland_thread.get_wl_display();
+ } break;
+
+ case WINDOW_HANDLE: {
+ return (int64_t)wayland_thread.window_get_wl_surface(p_window);
+ } break;
+
+ case WINDOW_VIEW: {
+ return 0; // Not supported.
+ } break;
+
+#ifdef GLES3_ENABLED
+ case OPENGL_CONTEXT: {
+ if (egl_manager) {
+ return (int64_t)egl_manager->get_context(p_window);
+ }
+ return 0;
+ } break;
+#endif // GLES3_ENABLED
+
+ default: {
+ return 0;
+ } break;
+ }
+}
+
DisplayServer::WindowID DisplayServerWayland::get_window_at_screen_position(const Point2i &p_position) const {
// Standard Wayland APIs don't support this.
return MAIN_WINDOW_ID;