Merge pull request #316 from binsoftware/cocoa-fixes

Cocoa fixes: memory leaks, monitor handling, is_current()
This commit is contained in:
Brendan Zabarauskas 2015-03-24 18:33:53 +11:00
commit 8a463f6643
7 changed files with 204 additions and 72 deletions

View file

@ -2,6 +2,7 @@ use std::ptr;
use std::collections::VecDeque;
use super::super::ffi;
use super::ensure_thread_init;
use native_monitor::NativeMonitorId;
pub struct MonitorID(pub u32);
@ -43,6 +44,11 @@ impl MonitorID {
Some(format!("Monitor #{}", screen_num))
}
pub fn get_native_identifier(&self) -> NativeMonitorId {
let MonitorID(screen_num) = *self;
NativeMonitorId::Numeric(screen_num)
}
pub fn get_dimensions(&self) -> (u32, u32) {
let dimensions = unsafe {
let display = ffi::XOpenDisplay(ptr::null());