summaryrefslogtreecommitdiffstats
path: root/app/x11_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'app/x11_util.cc')
-rw-r--r--app/x11_util.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/x11_util.cc b/app/x11_util.cc
index 78e09fc..934e824 100644
--- a/app/x11_util.cc
+++ b/app/x11_util.cc
@@ -52,8 +52,26 @@ CachedPictFormats* get_cached_pict_formats() {
// Maximum number of CachedPictFormats we keep around.
const size_t kMaxCacheSize = 5;
+int X11ErrorHandler(Display* d, XErrorEvent* e) {
+ LOG(FATAL) << "X Error detected: serial " << e->serial
+ << " error_code " << static_cast<unsigned int>(e->error_code)
+ << " request_code " << static_cast<unsigned int>(e->request_code)
+ << " minor_code " << static_cast<unsigned int>(e->minor_code);
+ return 0;
+}
+
+int X11IOErrorHandler(Display* d) {
+ LOG(FATAL) << "X IO Error detected";
+ return 0;
+}
+
} // namespace
+void SetX11ErrorHandlers() {
+ XSetErrorHandler(X11ErrorHandler);
+ XSetIOErrorHandler(X11IOErrorHandler);
+}
+
bool XDisplayExists() {
return (gdk_display_get_default() != NULL);
}