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 } }