From 6b0c1945155acbe69e6250ec4e375a98a6679264 Mon Sep 17 00:00:00 2001 From: bi4k8 Date: Mon, 12 Dec 2022 23:04:58 +0000 Subject: [PATCH] x11: do not treat init failure as fatal with Wayland --- src/display-x11.cc | 2 ++ src/x11.cc | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/display-x11.cc b/src/display-x11.cc index f5d7c646..a01edf5d 100644 --- a/src/display-x11.cc +++ b/src/display-x11.cc @@ -225,6 +225,8 @@ bool display_output_x11::shutdown() { return false; } bool display_output_x11::main_loop_wait(double t) { /* wait for X event or timeout */ + if(!display || !window.gc) + return true; if (XPending(display) == 0) { fd_set fdsr; diff --git a/src/x11.cc b/src/x11.cc index a3573327..2b088fcc 100644 --- a/src/x11.cc +++ b/src/x11.cc @@ -231,11 +231,13 @@ static void init_X11() { ? dispstr.c_str() : nullptr; if ((display = XOpenDisplay(disp)) == nullptr) { + std::string err = std::string("can't open display: ") + + XDisplayName(disp); #ifdef BUILD_WAYLAND + fprintf(stderr, "%s\n", err.c_str()); return; #else - throw std::runtime_error(std::string("can't open display: ") + - XDisplayName(disp)); + throw std::runtime_error(err); #endif } }