mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 14:49:07 -04:00
Draft for monitor API
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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<MonitorID>)
|
||||
-> Result<Window, String>
|
||||
{
|
||||
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,
|
||||
|
||||
@@ -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<Vec<(ffi::HWND, Sender<Event>)>>)
|
||||
|
||||
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<MonitorID>)
|
||||
-> Result<Window, String>
|
||||
{
|
||||
use std::mem;
|
||||
|
||||
@@ -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<MonitorID>)
|
||||
-> Result<Window, String>
|
||||
{
|
||||
// calling XOpenDisplay
|
||||
|
||||
Reference in New Issue
Block a user