From 291a50ad5bdad00aa2fe92481ce87e8dfe10fc8f 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, 8 insertions(+), 2 deletions(-) diff --git a/src/visualization/src/Visualizer.cpp b/src/visualization/src/Visualizer.cpp index 1e24f6c028..20871afaa4 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 @@ -508,8 +509,13 @@ bool Visualizer::init(const VisualizerOptions &visualizerOptions) #elif defined(__linux__) void* nativeWindow = nullptr; - // Try Wayland first - struct wl_surface* waylandWindow = glfwGetWaylandWindow(pimpl->m_window); + #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);