diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-04-24 09:51:23 +0200 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-04-24 09:51:23 +0200 |
commit | 3ad7f9a58429b02b11b18f6a70ac011f698b6f4b (patch) | |
tree | 3061216335701a5faa8bd3c5c9ec0499a357be5a /src/cocoa/monitor.rs | |
parent | c1af76550f311e3da7a08d393b4ea9805cb61a7b (diff) | |
download | glutin-3ad7f9a58429b02b11b18f6a70ac011f698b6f4b.tar.gz glutin-3ad7f9a58429b02b11b18f6a70ac011f698b6f4b.zip |
Create reorganization
Diffstat (limited to 'src/cocoa/monitor.rs')
-rw-r--r-- | src/cocoa/monitor.rs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/cocoa/monitor.rs b/src/cocoa/monitor.rs deleted file mode 100644 index 40c7896..0000000 --- a/src/cocoa/monitor.rs +++ /dev/null @@ -1,53 +0,0 @@ -use core_graphics::display; -use std::collections::VecDeque; -use native_monitor::NativeMonitorId; - -pub struct MonitorID(u32); - -pub fn get_available_monitors() -> VecDeque<MonitorID> { - let mut monitors = VecDeque::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 0..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_native_identifier(&self) -> NativeMonitorId { - let MonitorID(display_id) = *self; - NativeMonitorId::Numeric(display_id) - } - - 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 - } -} |