Call XInitThreads on X11

This allows using minifb on multiple threads under x11

Closes #309
This commit is contained in:
Daniel Collin 2023-02-18 13:07:35 +01:00
parent 5afc416681
commit 1b58e0e7cc

View file

@ -124,6 +124,10 @@ impl DisplayInfo {
let lib = xlib::Xlib::open() let lib = xlib::Xlib::open()
.map_err(|e| Error::WindowCreate(format!("failed to load Xlib: {:?}", e)))?; .map_err(|e| Error::WindowCreate(format!("failed to load Xlib: {:?}", e)))?;
if (lib.XInitThreads)() == 0 {
panic!("failed to init X11 threads");
}
let cursor_lib = xcursor::Xcursor::open() let cursor_lib = xcursor::Xcursor::open()
.map_err(|e| Error::WindowCreate(format!("failed to load XCursor: {:?}", e)))?; .map_err(|e| Error::WindowCreate(format!("failed to load XCursor: {:?}", e)))?;