Add an interface for providing system wide initialization options to the windowing system.

This allows setting up Linux based systems which use multithreaded OpenGL contexts.
This commit is contained in:
Glenn Watson 2014-10-24 14:49:07 +10:00
parent d8ca679a6e
commit 97c471dc05
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() {