From d824fb94db2f33e56dd641df18b1327d361cae88 Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Sun, 27 Jul 2014 20:38:27 +0200 Subject: Draft for monitor API --- README.md | 2 +- examples/window.rs | 2 +- src/lib.rs | 7 +++++-- src/win32/mod.rs | 5 +++-- src/x11/mod.rs | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2172e96..c7cf627 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ extern crate gl; fn main() { use std::default::Default; - let window = init::Window::new(None, "Hello world!", &Default::default()).unwrap(); + let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap(); window.make_current(); diff --git a/examples/window.rs b/examples/window.rs index d827a05..5d12c59 100644 --- a/examples/window.rs +++ b/examples/window.rs @@ -5,7 +5,7 @@ extern crate gl; fn main() { use std::default::Default; - let window = init::Window::new(None, "Hello world!", &Default::default()).unwrap(); + let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap(); window.make_current(); diff --git a/src/lib.rs b/src/lib.rs index 8abdf2b..ad4c870 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,8 @@ mod x11; mod events; mod hints; +pub struct MonitorID(uint); + pub struct Window { window: winimpl::Window, nosend: std::kinds::marker::NoSend, @@ -26,10 +28,11 @@ pub struct Window { impl Window { #[inline] - pub fn new(dimensions: Option<(uint, uint)>, title: &str, hints: &Hints) + pub fn new(dimensions: Option<(uint, uint)>, title: &str, + hints: &Hints, monitor: Option) -> Result { - let win = try!(winimpl::Window::new(dimensions, title, hints)); + let win = try!(winimpl::Window::new(dimensions, title, hints, monitor)); Ok(Window{ window: win, nosend: std::kinds::marker::NoSend, diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 481436c..03c262f 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -2,7 +2,7 @@ use std::kinds::marker::NoSend; use std::sync::Mutex; use std::sync::atomics::AtomicBool; use std::ptr; -use {Event, Hints}; +use {Event, Hints, MonitorID}; mod event; mod ffi; @@ -22,7 +22,8 @@ pub struct Window { local_data_key!(pub WINDOWS_LIST: Mutex)>>) impl Window { - pub fn new(dimensions: Option<(uint, uint)>, title: &str, _hints: &Hints) + pub fn new(dimensions: Option<(uint, uint)>, title: &str, + _hints: &Hints, _monitor: Option) -> Result { use std::mem; diff --git a/src/x11/mod.rs b/src/x11/mod.rs index 857ee92..46334af 100644 --- a/src/x11/mod.rs +++ b/src/x11/mod.rs @@ -1,4 +1,4 @@ -use {Event, Hints}; +use {Event, Hints, MonitorID}; use libc; use std::{mem, ptr}; use std::sync::atomics::AtomicBool; @@ -14,7 +14,7 @@ pub struct Window { } impl Window { - pub fn new(dimensions: Option<(uint, uint)>, title: &str, hints: &Hints) + pub fn new(dimensions: Option<(uint, uint)>, title: &str, hints: &Hints, _: Option) -> Result { // calling XOpenDisplay -- cgit v1.2.3