aboutsummaryrefslogtreecommitdiffstats
path: root/src/platform/linux
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-12-24 10:57:08 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-12-30 14:58:07 +0100
commit82f5cd82729d12dbc8aec7e3bad3ed59dfd1f8e1 (patch)
treedcfb1e3fd82e1a1df1e20969290e3073dd70505e /src/platform/linux
parent8236564a5224e38cd6e345df8ffaf343bfa24320 (diff)
downloadglutin-82f5cd82729d12dbc8aec7e3bad3ed59dfd1f8e1.tar.gz
glutin-82f5cd82729d12dbc8aec7e3bad3ed59dfd1f8e1.zip
Add better X error handling
Diffstat (limited to 'src/platform/linux')
-rw-r--r--src/platform/linux/api_dispatch.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/platform/linux/api_dispatch.rs b/src/platform/linux/api_dispatch.rs
index a304f7a..8bf0ae5 100644
--- a/src/platform/linux/api_dispatch.rs
+++ b/src/platform/linux/api_dispatch.rs
@@ -19,6 +19,7 @@ use libc;
use api::wayland;
use api::x11;
use api::x11::XConnection;
+use api::x11::XError;
use api::x11::XNotSupported;
enum Backend {
@@ -399,8 +400,16 @@ unsafe extern "C" fn x_error_callback(dpy: *mut x11::ffi::Display, event: *mut x
if let Backend::X(ref x) = *BACKEND {
let mut buff: Vec<u8> = Vec::with_capacity(1024);
(x.xlib.XGetErrorText)(dpy, (*event).error_code as i32, buff.as_mut_ptr() as *mut i8, buff.capacity() as i32);
- let error = CStr::from_ptr(buff.as_mut_ptr() as *const i8).to_string_lossy();
- println!("[glutin] x error code={} major={} minor={}: {}!", (*event).error_code, (*event).request_code, (*event).minor_code, error);
+ let description = CStr::from_ptr(buff.as_mut_ptr() as *const i8).to_string_lossy();
+
+ let error = XError {
+ description: description.into_owned(),
+ error_code: (*event).error_code,
+ request_code: (*event).request_code,
+ minor_code: (*event).minor_code,
+ };
+
+ *x.latest_error.lock().unwrap() = Some(error);
}
0