diff options
author | Ryan Stewart <ryan@binsoftware.com> | 2015-03-16 13:52:58 -0700 |
---|---|---|
committer | Ryan Stewart <ryan@binsoftware.com> | 2015-03-16 14:11:49 -0700 |
commit | 9914d826b8c79f81c5ae4418b827da51d2bf4a4f (patch) | |
tree | 910d7b5c071ad7e3c044659ad792f26612b047e3 /src/window.rs | |
parent | 0fa5e541e8e11eb0ee47f9679e3a1e755e7c975a (diff) | |
download | glutin-9914d826b8c79f81c5ae4418b827da51d2bf4a4f.tar.gz glutin-9914d826b8c79f81c5ae4418b827da51d2bf4a4f.zip |
expose platform-native monitor identifier
Diffstat (limited to 'src/window.rs')
-rw-r--r-- | src/window.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/window.rs b/src/window.rs index 56af494..4b02874 100644 --- a/src/window.rs +++ b/src/window.rs @@ -500,6 +500,19 @@ 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); @@ -510,6 +523,12 @@ impl MonitorID { id.get_name() } + /// Returns the native platform identifier for this monitor. + pub fn get_native_identifier(&self) -> NativeMonitorID { + let &MonitorID(ref id) = self; + id.get_native_identifier() + } + /// Returns the number of pixels currently displayed on the monitor. pub fn get_dimensions(&self) -> (u32, u32) { let &MonitorID(ref id) = self; |