aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11/ffi.rs
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2015-01-22 12:02:02 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2015-01-22 12:07:31 +1000
commit19475f8521c6ce92a9b8b2c22e13613e718b2a9e (patch)
treeb780585f561853e01ed7747aab7ec0f4157567b6 /src/x11/ffi.rs
parent862baf82204c373d17e2878871826a457529a03f (diff)
downloadglutin-19475f8521c6ce92a9b8b2c22e13613e718b2a9e.tar.gz
glutin-19475f8521c6ce92a9b8b2c22e13613e718b2a9e.zip
Some GPU/driver combinations have glxCreateContextAttribsARB present, but it fails with an X error. In this case, catch the X error and fall back to the old method of creating a context.
Diffstat (limited to 'src/x11/ffi.rs')
-rw-r--r--src/x11/ffi.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/x11/ffi.rs b/src/x11/ffi.rs
index 5e7b5a1..1d9e7de 100644
--- a/src/x11/ffi.rs
+++ b/src/x11/ffi.rs
@@ -1358,6 +1358,17 @@ pub struct XF86VidModeModeInfo {
private: libc::c_long,
}
+#[repr(C)]
+pub struct XErrorEvent {
+ pub type_: libc::c_int,
+ pub display: *mut Display,
+ pub serial: libc::c_ulong,
+ pub error_code: libc::c_char,
+ pub request_code: libc::c_char,
+ pub minor_code: libc::c_char,
+ pub resourceid: XID,
+}
+
#[cfg(feature = "headless")]
#[link(name = "OSMesa")]
extern "C" {
@@ -1430,6 +1441,7 @@ extern "C" {
pub fn XScreenOfDisplay(display: *mut Display, screen_number: libc::c_int) -> *const Screen;
pub fn XWidthOfScreen(screen: *const Screen) -> libc::c_int;
pub fn XHeightOfScreen(screen: *const Screen) -> libc::c_int;
+ pub fn XSetErrorHandler(callback: fn(display: *mut Display, event: *mut XErrorEvent) -> libc::c_int) -> libc::c_int;
pub fn XCloseIM(im: XIM) -> Status;
pub fn XOpenIM(display: *mut Display, db: XrmDatabase, res_name: *mut libc::c_char,