aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/android/mod.rs6
-rw-r--r--src/cocoa/mod.rs4
-rw-r--r--src/cocoa/monitor.rs6
-rw-r--r--src/lib.rs21
-rw-r--r--src/win32/monitor.rs6
-rw-r--r--src/window.rs16
-rw-r--r--src/x11/window/monitor.rs6
7 files changed, 36 insertions, 29 deletions
diff --git a/src/android/mod.rs b/src/android/mod.rs
index c75878b..71dae54 100644
--- a/src/android/mod.rs
+++ b/src/android/mod.rs
@@ -14,7 +14,7 @@ use std::collections::VecDeque;
use Api;
use BuilderAttribs;
use GlRequest;
-use NativeMonitorID;
+use native_monitor::NativeMonitorId;
pub struct Window {
display: ffi::egl::types::EGLDisplay,
@@ -42,8 +42,8 @@ impl MonitorID {
Some("Primary".to_string())
}
- pub fn get_native_identifier(&self) -> NativeMonitorID {
- NativeMonitorID::Unavailable
+ pub fn get_native_identifier(&self) -> NativeMonitorId {
+ NativeMonitorId::Unavailable
}
pub fn get_dimensions(&self) -> (u32, u32) {
diff --git a/src/cocoa/mod.rs b/src/cocoa/mod.rs
index 22ec4b4..f4b2726 100644
--- a/src/cocoa/mod.rs
+++ b/src/cocoa/mod.rs
@@ -8,7 +8,7 @@ use libc;
use Api;
use BuilderAttribs;
use GlRequest;
-use NativeMonitorID;
+use native_monitor::NativeMonitorId;
use cocoa::base::{Class, id, YES, NO, NSUInteger, nil, objc_allocateClassPair, class, objc_registerClassPair};
use cocoa::base::{selector, msg_send, msg_send_stret, class_addMethod, class_addIvar};
@@ -409,7 +409,7 @@ impl Window {
unsafe {
let screen = monitor.map(|monitor_id| {
let native_id = match monitor_id.get_native_identifier() {
- NativeMonitorID::Numeric(num) => num,
+ NativeMonitorId::Numeric(num) => num,
_ => panic!("OS X monitors should always have a numeric native ID")
};
let matching_screen = {
diff --git a/src/cocoa/monitor.rs b/src/cocoa/monitor.rs
index 1902f6a..bf15665 100644
--- a/src/cocoa/monitor.rs
+++ b/src/cocoa/monitor.rs
@@ -1,6 +1,6 @@
use core_graphics::display;
use std::collections::VecDeque;
-use window::NativeMonitorID;
+use native_monitor::NativeMonitorId;
pub struct MonitorID(u32);
@@ -36,9 +36,9 @@ impl MonitorID {
Some(format!("Monitor #{}", screen_num))
}
- pub fn get_native_identifier(&self) -> NativeMonitorID {
+ pub fn get_native_identifier(&self) -> NativeMonitorId {
let MonitorID(display_id) = *self;
- NativeMonitorID::Numeric(display_id)
+ NativeMonitorId::Numeric(display_id)
}
pub fn get_dimensions(&self) -> (u32, u32) {
diff --git a/src/lib.rs b/src/lib.rs
index 20bd723..76f9fde 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -50,7 +50,9 @@ pub use headless::{HeadlessRendererBuilder, HeadlessContext};
#[cfg(feature = "window")]
pub use window::{WindowBuilder, Window, WindowProxy, PollEventsIterator, WaitEventsIterator};
#[cfg(feature = "window")]
-pub use window::{AvailableMonitorsIter, NativeMonitorID, MonitorID, get_available_monitors, get_primary_monitor};
+pub use window::{AvailableMonitorsIter, MonitorID, get_available_monitors, get_primary_monitor};
+#[cfg(feature = "window")]
+pub use native_monitor::NativeMonitorId;
#[cfg(all(not(target_os = "windows"), not(target_os = "linux"), not(target_os = "macos"), not(target_os = "android")))]
use this_platform_is_not_supported;
@@ -322,3 +324,20 @@ impl<'a> BuilderAttribs<'a> {
.expect("Could not find compliant pixel format")
}
}
+
+mod native_monitor {
+ /// Native platform identifier for a monitor. Different platforms use fundamentally different types
+ /// to represent a monitor ID.
+ #[derive(PartialEq, Eq)]
+ pub enum NativeMonitorId {
+ /// Cocoa and X11 use a numeric identifier to represent a monitor.
+ Numeric(u32),
+
+ /// Win32 uses a Unicode string to represent a monitor.
+ Name(String),
+
+ /// Other platforms (Android) don't support monitor identification.
+ Unavailable
+ }
+}
+
diff --git a/src/win32/monitor.rs b/src/win32/monitor.rs
index 5fbd5dd..819aa7f 100644
--- a/src/win32/monitor.rs
+++ b/src/win32/monitor.rs
@@ -3,7 +3,7 @@ use user32;
use std::collections::VecDeque;
-use NativeMonitorID;
+use native_monitor::NativeMonitorId;
/// Win32 implementation of the main `MonitorID` object.
pub struct MonitorID {
@@ -116,8 +116,8 @@ impl MonitorID {
}
/// See the docs of the crate root file.
- pub fn get_native_identifier(&self) -> NativeMonitorID {
- NativeMonitorID::Name(self.readable_name.clone())
+ pub fn get_native_identifier(&self) -> NativeMonitorId {
+ NativeMonitorId::Name(self.readable_name.clone())
}
/// See the docs if the crate root file.
diff --git a/src/window.rs b/src/window.rs
index 4b02874..5cb6e5e 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -7,6 +7,7 @@ use CreationError;
use Event;
use GlRequest;
use MouseCursor;
+use native_monitor::NativeMonitorId;
use gl_common;
use libc;
@@ -500,19 +501,6 @@ pub fn get_primary_monitor() -> MonitorID {
MonitorID(winimpl::get_primary_monitor())
}
-/// Native platform identifier for a monitor. Different platforms use fundamentally different types
-/// to represent a monitor ID.
-pub enum NativeMonitorID {
- /// Cocoa and X11 use a numeric identifier to represent a monitor.
- Numeric(u32),
-
- /// Win32 uses a Unicode string to represent a monitor.
- Name(String),
-
- /// Other platforms (Android) don't support monitor identification.
- Unavailable
-}
-
/// Identifier for a monitor.
pub struct MonitorID(winimpl::MonitorID);
@@ -524,7 +512,7 @@ impl MonitorID {
}
/// Returns the native platform identifier for this monitor.
- pub fn get_native_identifier(&self) -> NativeMonitorID {
+ pub fn get_native_identifier(&self) -> NativeMonitorId {
let &MonitorID(ref id) = self;
id.get_native_identifier()
}
diff --git a/src/x11/window/monitor.rs b/src/x11/window/monitor.rs
index c1a4897..44c5e84 100644
--- a/src/x11/window/monitor.rs
+++ b/src/x11/window/monitor.rs
@@ -2,7 +2,7 @@ use std::ptr;
use std::collections::VecDeque;
use super::super::ffi;
use super::ensure_thread_init;
-use window::NativeMonitorID;
+use native_monitor::NativeMonitorId;
pub struct MonitorID(pub u32);
@@ -44,9 +44,9 @@ impl MonitorID {
Some(format!("Monitor #{}", screen_num))
}
- pub fn get_native_identifier(&self) -> NativeMonitorID {
+ pub fn get_native_identifier(&self) -> NativeMonitorId {
let MonitorID(screen_num) = *self;
- NativeMonitorID::Numeric(screen_num)
+ NativeMonitorId::Numeric(screen_num)
}
pub fn get_dimensions(&self) -> (u32, u32) {