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);