Rework MonitorId::get_native_identifier (#267)

* Rework MonitorId::get_native_identifier

* Try fix compilation

* Returns the monitor ID on wayland as well

* Try fix compilation

* Fix iOS compilation
This commit is contained in:
tomaka authored and GitHub committed 2017-08-30 08:49:18 +02:00
1 parent f7a8bcddb8
commit 7dc6fcdedc
16 files changed
+67 -69

No files matched your search

+1 -1
View File
@@ -142,7 +142,7 @@ impl MonitorId {
}
#[inline]
pub fn get_native_identifier(&self) -> ::native_monitor::NativeMonitorId {
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(),
+2 -2
View File
@@ -372,8 +372,8 @@ impl MonitorId {
}
#[inline]
pub fn get_native_identifier(&self) -> ::native_monitor::NativeMonitorId {
::native_monitor::NativeMonitorId::Unavailable
pub fn get_native_identifier(&self) -> u32 {
self.id
}
pub fn get_dimensions(&self) -> (u32, u32) {
+1 -1
View File
@@ -56,7 +56,7 @@ impl Window {
*(decorated.handler()) = Some(DecoratedHandler::new());
// set fullscreen if necessary
if let FullScreenState::Exclusive(RootMonitorId(PlatformMonitorId::Wayland(ref monitor_id))) = attributes.fullscreen {
if let FullScreenState::Exclusive(RootMonitorId { inner: PlatformMonitorId::Wayland(ref monitor_id) }) = attributes.fullscreen {
ctxt.with_output(monitor_id.clone(), |output| {
decorated.set_fullscreen(Some(output))
});
+2 -3
View File
@@ -2,7 +2,6 @@ use std::collections::VecDeque;
use std::sync::Arc;
use super::XConnection;
use native_monitor::NativeMonitorId;
#[derive(Clone)]
pub struct MonitorId(pub Arc<XConnection>, pub u32);
@@ -30,8 +29,8 @@ impl MonitorId {
}
#[inline]
pub fn get_native_identifier(&self) -> NativeMonitorId {
NativeMonitorId::Numeric(self.1)
pub fn get_native_identifier(&self) -> u32 {
self.1
}
pub fn get_dimensions(&self) -> (u32, u32) {
+2 -2
View File
@@ -215,7 +215,7 @@ impl Window {
let screen_id = match pl_attribs.screen_id {
Some(id) => id,
None => match window_attrs.fullscreen {
FullScreenState::Exclusive(RootMonitorId(PlatformMonitorId::X(X11MonitorId(_, monitor)))) => monitor as i32,
FullScreenState::Exclusive(RootMonitorId { inner: PlatformMonitorId::X(X11MonitorId(_, monitor)) }) => monitor as i32,
_ => unsafe { (display.xlib.XDefaultScreen)(display.display) },
}
};
@@ -458,7 +458,7 @@ impl Window {
self.x.switch_from_fullscreen_mode();
Window::set_netwm(&self.x.display, self.x.window, self.x.root, "_NET_WM_STATE_FULLSCREEN", true);
},
FullScreenState::Exclusive(RootMonitorId(PlatformMonitorId::X(X11MonitorId(_, monitor)))) => {
FullScreenState::Exclusive(RootMonitorId { inner: PlatformMonitorId::X(X11MonitorId(_, monitor)) }) => {
if let Some(dimensions) = self.get_inner_size() {
self.x.switch_to_fullscreen_mode(monitor as i32, dimensions.0 as u16, dimensions.1 as u16);
Window::set_netwm(&self.x.display, self.x.window, self.x.root, "_NET_WM_STATE_FULLSCREEN", true);