From a0924a4363180eb8de4a6f7b3522e16cad8ab59f Mon Sep 17 00:00:00 2001 From: Filippo Luca Ferretti Date: Tue, 7 Jan 2025 16:29:51 +0100 Subject: [PATCH] Optionally enable Wayland support Co-authored-by: Silvio Traversaro --- src/visualization/src/Visualizer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/visualization/src/Visualizer.cpp b/src/visualization/src/Visualizer.cpp index 1e24f6c028..04ca4af07b 100644 --- a/src/visualization/src/Visualizer.cpp +++ b/src/visualization/src/Visualizer.cpp @@ -28,6 +28,7 @@ #define GLFW_EXPOSE_NATIVE_X11 #define GLFW_EXPOSE_NATIVE_WAYLAND #define GLFW_EXPOSE_NATIVE_GLX + #define IDYNTREE_USES_WAYLAND #endif #include @@ -506,10 +507,13 @@ bool Visualizer::init(const VisualizerOptions &visualizerOptions) pimpl->m_windowId = glfwGetCocoaWindow(pimpl->m_window); irrDevParams.WindowId = (void*)(pimpl->m_windowId); #elif defined(__linux__) - void* nativeWindow = nullptr; + #ifdef IDYNTREE_USES_WAYLAND + // Try Wayland first + struct wl_surface* waylandWindow = glfwGetWaylandWindow(pimpl->m_window); + #else + void* waylandWindow = nullptr; + #endif - // Try Wayland first - struct wl_surface* waylandWindow = glfwGetWaylandWindow(pimpl->m_window); if (waylandWindow) { nativeWindow = static_cast(waylandWindow);