From dc45c8b04e5e775fe5d8393fa2c502b96bb1ca13 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 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/visualization/src/Visualizer.cpp b/src/visualization/src/Visualizer.cpp index 1e24f6c028..63920c6147 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,16 @@ 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; - // Try Wayland first - struct wl_surface* waylandWindow = glfwGetWaylandWindow(pimpl->m_window); + void* waylandWindow = nullptr; + + #ifdef IDYNTREE_USES_WAYLAND + // Try Wayland first + struct wl_surface* waylandWindow = glfwGetWaylandWindow(pimpl->m_window); + #else + void* waylandWindow = nullptr; + #endif + if (waylandWindow) { nativeWindow = static_cast(waylandWindow);