diff options
author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2015-01-26 14:28:12 +1100 |
---|---|---|
committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2015-01-26 14:28:12 +1100 |
commit | 73078e0569a9cadc51d64e98f4653e66e2985b8d (patch) | |
tree | 6a5cfb09807594b51b9a84b87d65d0cd02b7e40a /src/osx/monitor.rs | |
parent | 44c21c4bbb890400bf12cfb9e0d199e598eec0d1 (diff) | |
download | glutin-73078e0569a9cadc51d64e98f4653e66e2985b8d.tar.gz glutin-73078e0569a9cadc51d64e98f4653e66e2985b8d.zip |
Rename osx->cocoa
Diffstat (limited to 'src/osx/monitor.rs')
-rw-r--r-- | src/osx/monitor.rs | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/osx/monitor.rs b/src/osx/monitor.rs deleted file mode 100644 index 912c02d..0000000 --- a/src/osx/monitor.rs +++ /dev/null @@ -1,47 +0,0 @@ -use core_graphics::display; -use std::collections::RingBuf; - -pub struct MonitorID(u32); - -pub fn get_available_monitors() -> RingBuf<MonitorID> { - let mut monitors = RingBuf::new(); - unsafe { - let max_displays = 10u32; - let mut active_displays = [0u32; 10]; - let mut display_count = 0; - display::CGGetActiveDisplayList(max_displays, - &mut active_displays[0], - &mut display_count); - for i in range(0us, display_count as usize) { - monitors.push_back(MonitorID(active_displays[i])); - } - } - monitors -} - -pub fn get_primary_monitor() -> MonitorID { - let id = unsafe { - MonitorID(display::CGMainDisplayID()) - }; - id -} - -impl MonitorID { - pub fn get_name(&self) -> Option<String> { - let MonitorID(display_id) = *self; - let screen_num = unsafe { - display::CGDisplayModelNumber(display_id) - }; - Some(format!("Monitor #{}", screen_num)) - } - - pub fn get_dimensions(&self) -> (u32, u32) { - let MonitorID(display_id) = *self; - let dimension = unsafe { - let height = display::CGDisplayPixelsHigh(display_id); - let width = display::CGDisplayPixelsWide(display_id); - (width as u32, height as u32) - }; - dimension - } -} |