Skip to content

Commit

Permalink
Optionally enable Wayland support
Browse files Browse the repository at this point in the history
Co-authored-by: Silvio Traversaro <[email protected]>
  • Loading branch information
flferretti and traversaro committed Jan 7, 2025
1 parent 3a385b0 commit dc45c8b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/visualization/src/Visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <GLFW/glfw3.h>
Expand Down Expand Up @@ -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<void*>(waylandWindow);
Expand Down

0 comments on commit dc45c8b

Please sign in to comment.