File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 26
26
#define GLFW_EXPOSE_NATIVE_NSGL
27
27
#elif defined(__linux__)
28
28
#define GLFW_EXPOSE_NATIVE_X11
29
+ #define GLFW_EXPOSE_NATIVE_WAYLAND
29
30
#define GLFW_EXPOSE_NATIVE_GLX
30
31
#endif
31
32
@@ -162,7 +163,7 @@ struct Visualizer::VisualizerPimpl
162
163
#elif defined(__APPLE__)
163
164
id m_windowId;
164
165
#elif defined(__linux__)
165
- Window m_windowId;
166
+ void * m_windowId; // Pointer to either wl_surface* or X11 Window
166
167
#endif
167
168
#endif
168
169
@@ -505,8 +506,22 @@ bool Visualizer::init(const VisualizerOptions &visualizerOptions)
505
506
pimpl->m_windowId = glfwGetCocoaWindow (pimpl->m_window );
506
507
irrDevParams.WindowId = (void *)(pimpl->m_windowId );
507
508
#elif defined(__linux__)
508
- pimpl->m_windowId = glfwGetX11Window (pimpl->m_window );
509
- irrDevParams.WindowId = (void *)(pimpl->m_windowId );
509
+ void * nativeWindow = nullptr ;
510
+
511
+ // Try Wayland first
512
+ struct wl_surface * waylandWindow = glfwGetWaylandWindow (pimpl->m_window );
513
+ if (waylandWindow)
514
+ {
515
+ nativeWindow = static_cast <void *>(waylandWindow);
516
+ }
517
+ else
518
+ {
519
+ // Fallback to X11
520
+ Window x11Window = glfwGetX11Window (pimpl->m_window );
521
+ if (x11Window)
522
+ nativeWindow = static_cast <void *>(reinterpret_cast <void *>(x11Window));
523
+ }
524
+ irrDevParams.WindowId = nativeWindow;
510
525
#endif
511
526
512
527
irrDevParams.DeviceType = irr::EIDT_SDL;
You can’t perform that action at this time.
0 commit comments