Merge pull request #65 from glennw/x-threads

Add an interface for providing system wide initialization options to the windowing system.
This commit is contained in:
tomaka 2014-10-24 12:31:33 +02:00
commit 2c9eaf8651
4 changed files with 18 additions and 0 deletions

View file

@ -1,9 +1,11 @@
use std::{ptr};
use super::super::ffi;
use super::ensure_thread_init;
pub struct MonitorID(pub uint);
pub fn get_available_monitors() -> Vec<MonitorID> {
ensure_thread_init();
let nb_monitors = unsafe {
let display = ffi::XOpenDisplay(ptr::null());
if display.is_null() {
@ -20,6 +22,7 @@ pub fn get_available_monitors() -> Vec<MonitorID> {
}
pub fn get_primary_monitor() -> MonitorID {
ensure_thread_init();
let primary_monitor = unsafe {
let display = ffi::XOpenDisplay(ptr::null());
if display.is_null() {