From 3468554eb3ddeac3cbf079ad6ebf3c8a39efc2f2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 24 Nov 2024 19:13:35 +0100 Subject: Allow running the ui on Wayland through XWayland --- src/main.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index be2e50d..cded01c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -56,6 +56,11 @@ int main(void) { signal(SIGINT, sigint_handler); + if(mgl_init() != 0) { + fprintf(stderr, "error: failed to initialize mgl. Either failed to connec to the X11 server or failed to setup opengl\n"); + exit(1); + } + gsr::GsrInfo gsr_info; // TODO: Show the error in ui gsr::GsrInfoExitStatus gsr_info_exit_status = gsr::get_gpu_screen_recorder_info(&gsr_info); @@ -64,10 +69,8 @@ int main(void) { exit(1); } - if(gsr_info.system_info.display_server == gsr::DisplayServer::WAYLAND) { - fprintf(stderr, "error: Wayland is currently not supported\n"); - exit(1); - } + if(gsr_info.system_info.display_server == gsr::DisplayServer::WAYLAND) + fprintf(stderr, "warning: Wayland support is experimental and requires XWayland. Things may not work as expected.\n"); std::string resources_path; if(access("sibs-build", F_OK) == 0) { @@ -80,7 +83,6 @@ int main(void) { #endif } - mgl::Init init; mgl_context *context = mgl_get_context(); egl_functions egl_funcs; @@ -198,6 +200,7 @@ int main(void) { overlay.reset(); gsr::deinit_theme(); gsr::deinit_color_theme(); + mgl_deinit(); return 0; } -- cgit v1.2.3