diff --git a/src/dpi.rs b/src/dpi.rs index 909c9835d..cae9b4012 100644 --- a/src/dpi.rs +++ b/src/dpi.rs @@ -33,7 +33,7 @@ //! windows. This event is sent any time the DPI factor changes, either because the window moved to another monitor, //! or because the user changed the configuration of their screen. //! - You can also retrieve the DPI factor of a monitor by calling -//! [`MonitorId::get_hidpi_factor`](../monitor/struct.MonitorId.html#method.get_hidpi_factor), or the +//! [`MonitorHandle::get_hidpi_factor`](../monitor/struct.MonitorHandle.html#method.get_hidpi_factor), or the //! current DPI factor applied to a window by calling //! [`Window::get_hidpi_factor`](../window/struct.Window.html#method.get_hidpi_factor), which is roughly equivalent //! to `window.get_current_monitor().get_hidpi_factor()`. diff --git a/src/event_loop.rs b/src/event_loop.rs index 93f123ef4..585963ef4 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -14,7 +14,7 @@ use std::time::Instant; use platform_impl; use event::Event; -use monitor::{AvailableMonitorsIter, MonitorId}; +use monitor::{AvailableMonitorsIter, MonitorHandle}; /// Provides a way to retrieve events from the system and from the windows that were registered to /// the events loop. @@ -101,8 +101,8 @@ impl EventLoop { /// Returns the primary monitor of the system. #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { - MonitorId { inner: self.event_loop.get_primary_monitor() } + pub fn get_primary_monitor(&self) -> MonitorHandle { + MonitorHandle { inner: self.event_loop.get_primary_monitor() } } /// Hijacks the calling thread and initializes the `winit` event loop with the provided diff --git a/src/monitor.rs b/src/monitor.rs index 76aaed9e7..7533cb78d 100644 --- a/src/monitor.rs +++ b/src/monitor.rs @@ -1,12 +1,12 @@ //! Types useful for interacting with a user's monitors. //! -//! If you want to get basic information about a monitor, you can use the [`MonitorId`][monitor_id] +//! If you want to get basic information about a monitor, you can use the [`MonitorHandle`][monitor_id] //! type. This is retreived from an [`AvailableMonitorsIter`][monitor_iter], which can be acquired //! with: //! - [`EventLoop::get_available_monitors`][loop_get] //! - [`Window::get_available_monitors`][window_get]. //! -//! [monitor_id]: ./struct.MonitorId.html +//! [monitor_id]: ./struct.MonitorHandle.html //! [monitor_iter]: ./struct.AvailableMonitorsIter.html //! [loop_get]: ../event_loop/struct.EventLoop.html#method.get_available_monitors //! [window_get]: ../window/struct.Window.html#method.get_available_monitors @@ -27,15 +27,15 @@ use dpi::{PhysicalPosition, PhysicalSize}; // This may change in the future. #[derive(Debug)] pub struct AvailableMonitorsIter { - pub(crate) data: VecDequeIter, + pub(crate) data: VecDequeIter, } impl Iterator for AvailableMonitorsIter { - type Item = MonitorId; + type Item = MonitorHandle; #[inline] - fn next(&mut self) -> Option { - self.data.next().map(|id| MonitorId { inner: id }) + fn next(&mut self) -> Option { + self.data.next().map(|id| MonitorHandle { inner: id }) } #[inline] @@ -44,13 +44,17 @@ impl Iterator for AvailableMonitorsIter { } } -/// Identifier for a monitor. +/// Handle to a monitor. +/// +/// Allows you to retrieve information about a given monitor and can be used in [`Window`] creation. +/// +/// [`Window`]: ../window/struct.Window.html #[derive(Debug, Clone)] -pub struct MonitorId { - pub(crate) inner: platform_impl::MonitorId +pub struct MonitorHandle { + pub(crate) inner: platform_impl::MonitorHandle } -impl MonitorId { +impl MonitorHandle { /// Returns a human-readable name of the monitor. /// /// Returns `None` if the monitor doesn't exist anymore. diff --git a/src/platform/ios.rs b/src/platform/ios.rs index 3e7a3e2a7..7a2345b04 100644 --- a/src/platform/ios.rs +++ b/src/platform/ios.rs @@ -2,7 +2,7 @@ use std::os::raw::c_void; -use {MonitorId, Window, WindowBuilder}; +use {MonitorHandle, Window, WindowBuilder}; /// Additional methods on `Window` that are specific to iOS. pub trait WindowExtIOS { @@ -45,13 +45,13 @@ impl WindowBuilderExtIOS for WindowBuilder { } } -/// Additional methods on `MonitorId` that are specific to iOS. -pub trait MonitorIdExtIOS { +/// Additional methods on `MonitorHandle` that are specific to iOS. +pub trait MonitorHandleExtIOS { /// Returns a pointer to the `UIScreen` that is used by this monitor. fn get_uiscreen(&self) -> *mut c_void; } -impl MonitorIdExtIOS for MonitorId { +impl MonitorHandleExtIOS for MonitorHandle { #[inline] fn get_uiscreen(&self) -> *mut c_void { self.inner.get_uiscreen() as _ diff --git a/src/platform/macos.rs b/src/platform/macos.rs index 24bdc426b..ef7b10cd4 100644 --- a/src/platform/macos.rs +++ b/src/platform/macos.rs @@ -1,7 +1,7 @@ #![cfg(target_os = "macos")] use std::os::raw::c_void; -use {LogicalSize, MonitorId, Window, WindowBuilder}; +use {LogicalSize, MonitorHandle, Window, WindowBuilder}; /// Additional methods on `Window` that are specific to MacOS. pub trait WindowExtMacOS { @@ -137,15 +137,15 @@ impl WindowBuilderExtMacOS for WindowBuilder { } } -/// Additional methods on `MonitorId` that are specific to MacOS. -pub trait MonitorIdExtMacOS { +/// Additional methods on `MonitorHandle` that are specific to MacOS. +pub trait MonitorHandleExtMacOS { /// Returns the identifier of the monitor for Cocoa. fn native_id(&self) -> u32; /// Returns a pointer to the NSScreen representing this monitor. fn get_nsscreen(&self) -> Option<*mut c_void>; } -impl MonitorIdExtMacOS for MonitorId { +impl MonitorHandleExtMacOS for MonitorHandle { #[inline] fn native_id(&self) -> u32 { self.inner.get_native_identifier() diff --git a/src/platform/unix.rs b/src/platform/unix.rs index 43bc316ca..f611a4f7c 100644 --- a/src/platform/unix.rs +++ b/src/platform/unix.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use { EventLoop, LogicalSize, - MonitorId, + MonitorHandle, Window, WindowBuilder, }; @@ -279,13 +279,13 @@ impl WindowBuilderExtUnix for WindowBuilder { } } -/// Additional methods on `MonitorId` that are specific to Linux. -pub trait MonitorIdExtUnix { +/// Additional methods on `MonitorHandle` that are specific to Linux. +pub trait MonitorHandleExtUnix { /// Returns the inner identifier of the monitor. fn native_id(&self) -> u32; } -impl MonitorIdExtUnix for MonitorId { +impl MonitorHandleExtUnix for MonitorHandle { #[inline] fn native_id(&self) -> u32 { self.inner.get_native_identifier() diff --git a/src/platform/windows.rs b/src/platform/windows.rs index b5fd561ec..7a9de6880 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -6,7 +6,7 @@ use libc; use winapi::shared::windef::HWND; use event::DeviceId; -use monitor::MonitorId; +use monitor::MonitorHandle; use event_loop::EventLoop; use window::{Icon, Window, WindowBuilder}; use platform_impl::EventLoop as WindowsEventLoop; @@ -83,8 +83,8 @@ impl WindowBuilderExtWindows for WindowBuilder { } } -/// Additional methods on `MonitorId` that are specific to Windows. -pub trait MonitorIdExtWindows { +/// Additional methods on `MonitorHandle` that are specific to Windows. +pub trait MonitorHandleExtWindows { /// Returns the name of the monitor adapter specific to the Win32 API. fn native_id(&self) -> String; @@ -92,7 +92,7 @@ pub trait MonitorIdExtWindows { fn hmonitor(&self) -> *mut c_void; } -impl MonitorIdExtWindows for MonitorId { +impl MonitorHandleExtWindows for MonitorHandle { #[inline] fn native_id(&self) -> String { self.inner.get_native_identifier() diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 47a8d2ac2..c5a1239e1 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -24,7 +24,7 @@ use { }; use CreationError::OsError; use events::{Touch, TouchPhase}; -use window::MonitorId as RootMonitorId; +use window::MonitorHandle as RootMonitorHandle; pub struct EventLoop { event_rx: Receiver, @@ -45,15 +45,15 @@ impl EventLoop { } #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { let mut rb = VecDeque::with_capacity(1); - rb.push_back(MonitorId); + rb.push_back(MonitorHandle); rb } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { - MonitorId + pub fn get_primary_monitor(&self) -> MonitorHandle { + MonitorHandle } pub fn poll_events(&mut self, mut callback: F) @@ -62,7 +62,7 @@ impl EventLoop { while let Ok(event) = self.event_rx.try_recv() { let e = match event{ android_glue::Event::EventMotion(motion) => { - let dpi_factor = MonitorId.get_hidpi_factor(); + let dpi_factor = MonitorHandle.get_hidpi_factor(); let location = LogicalPosition::from_physical( (motion.x as f64, motion.y as f64), dpi_factor, @@ -103,8 +103,8 @@ impl EventLoop { if native_window.is_null() { None } else { - let dpi_factor = MonitorId.get_hidpi_factor(); - let physical_size = MonitorId.get_dimensions(); + let dpi_factor = MonitorHandle.get_hidpi_factor(); + let physical_size = MonitorHandle.get_dimensions(); let size = LogicalSize::from_physical(physical_size, dpi_factor); Some(Event::WindowEvent { window_id: RootWindowId(WindowId), @@ -178,19 +178,19 @@ pub struct Window { } #[derive(Clone)] -pub struct MonitorId; +pub struct MonitorHandle; -impl fmt::Debug for MonitorId { +impl fmt::Debug for MonitorHandle { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { #[derive(Debug)] - struct MonitorId { + struct MonitorHandle { name: Option, dimensions: PhysicalSize, position: PhysicalPosition, hidpi_factor: f64, } - let monitor_id_proxy = MonitorId { + let monitor_id_proxy = MonitorHandle { name: self.get_name(), dimensions: self.get_dimensions(), position: self.get_position(), @@ -201,7 +201,7 @@ impl fmt::Debug for MonitorId { } } -impl MonitorId { +impl MonitorHandle { #[inline] pub fn get_name(&self) -> Option { Some("Primary".to_string()) @@ -357,7 +357,7 @@ impl Window { } #[inline] - pub fn set_fullscreen(&self, _monitor: Option) { + pub fn set_fullscreen(&self, _monitor: Option) { // N/A // Android has single screen maximized apps so nothing to do } @@ -383,20 +383,20 @@ impl Window { } #[inline] - pub fn get_current_monitor(&self) -> RootMonitorId { - RootMonitorId { inner: MonitorId } + pub fn get_current_monitor(&self) -> RootMonitorHandle { + RootMonitorHandle { inner: MonitorHandle } } #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { let mut rb = VecDeque::with_capacity(1); - rb.push_back(MonitorId); + rb.push_back(MonitorHandle); rb } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { - MonitorId + pub fn get_primary_monitor(&self) -> MonitorHandle { + MonitorHandle } #[inline] diff --git a/src/platform_impl/emscripten/mod.rs b/src/platform_impl/emscripten/mod.rs index ca7368269..c46b163ea 100644 --- a/src/platform_impl/emscripten/mod.rs +++ b/src/platform_impl/emscripten/mod.rs @@ -10,7 +10,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Mutex, Arc}; use dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize}; -use window::MonitorId as RootMonitorId; +use window::MonitorHandle as RootMonitorHandle; const DOCUMENT_NAME: &'static str = "#document\0"; @@ -31,9 +31,9 @@ pub struct DeviceId; pub struct PlatformSpecificHeadlessBuilderAttributes; #[derive(Debug, Clone)] -pub struct MonitorId; +pub struct MonitorHandle; -impl MonitorId { +impl MonitorHandle { #[inline] pub fn get_name(&self) -> Option { Some("Canvas".to_owned()) @@ -107,15 +107,15 @@ impl EventLoop { } #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { let mut list = VecDeque::with_capacity(1); - list.push_back(MonitorId); + list.push_back(MonitorHandle); list } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { - MonitorId + pub fn get_primary_monitor(&self) -> MonitorHandle { + MonitorHandle } pub fn poll_events(&self, mut callback: F) @@ -569,7 +569,7 @@ impl Window { } #[inline] - pub fn set_fullscreen(&self, _monitor: Option<::MonitorId>) { + pub fn set_fullscreen(&self, _monitor: Option<::MonitorHandle>) { // iOS has single screen maximized apps so nothing to do } @@ -594,20 +594,20 @@ impl Window { } #[inline] - pub fn get_current_monitor(&self) -> RootMonitorId { - RootMonitorId { inner: MonitorId } + pub fn get_current_monitor(&self) -> RootMonitorHandle { + RootMonitorHandle { inner: MonitorHandle } } #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { let mut list = VecDeque::with_capacity(1); - list.push_back(MonitorId); + list.push_back(MonitorHandle); list } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { - MonitorId + pub fn get_primary_monitor(&self) -> MonitorHandle { + MonitorHandle } } diff --git a/src/platform_impl/ios/mod.rs b/src/platform_impl/ios/mod.rs index 9f3751029..c7c6ab9bd 100644 --- a/src/platform_impl/ios/mod.rs +++ b/src/platform_impl/ios/mod.rs @@ -82,7 +82,7 @@ use { WindowId as RootEventId, }; use events::{Touch, TouchPhase}; -use window::MonitorId as RootMonitorId; +use window::MonitorHandle as RootMonitorHandle; mod ffi; use self::ffi::{ @@ -145,19 +145,19 @@ impl Drop for DelegateState { } #[derive(Clone)] -pub struct MonitorId; +pub struct MonitorHandle; -impl fmt::Debug for MonitorId { +impl fmt::Debug for MonitorHandle { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { #[derive(Debug)] - struct MonitorId { + struct MonitorHandle { name: Option, dimensions: PhysicalSize, position: PhysicalPosition, hidpi_factor: f64, } - let monitor_id_proxy = MonitorId { + let monitor_id_proxy = MonitorHandle { name: self.get_name(), dimensions: self.get_dimensions(), position: self.get_position(), @@ -168,7 +168,7 @@ impl fmt::Debug for MonitorId { } } -impl MonitorId { +impl MonitorHandle { #[inline] pub fn get_uiscreen(&self) -> id { let class = class!(UIScreen); @@ -217,15 +217,15 @@ impl EventLoop { } #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { let mut rb = VecDeque::with_capacity(1); - rb.push_back(MonitorId); + rb.push_back(MonitorHandle); rb } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { - MonitorId + pub fn get_primary_monitor(&self) -> MonitorHandle { + MonitorHandle } pub fn poll_events(&mut self, mut callback: F) @@ -330,7 +330,7 @@ impl Window { (&mut *delegate).set_ivar("eventsQueue", mem::transmute::<_, *mut c_void>(events_queue)); // easiest? way to get access to PlatformSpecificWindowBuilderAttributes to configure the view - let rect: CGRect = msg_send![MonitorId.get_uiscreen(), bounds]; + let rect: CGRect = msg_send![MonitorHandle.get_uiscreen(), bounds]; let uiview_class = class!(UIView); let root_view_class = pl_attributes.root_view_class; @@ -462,7 +462,7 @@ impl Window { } #[inline] - pub fn set_fullscreen(&self, _monitor: Option) { + pub fn set_fullscreen(&self, _monitor: Option) { // N/A // iOS has single screen maximized apps so nothing to do } @@ -488,20 +488,20 @@ impl Window { } #[inline] - pub fn get_current_monitor(&self) -> RootMonitorId { - RootMonitorId { inner: MonitorId } + pub fn get_current_monitor(&self) -> RootMonitorHandle { + RootMonitorHandle { inner: MonitorHandle } } #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { let mut rb = VecDeque::with_capacity(1); - rb.push_back(MonitorId); + rb.push_back(MonitorHandle); rb } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { - MonitorId + pub fn get_primary_monitor(&self) -> MonitorHandle { + MonitorHandle } #[inline] diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index c1eea896a..b87de6e86 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -18,7 +18,7 @@ use { WindowAttributes, }; use dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize}; -use window::MonitorId as RootMonitorId; +use window::MonitorHandle as RootMonitorHandle; use self::x11::{XConnection, XError}; use self::x11::ffi::XVisualInfo; pub use self::x11::XNotSupported; @@ -72,49 +72,49 @@ pub enum DeviceId { } #[derive(Debug, Clone)] -pub enum MonitorId { - X(x11::MonitorId), - Wayland(wayland::MonitorId), +pub enum MonitorHandle { + X(x11::MonitorHandle), + Wayland(wayland::MonitorHandle), } -impl MonitorId { +impl MonitorHandle { #[inline] pub fn get_name(&self) -> Option { match self { - &MonitorId::X(ref m) => m.get_name(), - &MonitorId::Wayland(ref m) => m.get_name(), + &MonitorHandle::X(ref m) => m.get_name(), + &MonitorHandle::Wayland(ref m) => m.get_name(), } } #[inline] pub fn get_native_identifier(&self) -> u32 { match self { - &MonitorId::X(ref m) => m.get_native_identifier(), - &MonitorId::Wayland(ref m) => m.get_native_identifier(), + &MonitorHandle::X(ref m) => m.get_native_identifier(), + &MonitorHandle::Wayland(ref m) => m.get_native_identifier(), } } #[inline] pub fn get_dimensions(&self) -> PhysicalSize { match self { - &MonitorId::X(ref m) => m.get_dimensions(), - &MonitorId::Wayland(ref m) => m.get_dimensions(), + &MonitorHandle::X(ref m) => m.get_dimensions(), + &MonitorHandle::Wayland(ref m) => m.get_dimensions(), } } #[inline] pub fn get_position(&self) -> PhysicalPosition { match self { - &MonitorId::X(ref m) => m.get_position(), - &MonitorId::Wayland(ref m) => m.get_position(), + &MonitorHandle::X(ref m) => m.get_position(), + &MonitorHandle::Wayland(ref m) => m.get_position(), } } #[inline] pub fn get_hidpi_factor(&self) -> f64 { match self { - &MonitorId::X(ref m) => m.get_hidpi_factor(), - &MonitorId::Wayland(ref m) => m.get_hidpi_factor() as f64, + &MonitorHandle::X(ref m) => m.get_hidpi_factor(), + &MonitorHandle::Wayland(ref m) => m.get_hidpi_factor() as f64, } } } @@ -289,7 +289,7 @@ impl Window { } #[inline] - pub fn set_fullscreen(&self, monitor: Option) { + pub fn set_fullscreen(&self, monitor: Option) { match self { &Window::X(ref w) => w.set_fullscreen(monitor), &Window::Wayland(ref w) => w.set_fullscreen(monitor) @@ -329,32 +329,32 @@ impl Window { } #[inline] - pub fn get_current_monitor(&self) -> RootMonitorId { + pub fn get_current_monitor(&self) -> RootMonitorHandle { match self { - &Window::X(ref window) => RootMonitorId { inner: MonitorId::X(window.get_current_monitor()) }, - &Window::Wayland(ref window) => RootMonitorId { inner: MonitorId::Wayland(window.get_current_monitor()) }, + &Window::X(ref window) => RootMonitorHandle { inner: MonitorHandle::X(window.get_current_monitor()) }, + &Window::Wayland(ref window) => RootMonitorHandle { inner: MonitorHandle::Wayland(window.get_current_monitor()) }, } } #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { match self { &Window::X(ref window) => window.get_available_monitors() .into_iter() - .map(MonitorId::X) + .map(MonitorHandle::X) .collect(), &Window::Wayland(ref window) => window.get_available_monitors() .into_iter() - .map(MonitorId::Wayland) + .map(MonitorHandle::Wayland) .collect(), } } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { match self { - &Window::X(ref window) => MonitorId::X(window.get_primary_monitor()), - &Window::Wayland(ref window) => MonitorId::Wayland(window.get_primary_monitor()), + &Window::X(ref window) => MonitorHandle::X(window.get_primary_monitor()), + &Window::Wayland(ref window) => MonitorHandle::Wayland(window.get_primary_monitor()), } } } @@ -453,27 +453,27 @@ impl EventLoop { } #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { match *self { EventLoop::Wayland(ref evlp) => evlp .get_available_monitors() .into_iter() - .map(MonitorId::Wayland) + .map(MonitorHandle::Wayland) .collect(), EventLoop::X(ref evlp) => evlp .x_connection() .get_available_monitors() .into_iter() - .map(MonitorId::X) + .map(MonitorHandle::X) .collect(), } } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { match *self { - EventLoop::Wayland(ref evlp) => MonitorId::Wayland(evlp.get_primary_monitor()), - EventLoop::X(ref evlp) => MonitorId::X(evlp.x_connection().get_primary_monitor()), + EventLoop::Wayland(ref evlp) => MonitorHandle::Wayland(evlp.get_primary_monitor()), + EventLoop::X(ref evlp) => MonitorHandle::X(evlp.x_connection().get_primary_monitor()), } } diff --git a/src/platform_impl/linux/wayland/event_loop.rs b/src/platform_impl/linux/wayland/event_loop.rs index b54d1d791..eaa39fad6 100644 --- a/src/platform_impl/linux/wayland/event_loop.rs +++ b/src/platform_impl/linux/wayland/event_loop.rs @@ -211,11 +211,11 @@ impl EventLoop { } } - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { get_primary_monitor(&self.env.outputs) } - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { get_available_monitors(&self.env.outputs) } } @@ -452,24 +452,24 @@ impl Drop for SeatData { * Monitor stuff */ -pub struct MonitorId { +pub struct MonitorHandle { pub(crate) proxy: Proxy, pub(crate) mgr: OutputMgr, } -impl Clone for MonitorId { - fn clone(&self) -> MonitorId { - MonitorId { +impl Clone for MonitorHandle { + fn clone(&self) -> MonitorHandle { + MonitorHandle { proxy: self.proxy.clone(), mgr: self.mgr.clone(), } } } -impl fmt::Debug for MonitorId { +impl fmt::Debug for MonitorHandle { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { #[derive(Debug)] - struct MonitorId { + struct MonitorHandle { name: Option, native_identifier: u32, dimensions: PhysicalSize, @@ -477,7 +477,7 @@ impl fmt::Debug for MonitorId { hidpi_factor: i32, } - let monitor_id_proxy = MonitorId { + let monitor_id_proxy = MonitorHandle { name: self.get_name(), native_identifier: self.get_native_identifier(), dimensions: self.get_dimensions(), @@ -489,7 +489,7 @@ impl fmt::Debug for MonitorId { } } -impl MonitorId { +impl MonitorHandle { pub fn get_name(&self) -> Option { self.mgr.with_info(&self.proxy, |_, info| { format!("{} ({})", info.model, info.make) @@ -528,10 +528,10 @@ impl MonitorId { } } -pub fn get_primary_monitor(outputs: &OutputMgr) -> MonitorId { +pub fn get_primary_monitor(outputs: &OutputMgr) -> MonitorHandle { outputs.with_all(|list| { if let Some(&(_, ref proxy, _)) = list.first() { - MonitorId { + MonitorHandle { proxy: proxy.clone(), mgr: outputs.clone(), } @@ -541,10 +541,10 @@ pub fn get_primary_monitor(outputs: &OutputMgr) -> MonitorId { }) } -pub fn get_available_monitors(outputs: &OutputMgr) -> VecDeque { +pub fn get_available_monitors(outputs: &OutputMgr) -> VecDeque { outputs.with_all(|list| { list.iter() - .map(|&(_, ref proxy, _)| MonitorId { + .map(|&(_, ref proxy, _)| MonitorHandle { proxy: proxy.clone(), mgr: outputs.clone(), }) diff --git a/src/platform_impl/linux/wayland/mod.rs b/src/platform_impl/linux/wayland/mod.rs index aa3562f8c..065dabcc1 100644 --- a/src/platform_impl/linux/wayland/mod.rs +++ b/src/platform_impl/linux/wayland/mod.rs @@ -2,7 +2,7 @@ target_os = "netbsd", target_os = "openbsd"))] pub use self::window::Window; -pub use self::event_loop::{EventLoop, EventLoopProxy, EventLoopSink, MonitorId}; +pub use self::event_loop::{EventLoop, EventLoopProxy, EventLoopSink, MonitorHandle}; use sctk::reexports::client::protocol::wl_surface; use sctk::reexports::client::Proxy; diff --git a/src/platform_impl/linux/wayland/window.rs b/src/platform_impl/linux/wayland/window.rs index b0f28359b..dffd92622 100644 --- a/src/platform_impl/linux/wayland/window.rs +++ b/src/platform_impl/linux/wayland/window.rs @@ -3,8 +3,8 @@ use std::sync::{Arc, Mutex, Weak}; use {CreationError, MouseCursor, WindowAttributes}; use dpi::{LogicalPosition, LogicalSize}; -use platform_impl::MonitorId as PlatformMonitorId; -use window::MonitorId as RootMonitorId; +use platform_impl::MonitorHandle as PlatformMonitorHandle; +use window::MonitorHandle as RootMonitorHandle; use sctk::window::{ConceptFrame, Event as WEvent, Window as SWindow}; use sctk::reexports::client::{Display, Proxy}; @@ -13,7 +13,7 @@ use sctk::reexports::client::protocol::wl_compositor::RequestsTrait as Composito use sctk::reexports::client::protocol::wl_surface::RequestsTrait as SurfaceRequests; use sctk::output::OutputMgr; -use super::{make_wid, EventLoop, MonitorId, WindowId}; +use super::{make_wid, EventLoop, MonitorHandle, WindowId}; use platform_impl::platform::wayland::event_loop::{get_available_monitors, get_primary_monitor}; pub struct Window { @@ -42,7 +42,7 @@ impl Window { let window_store = evlp.store.clone(); surface.implement(move |event, surface| match event { wl_surface::Event::Enter { output } => { - let dpi_change = list.lock().unwrap().add_output(MonitorId { + let dpi_change = list.lock().unwrap().add_output(MonitorHandle { proxy: output, mgr: omgr.clone(), }); @@ -111,8 +111,8 @@ impl Window { } // Check for fullscreen requirements - if let Some(RootMonitorId { - inner: PlatformMonitorId::Wayland(ref monitor_id), + if let Some(RootMonitorHandle { + inner: PlatformMonitorHandle::Wayland(ref monitor_id), }) = attributes.fullscreen { frame.set_fullscreen(Some(&monitor_id.proxy)); @@ -247,9 +247,9 @@ impl Window { } } - pub fn set_fullscreen(&self, monitor: Option) { - if let Some(RootMonitorId { - inner: PlatformMonitorId::Wayland(ref monitor_id), + pub fn set_fullscreen(&self, monitor: Option) { + if let Some(RootMonitorHandle { + inner: PlatformMonitorHandle::Wayland(ref monitor_id), }) = monitor { self.frame @@ -289,18 +289,18 @@ impl Window { &self.surface } - pub fn get_current_monitor(&self) -> MonitorId { + pub fn get_current_monitor(&self) -> MonitorHandle { // we don't know how much each monitor sees us so... // just return the most recent one ? let guard = self.monitors.lock().unwrap(); guard.monitors.last().unwrap().clone() } - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { get_available_monitors(&self.outputs) } - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { get_primary_monitor(&self.outputs) } } @@ -412,7 +412,7 @@ impl WindowStore { */ struct MonitorList { - monitors: Vec + monitors: Vec } impl MonitorList { @@ -431,7 +431,7 @@ impl MonitorList { factor } - fn add_output(&mut self, monitor: MonitorId) -> Option { + fn add_output(&mut self, monitor: MonitorHandle) -> Option { let old_dpi = self.compute_hidpi_factor(); let monitor_dpi = monitor.get_hidpi_factor(); self.monitors.push(monitor); diff --git a/src/platform_impl/linux/x11/mod.rs b/src/platform_impl/linux/x11/mod.rs index e87439e2f..d97bb8a07 100644 --- a/src/platform_impl/linux/x11/mod.rs +++ b/src/platform_impl/linux/x11/mod.rs @@ -9,7 +9,7 @@ mod dnd; mod ime; pub mod util; -pub use self::monitor::MonitorId; +pub use self::monitor::MonitorHandle; pub use self::window::UnownedWindow; pub use self::xdisplay::{XConnection, XNotSupported, XError}; diff --git a/src/platform_impl/linux/x11/monitor.rs b/src/platform_impl/linux/x11/monitor.rs index 5912d7724..eb313d327 100644 --- a/src/platform_impl/linux/x11/monitor.rs +++ b/src/platform_impl/linux/x11/monitor.rs @@ -20,7 +20,7 @@ const DISABLE_MONITOR_LIST_CACHING: bool = false; lazy_static! { static ref XRANDR_VERSION: Mutex> = Mutex::default(); - static ref MONITORS: Mutex>> = Mutex::default(); + static ref MONITORS: Mutex>> = Mutex::default(); } fn version_is_at_least(major: c_int, minor: c_int) -> bool { @@ -35,13 +35,13 @@ fn version_is_at_least(major: c_int, minor: c_int) -> bool { } } -pub fn invalidate_cached_monitor_list() -> Option> { +pub fn invalidate_cached_monitor_list() -> Option> { // We update this lazily. (*MONITORS.lock()).take() } #[derive(Debug, Clone)] -pub struct MonitorId { +pub struct MonitorHandle { /// The actual id id: u32, /// The name of the monitor @@ -58,7 +58,7 @@ pub struct MonitorId { pub(crate) rect: util::AaRect, } -impl MonitorId { +impl MonitorHandle { fn from_repr( xconn: &XConnection, resources: *mut XRRScreenResources, @@ -69,7 +69,7 @@ impl MonitorId { let (name, hidpi_factor) = unsafe { xconn.get_output_info(resources, &repr) }; let (dimensions, position) = unsafe { (repr.get_dimensions(), repr.get_position()) }; let rect = util::AaRect::new(position, dimensions); - MonitorId { + MonitorHandle { id, name, hidpi_factor, @@ -104,7 +104,7 @@ impl MonitorId { } impl XConnection { - pub fn get_monitor_for_window(&self, window_rect: Option) -> MonitorId { + pub fn get_monitor_for_window(&self, window_rect: Option) -> MonitorHandle { let monitors = self.get_available_monitors(); let default = monitors .get(0) @@ -128,7 +128,7 @@ impl XConnection { matched_monitor.to_owned() } - fn query_monitor_list(&self) -> Vec { + fn query_monitor_list(&self) -> Vec { unsafe { let root = (self.xlib.XDefaultRootWindow)(self.display); // WARNING: this function is supposedly very slow, on the order of hundreds of ms. @@ -153,7 +153,7 @@ impl XConnection { let monitor = monitors.offset(monitor_index as isize); let is_primary = (*monitor).primary != 0; has_primary |= is_primary; - available.push(MonitorId::from_repr( + available.push(MonitorHandle::from_repr( self, resources, monitor_index as u32, @@ -176,7 +176,7 @@ impl XConnection { let crtc = util::MonitorRepr::from(crtc); let is_primary = crtc.get_output() == primary; has_primary |= is_primary; - available.push(MonitorId::from_repr( + available.push(MonitorHandle::from_repr( self, resources, crtc_id as u32, @@ -201,7 +201,7 @@ impl XConnection { } } - pub fn get_available_monitors(&self) -> Vec { + pub fn get_available_monitors(&self) -> Vec { let mut monitors_lock = MONITORS.lock(); (*monitors_lock) .as_ref() @@ -217,7 +217,7 @@ impl XConnection { } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { self.get_available_monitors() .into_iter() .find(|monitor| monitor.primary) diff --git a/src/platform_impl/linux/x11/window.rs b/src/platform_impl/linux/x11/window.rs index f37a55743..890f142b0 100644 --- a/src/platform_impl/linux/x11/window.rs +++ b/src/platform_impl/linux/x11/window.rs @@ -10,10 +10,10 @@ use parking_lot::Mutex; use {Icon, MouseCursor, WindowAttributes}; use CreationError::{self, OsError}; use dpi::{LogicalPosition, LogicalSize}; -use platform_impl::MonitorId as PlatformMonitorId; +use platform_impl::MonitorHandle as PlatformMonitorHandle; use platform_impl::PlatformSpecificWindowBuilderAttributes; -use platform_impl::x11::MonitorId as X11MonitorId; -use window::MonitorId as RootMonitorId; +use platform_impl::x11::MonitorHandle as X11MonitorHandle; +use window::MonitorHandle as RootMonitorHandle; use super::{ffi, util, ImeSender, XConnection, XError, WindowId, EventLoop}; @@ -35,7 +35,7 @@ pub struct SharedState { pub inner_position: Option<(i32, i32)>, pub inner_position_rel_parent: Option<(i32, i32)>, pub guessed_dpi: Option, - pub last_monitor: Option, + pub last_monitor: Option, pub dpi_adjusted: Option<(f64, f64)>, // Used to restore position after exiting fullscreen. pub restore_position: Option<(i32, i32)>, @@ -511,7 +511,7 @@ impl UnownedWindow { self.set_netwm(fullscreen.into(), (fullscreen_atom as c_long, 0, 0, 0)) } - fn set_fullscreen_inner(&self, monitor: Option) -> util::Flusher { + fn set_fullscreen_inner(&self, monitor: Option) -> util::Flusher { match monitor { None => { let flusher = self.set_fullscreen_hint(false); @@ -520,7 +520,7 @@ impl UnownedWindow { } flusher }, - Some(RootMonitorId { inner: PlatformMonitorId::X(monitor) }) => { + Some(RootMonitorHandle { inner: PlatformMonitorHandle::X(monitor) }) => { let window_position = self.get_position_physical(); self.shared_state.lock().restore_position = window_position; let monitor_origin: (i32, i32) = monitor.get_position().into(); @@ -532,7 +532,7 @@ impl UnownedWindow { } #[inline] - pub fn set_fullscreen(&self, monitor: Option) { + pub fn set_fullscreen(&self, monitor: Option) { self.set_fullscreen_inner(monitor) .flush() .expect("Failed to change window fullscreen state"); @@ -549,7 +549,7 @@ impl UnownedWindow { } #[inline] - pub fn get_current_monitor(&self) -> X11MonitorId { + pub fn get_current_monitor(&self) -> X11MonitorHandle { let monitor = self.shared_state .lock() .last_monitor @@ -563,11 +563,11 @@ impl UnownedWindow { }) } - pub fn get_available_monitors(&self) -> Vec { + pub fn get_available_monitors(&self) -> Vec { self.xconn.get_available_monitors() } - pub fn get_primary_monitor(&self) -> X11MonitorId { + pub fn get_primary_monitor(&self) -> X11MonitorHandle { self.xconn.get_primary_monitor() } diff --git a/src/platform_impl/macos/mod.rs b/src/platform_impl/macos/mod.rs index 5c9de5d2a..e97d18903 100644 --- a/src/platform_impl/macos/mod.rs +++ b/src/platform_impl/macos/mod.rs @@ -1,7 +1,7 @@ #![cfg(target_os = "macos")] pub use self::event_loop::{EventLoop, Proxy as EventLoopProxy}; -pub use self::monitor::MonitorId; +pub use self::monitor::MonitorHandle; pub use self::window::{Id as WindowId, PlatformSpecificWindowBuilderAttributes, Window2}; use std::sync::Arc; diff --git a/src/platform_impl/macos/monitor.rs b/src/platform_impl/macos/monitor.rs index 062cf73c3..7b3e84883 100644 --- a/src/platform_impl/macos/monitor.rs +++ b/src/platform_impl/macos/monitor.rs @@ -11,13 +11,13 @@ use super::EventLoop; use super::window::{IdRef, Window2}; #[derive(Clone, PartialEq)] -pub struct MonitorId(CGDirectDisplayID); +pub struct MonitorHandle(CGDirectDisplayID); -fn get_available_monitors() -> VecDeque { +fn get_available_monitors() -> VecDeque { if let Ok(displays) = CGDisplay::active_displays() { let mut monitors = VecDeque::with_capacity(displays.len()); for d in displays { - monitors.push_back(MonitorId(d)); + monitors.push_back(MonitorHandle(d)); } monitors } else { @@ -25,44 +25,44 @@ fn get_available_monitors() -> VecDeque { } } -pub fn get_primary_monitor() -> MonitorId { - let id = MonitorId(CGDisplay::main().id); +pub fn get_primary_monitor() -> MonitorHandle { + let id = MonitorHandle(CGDisplay::main().id); id } impl EventLoop { #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { get_available_monitors() } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { get_primary_monitor() } - pub fn make_monitor_from_display(id: CGDirectDisplayID) -> MonitorId { - let id = MonitorId(id); + pub fn make_monitor_from_display(id: CGDirectDisplayID) -> MonitorHandle { + let id = MonitorHandle(id); id } } impl Window2 { #[inline] - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { get_available_monitors() } #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { get_primary_monitor() } } -impl fmt::Debug for MonitorId { +impl fmt::Debug for MonitorHandle { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { #[derive(Debug)] - struct MonitorId { + struct MonitorHandle { name: Option, native_identifier: u32, dimensions: PhysicalSize, @@ -70,7 +70,7 @@ impl fmt::Debug for MonitorId { hidpi_factor: f64, } - let monitor_id_proxy = MonitorId { + let monitor_id_proxy = MonitorHandle { name: self.get_name(), native_identifier: self.get_native_identifier(), dimensions: self.get_dimensions(), @@ -82,9 +82,9 @@ impl fmt::Debug for MonitorId { } } -impl MonitorId { +impl MonitorHandle { pub fn get_name(&self) -> Option { - let MonitorId(display_id) = *self; + let MonitorHandle(display_id) = *self; let screen_num = CGDisplay::new(display_id).model_number(); Some(format!("Monitor #{}", screen_num)) } @@ -95,7 +95,7 @@ impl MonitorId { } pub fn get_dimensions(&self) -> PhysicalSize { - let MonitorId(display_id) = *self; + let MonitorHandle(display_id) = *self; let display = CGDisplay::new(display_id); let height = display.pixels_high(); let width = display.pixels_wide(); diff --git a/src/platform_impl/macos/window.rs b/src/platform_impl/macos/window.rs index 30a305c44..c1c25d943 100644 --- a/src/platform_impl/macos/window.rs +++ b/src/platform_impl/macos/window.rs @@ -44,7 +44,7 @@ use os::macos::{ActivationPolicy, WindowExt}; use platform_impl::platform::{ffi, util}; use platform_impl::platform::event_loop::{EventLoop, Shared}; use platform_impl::platform::view::{new_view, set_ime_spot}; -use window::MonitorId as RootMonitorId; +use window::MonitorHandle as RootMonitorHandle; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Id(pub usize); @@ -537,13 +537,13 @@ pub struct Window2 { unsafe impl Send for Window2 {} unsafe impl Sync for Window2 {} -unsafe fn get_current_monitor(window: id) -> RootMonitorId { +unsafe fn get_current_monitor(window: id) -> RootMonitorHandle { let screen: id = msg_send![window, screen]; let desc = NSScreen::deviceDescription(screen); let key = IdRef::new(NSString::alloc(nil).init_str("NSScreenNumber")); let value = NSDictionary::valueForKey_(desc, *key); let display_id = msg_send![value, unsignedIntegerValue]; - RootMonitorId { inner: EventLoop::make_monitor_from_display(display_id) } + RootMonitorHandle { inner: EventLoop::make_monitor_from_display(display_id) } } impl Drop for Window2 { @@ -1084,7 +1084,7 @@ impl Window2 { #[inline] /// TODO: Right now set_fullscreen do not work on switching monitors /// in fullscreen mode - pub fn set_fullscreen(&self, monitor: Option) { + pub fn set_fullscreen(&self, monitor: Option) { let state = &self.delegate.state; let current = { let win_attribs = state.win_attribs.borrow_mut(); @@ -1186,7 +1186,7 @@ impl Window2 { } #[inline] - pub fn get_current_monitor(&self) -> RootMonitorId { + pub fn get_current_monitor(&self) -> RootMonitorHandle { unsafe { self::get_current_monitor(*self.window) } diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index 5cafe32d0..d28f2ac0b 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -41,7 +41,7 @@ use winapi::um::{winuser, winbase, ole2, processthreadsapi, commctrl, libloadera use winapi::um::winnt::{LONG, LPCSTR, SHORT}; use window::WindowId as RootWindowId; -use monitor::MonitorId; +use monitor::MonitorHandle; use event_loop::{ControlFlow, EventLoop as RootEventLoop, EventLoopClosed}; use dpi::{LogicalPosition, LogicalSize, PhysicalSize}; use event::{DeviceEvent, Touch, TouchPhase, StartCause, KeyboardInput, Event, WindowEvent}; @@ -91,7 +91,7 @@ pub struct WindowState { // This is different from the value in `SavedWindowInfo`! That one represents the DPI saved upon entering // fullscreen. This will always be the most recent DPI for the window. pub dpi_factor: f64, - pub fullscreen: Option, + pub fullscreen: Option, pub window_icon: Option, pub taskbar_icon: Option, pub decorations: bool, diff --git a/src/platform_impl/windows/mod.rs b/src/platform_impl/windows/mod.rs index f6c5ed629..5e989bf0b 100644 --- a/src/platform_impl/windows/mod.rs +++ b/src/platform_impl/windows/mod.rs @@ -4,7 +4,7 @@ use winapi; use winapi::shared::windef::HWND; pub use self::event_loop::{EventLoop, EventLoopProxy}; -pub use self::monitor::MonitorId; +pub use self::monitor::MonitorHandle; pub use self::window::Window; use window::Icon; diff --git a/src/platform_impl/windows/monitor.rs b/src/platform_impl/windows/monitor.rs index 67c4aa062..19c981ec2 100644 --- a/src/platform_impl/windows/monitor.rs +++ b/src/platform_impl/windows/monitor.rs @@ -11,9 +11,9 @@ use dpi::{PhysicalPosition, PhysicalSize}; use platform_impl::platform::dpi::{dpi_to_scale_factor, get_monitor_dpi}; use platform_impl::platform::window::Window; -/// Win32 implementation of the main `MonitorId` object. +/// Win32 implementation of the main `MonitorHandle` object. #[derive(Debug, Clone)] -pub struct MonitorId { +pub struct MonitorHandle { /// Monitor handle. hmonitor: HMonitor, /// The system name of the monitor. @@ -45,13 +45,13 @@ unsafe extern "system" fn monitor_enum_proc( _place: LPRECT, data: LPARAM, ) -> BOOL { - let monitors = data as *mut VecDeque; - (*monitors).push_back(MonitorId::from_hmonitor(hmonitor)); + let monitors = data as *mut VecDeque; + (*monitors).push_back(MonitorHandle::from_hmonitor(hmonitor)); TRUE // continue enumeration } -pub fn get_available_monitors() -> VecDeque { - let mut monitors: VecDeque = VecDeque::new(); +pub fn get_available_monitors() -> VecDeque { + let mut monitors: VecDeque = VecDeque::new(); unsafe { winuser::EnumDisplayMonitors( ptr::null_mut(), @@ -63,38 +63,38 @@ pub fn get_available_monitors() -> VecDeque { monitors } -pub fn get_primary_monitor() -> MonitorId { +pub fn get_primary_monitor() -> MonitorHandle { const ORIGIN: POINT = POINT { x: 0, y: 0 }; let hmonitor = unsafe { winuser::MonitorFromPoint(ORIGIN, winuser::MONITOR_DEFAULTTOPRIMARY) }; - MonitorId::from_hmonitor(hmonitor) + MonitorHandle::from_hmonitor(hmonitor) } -pub fn get_current_monitor(hwnd: HWND) -> MonitorId { +pub fn get_current_monitor(hwnd: HWND) -> MonitorHandle { let hmonitor = unsafe { winuser::MonitorFromWindow(hwnd, winuser::MONITOR_DEFAULTTONEAREST) }; - MonitorId::from_hmonitor(hmonitor) + MonitorHandle::from_hmonitor(hmonitor) } impl EventLoop { // TODO: Investigate opportunities for caching - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { get_available_monitors() } - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { get_primary_monitor() } } impl Window { - pub fn get_available_monitors(&self) -> VecDeque { + pub fn get_available_monitors(&self) -> VecDeque { get_available_monitors() } - pub fn get_primary_monitor(&self) -> MonitorId { + pub fn get_primary_monitor(&self) -> MonitorHandle { get_primary_monitor() } } @@ -115,7 +115,7 @@ fn get_monitor_info(hmonitor: HMONITOR) -> Result Self { let monitor_info = get_monitor_info(hmonitor).expect("`GetMonitorInfoW` failed"); let place = monitor_info.rcMonitor; @@ -123,7 +123,7 @@ impl MonitorId { (place.right - place.left) as u32, (place.bottom - place.top) as u32, ); - MonitorId { + MonitorHandle { hmonitor: HMonitor(hmonitor), monitor_name: util::wchar_ptr_to_string(monitor_info.szDevice.as_ptr()), primary: util::has_flag(monitor_info.dwFlags, winuser::MONITORINFOF_PRIMARY), diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index d1e2b0b21..79b2d23d0 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -20,7 +20,7 @@ use winapi::um::winnt::{LONG, LPCWSTR}; use window::{CreationError, Icon, WindowAttributes, MouseCursor}; use dpi::{LogicalPosition, LogicalSize, PhysicalSize}; -use monitor::MonitorId as RootMonitorId; +use monitor::MonitorHandle as RootMonitorHandle; use platform_impl::platform::{Cursor, PlatformSpecificWindowBuilderAttributes, WindowId}; use platform_impl::platform::dpi::{dpi_to_scale_factor, get_hwnd_dpi}; use platform_impl::platform::event_loop::{self, EventLoop, DESTROY_MSG_ID, INITIAL_DPI_MSG_ID, REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID}; @@ -606,11 +606,11 @@ impl Window { } #[inline] - pub fn set_fullscreen(&self, monitor: Option) { + pub fn set_fullscreen(&self, monitor: Option) { let mut window_state_lock = self.window_state.lock(); unsafe { let monitor_rect = monitor.as_ref() - .map(|RootMonitorId{ ref inner }| { + .map(|RootMonitorHandle{ ref inner }| { let (x, y): (i32, i32) = inner.get_position().into(); let (width, height): (u32, u32) = inner.get_dimensions().into(); (x, y, width, height) @@ -772,8 +772,8 @@ impl Window { } #[inline] - pub fn get_current_monitor(&self) -> RootMonitorId { - RootMonitorId { + pub fn get_current_monitor(&self) -> RootMonitorHandle { + RootMonitorHandle { inner: monitor::get_current_monitor(self.window.0), } } diff --git a/src/window.rs b/src/window.rs index bd428809e..eeed57aa3 100644 --- a/src/window.rs +++ b/src/window.rs @@ -3,7 +3,7 @@ use std::{fmt, error}; use platform_impl; use event_loop::EventLoop; -use monitor::{AvailableMonitorsIter, MonitorId}; +use monitor::{AvailableMonitorsIter, MonitorHandle}; use dpi::{LogicalPosition, LogicalSize}; pub use icon::*; @@ -93,7 +93,7 @@ pub struct WindowAttributes { /// Whether the window should be set as fullscreen upon creation. /// /// The default is `None`. - pub fullscreen: Option, + pub fullscreen: Option, /// The title of the window in the title bar. /// @@ -210,10 +210,10 @@ impl WindowBuilder { self } - /// Sets the window fullscreen state. None means a normal window, Some(MonitorId) + /// Sets the window fullscreen state. None means a normal window, Some(MonitorHandle) /// means a fullscreen window on that specific monitor #[inline] - pub fn with_fullscreen(mut self, monitor: Option) -> WindowBuilder { + pub fn with_fullscreen(mut self, monitor: Option) -> WindowBuilder { self.window.fullscreen = monitor; self } @@ -521,7 +521,7 @@ impl Window { /// Sets the window to fullscreen or back #[inline] - pub fn set_fullscreen(&self, monitor: Option) { + pub fn set_fullscreen(&self, monitor: Option) { self.window.set_fullscreen(monitor) } @@ -558,7 +558,7 @@ impl Window { /// Returns the monitor on which the window currently resides #[inline] - pub fn get_current_monitor(&self) -> MonitorId { + pub fn get_current_monitor(&self) -> MonitorHandle { self.window.get_current_monitor() } @@ -575,8 +575,8 @@ impl Window { /// /// This is the same as `EventLoop::get_primary_monitor`, and is provided for convenience. #[inline] - pub fn get_primary_monitor(&self) -> MonitorId { - MonitorId { inner: self.window.get_primary_monitor() } + pub fn get_primary_monitor(&self) -> MonitorHandle { + MonitorHandle { inner: self.window.get_primary_monitor() } } /// Returns an identifier unique to the window. diff --git a/tests/send_objects.rs b/tests/send_objects.rs index c2e890f86..d4402aaca 100644 --- a/tests/send_objects.rs +++ b/tests/send_objects.rs @@ -19,5 +19,5 @@ fn ids_send() { // ensures that the various `..Id` types implement `Send` needs_send::(); needs_send::(); - needs_send::(); + needs_send::(); }