diff options
-rw-r--r-- | src/QuickMedia.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index cd1377a..cf2c0a6 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -118,9 +118,9 @@ static void for_each_active_monitor_output(Display *display, std::function<void( for(int i = 0; i < screen_res->noutput; ++i) { XRROutputInfo *out_info = XRRGetOutputInfo(display, screen_res, screen_res->outputs[i]); - if(out_info && out_info->connection == RR_Connected) { + if(out_info && out_info->crtc && out_info->connection == RR_Connected) { XRRCrtcInfo *crt_info = XRRGetCrtcInfo(display, screen_res, out_info->crtc); - if(crt_info) { + if(crt_info && crt_info->mode) { const XRRModeInfo *mode_info = get_mode_info(screen_res, crt_info->mode); if(mode_info) callback_func(crt_info, mode_info); @@ -565,6 +565,9 @@ namespace QuickMedia { if (!disp) throw std::runtime_error("Failed to open display to X11 server"); + XSetErrorHandler(x_error_handler); + XSetIOErrorHandler(x_io_error_handler); + wm_delete_window_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False); int screen = DefaultScreen(disp); |