From c24dc1286cc28d7f6acd90224d6b46131aa45cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Garramu=C3=B1o?= Date: Wed, 25 Oct 2023 14:28:36 -0300 Subject: [PATCH] Commented out some X11 stuff under Wayland. --- mrv2/lib/mrvApp/App.cpp | 15 +++++++++++---- mrv2/lib/mrvGL/mrvGLWindow.cpp | 21 ++++++++------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/mrv2/lib/mrvApp/App.cpp b/mrv2/lib/mrvApp/App.cpp index 6ce759b9a..9f7b72103 100644 --- a/mrv2/lib/mrvApp/App.cpp +++ b/mrv2/lib/mrvApp/App.cpp @@ -243,11 +243,18 @@ namespace mrv set_root_path(argc, argv); #ifdef __linux__ - int ok = XInitThreads(); - if (!ok) - throw std::runtime_error("XInitThreads failed"); - XSetErrorHandler(xerrorhandler); +# ifdef FLTK_USE_X11 + if (!fl_wl_display()) + { + int ok = XInitThreads(); + if (!ok) + throw std::runtime_error("XInitThreads failed"); + + XSetErrorHandler(xerrorhandler); + } +# endif + #endif // Store the application object for further use down the line App::app = this; diff --git a/mrv2/lib/mrvGL/mrvGLWindow.cpp b/mrv2/lib/mrvGL/mrvGLWindow.cpp index a0feba637..2f2a025e3 100644 --- a/mrv2/lib/mrvGL/mrvGLWindow.cpp +++ b/mrv2/lib/mrvGL/mrvGLWindow.cpp @@ -47,23 +47,11 @@ namespace mrv return; HWND hwnd = fl_win32_xid(this); - assert(hwnd); HDC hdc = fl_GetDC(hwnd); - assert(hdc); - assert(hglrc); wglMakeCurrent(hdc, hglrc); # endif # ifdef __linux__ -# ifdef FLTK_USE_X11 - auto dpy = fl_x11_display(); - if (dpy) - { - auto win = fl_x11_xid(this); - assert(win); - glXMakeCurrent(dpy, win, (GLXContext)ctx); - } -# endif # ifdef FLTK_USE_WAYLAND auto wldpy = fl_wl_display(); if (wldpy) @@ -74,12 +62,19 @@ namespace mrv return; auto win = fl_wl_xid(this); - assert(win); auto surface = fl_wl_surface(win); eglMakeCurrent(wldpy, surface, surface, eglctx); } # endif +# ifdef FLTK_USE_X11 + auto dpy = fl_x11_display(); + if (dpy) + { + auto win = fl_x11_xid(this); + glXMakeCurrent(dpy, win, (GLXContext)ctx); + } +# endif # endif } #endif