Convert new fullscreen API in all platforms

This commit is contained in:
Pedro Côrte-Real 2017-08-29 01:46:03 +01:00
parent 1382adbf11
commit 9693f7caa9
10 changed files with 14 additions and 28 deletions

View file

@ -15,6 +15,7 @@ use std::collections::VecDeque;
use CursorState;
use WindowAttributes;
use FullScreenState;
use native_monitor::NativeMonitorId;
gen_api_transition!();
@ -24,7 +25,7 @@ pub struct Window {
event_rx: Receiver<android_glue::Event>,
}
#[derive(Clone, PartialEq)]
#[derive(Clone)]
pub struct MonitorId;
mod ffi;
@ -266,7 +267,7 @@ impl Window {
}
#[inline]
pub fn set_fullscreen_windowed(&self, fullscreen: bool) {
pub fn set_fullscreen(&self, state: FullScreenState) {
}
}

View file

@ -71,7 +71,7 @@ use objc::runtime::{Class, Object, Sel, BOOL, YES };
use objc::declare::{ ClassDecl };
use native_monitor::NativeMonitorId;
use { CreationError, CursorState, MouseCursor, WindowAttributes };
use { CreationError, CursorState, MouseCursor, WindowAttributes, FullScreenState };
use WindowEvent as Event;
use events::{ Touch, TouchPhase };
@ -94,7 +94,7 @@ use self::ffi::{
static mut jmpbuf: [c_int;27] = [0;27];
#[derive(Clone, PartialEq)]
#[derive(Clone)]
pub struct MonitorId;
pub struct Window {
@ -454,7 +454,7 @@ impl Window {
}
#[inline]
pub fn set_fullscreen_windowed(&self, fullscreen: bool) {
pub fn set_fullscreen(&self, state: FullScreenState) {
}
}

View file

@ -97,7 +97,7 @@ pub enum DeviceId {
Wayland(wayland::DeviceId)
}
#[derive(Clone, PartialEq)]
#[derive(Clone)]
pub enum MonitorId {
#[doc(hidden)]
X(x11::MonitorId),

View file

@ -359,12 +359,6 @@ pub struct MonitorId {
ctxt: Arc<WaylandContext>
}
impl PartialEq for MonitorId {
fn eq(&self, other: &MonitorId) -> bool {
self.id == other.id
}
}
impl MonitorId {
pub fn get_name(&self) -> Option<String> {
let mut guard = self.ctxt.evq.lock().unwrap();

View file

@ -6,11 +6,6 @@ use native_monitor::NativeMonitorId;
#[derive(Clone)]
pub struct MonitorId(pub Arc<XConnection>, pub u32);
impl PartialEq for MonitorId {
fn eq(&self, other: &MonitorId) -> bool {
self.1 == other.1
}
}
pub fn get_available_monitors(x: &Arc<XConnection>) -> VecDeque<MonitorId> {
let nb_monitors = unsafe { (x.xlib.XScreenCount)(x.display) };

View file

@ -2,7 +2,7 @@ use core_graphics::display;
use std::collections::VecDeque;
use native_monitor::NativeMonitorId;
#[derive(Clone, PartialEq)]
#[derive(Clone)]
pub struct MonitorId(u32);
pub fn get_available_monitors() -> VecDeque<MonitorId> {

View file

@ -3,6 +3,7 @@ use CreationError::OsError;
use libc;
use WindowAttributes;
use FullScreenState;
use native_monitor::NativeMonitorId;
use os::macos::ActivationPolicy;
use os::macos::WindowExt;
@ -643,7 +644,7 @@ impl Window {
}
#[inline]
pub fn set_fullscreen_windowed(&self, fullscreen: bool) {
pub fn set_fullscreen(&self, state: FullScreenState) {
}
}

View file

@ -34,12 +34,6 @@ pub struct MonitorId {
dimensions: (u32, u32),
}
impl PartialEq for MonitorId {
fn eq(&self, other: &MonitorId) -> bool {
self.monitor_name == other.monitor_name
}
}
struct DeviceEnumerator {
parent_device: *const winapi::WCHAR,
current_index: u32,

View file

@ -20,6 +20,7 @@ use CreationError;
use CursorState;
use MouseCursor;
use WindowAttributes;
use FullScreenState;
use dwmapi;
use kernel32;
@ -282,7 +283,7 @@ impl Window {
}
#[inline]
pub fn set_fullscreen_windowed(&self, fullscreen: bool) {
pub fn set_fullscreen(&self, state: FullScreenState) {
}
}
@ -329,7 +330,7 @@ unsafe fn init(window: WindowAttributes, pl_attribs: PlatformSpecificWindowBuild
// and change the monitor's resolution if necessary
if let Some(ref monitor) = window.fullscreen.get_monitor() {
try!(switch_to_fullscreen(&mut rect, monitor));
}
};
let fullscreen = window.fullscreen.get_monitor().is_some();

View file

@ -370,7 +370,7 @@ pub fn get_primary_monitor() -> MonitorId {
}
/// Identifier for a monitor.
#[derive(Clone, PartialEq)]
#[derive(Clone)]
pub struct MonitorId(pub platform::MonitorId);
impl MonitorId {