mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 22:30:04 -04:00
Convert new fullscreen API in all platforms
This commit is contained in:
@@ -15,6 +15,7 @@ use std::collections::VecDeque;
|
|||||||
|
|
||||||
use CursorState;
|
use CursorState;
|
||||||
use WindowAttributes;
|
use WindowAttributes;
|
||||||
|
use FullScreenState;
|
||||||
use native_monitor::NativeMonitorId;
|
use native_monitor::NativeMonitorId;
|
||||||
|
|
||||||
gen_api_transition!();
|
gen_api_transition!();
|
||||||
@@ -24,7 +25,7 @@ pub struct Window {
|
|||||||
event_rx: Receiver<android_glue::Event>,
|
event_rx: Receiver<android_glue::Event>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone)]
|
||||||
pub struct MonitorId;
|
pub struct MonitorId;
|
||||||
|
|
||||||
mod ffi;
|
mod ffi;
|
||||||
@@ -266,7 +267,7 @@ impl Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_fullscreen_windowed(&self, fullscreen: bool) {
|
pub fn set_fullscreen(&self, state: FullScreenState) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ use objc::runtime::{Class, Object, Sel, BOOL, YES };
|
|||||||
use objc::declare::{ ClassDecl };
|
use objc::declare::{ ClassDecl };
|
||||||
|
|
||||||
use native_monitor::NativeMonitorId;
|
use native_monitor::NativeMonitorId;
|
||||||
use { CreationError, CursorState, MouseCursor, WindowAttributes };
|
use { CreationError, CursorState, MouseCursor, WindowAttributes, FullScreenState };
|
||||||
use WindowEvent as Event;
|
use WindowEvent as Event;
|
||||||
use events::{ Touch, TouchPhase };
|
use events::{ Touch, TouchPhase };
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ use self::ffi::{
|
|||||||
|
|
||||||
static mut jmpbuf: [c_int;27] = [0;27];
|
static mut jmpbuf: [c_int;27] = [0;27];
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone)]
|
||||||
pub struct MonitorId;
|
pub struct MonitorId;
|
||||||
|
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
@@ -454,7 +454,7 @@ impl Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_fullscreen_windowed(&self, fullscreen: bool) {
|
pub fn set_fullscreen(&self, state: FullScreenState) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ pub enum DeviceId {
|
|||||||
Wayland(wayland::DeviceId)
|
Wayland(wayland::DeviceId)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone)]
|
||||||
pub enum MonitorId {
|
pub enum MonitorId {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
X(x11::MonitorId),
|
X(x11::MonitorId),
|
||||||
|
|||||||
@@ -359,12 +359,6 @@ pub struct MonitorId {
|
|||||||
ctxt: Arc<WaylandContext>
|
ctxt: Arc<WaylandContext>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for MonitorId {
|
|
||||||
fn eq(&self, other: &MonitorId) -> bool {
|
|
||||||
self.id == other.id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl MonitorId {
|
impl MonitorId {
|
||||||
pub fn get_name(&self) -> Option<String> {
|
pub fn get_name(&self) -> Option<String> {
|
||||||
let mut guard = self.ctxt.evq.lock().unwrap();
|
let mut guard = self.ctxt.evq.lock().unwrap();
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ use native_monitor::NativeMonitorId;
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct MonitorId(pub Arc<XConnection>, pub u32);
|
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> {
|
pub fn get_available_monitors(x: &Arc<XConnection>) -> VecDeque<MonitorId> {
|
||||||
let nb_monitors = unsafe { (x.xlib.XScreenCount)(x.display) };
|
let nb_monitors = unsafe { (x.xlib.XScreenCount)(x.display) };
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use core_graphics::display;
|
|||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use native_monitor::NativeMonitorId;
|
use native_monitor::NativeMonitorId;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone)]
|
||||||
pub struct MonitorId(u32);
|
pub struct MonitorId(u32);
|
||||||
|
|
||||||
pub fn get_available_monitors() -> VecDeque<MonitorId> {
|
pub fn get_available_monitors() -> VecDeque<MonitorId> {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use CreationError::OsError;
|
|||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
use WindowAttributes;
|
use WindowAttributes;
|
||||||
|
use FullScreenState;
|
||||||
use native_monitor::NativeMonitorId;
|
use native_monitor::NativeMonitorId;
|
||||||
use os::macos::ActivationPolicy;
|
use os::macos::ActivationPolicy;
|
||||||
use os::macos::WindowExt;
|
use os::macos::WindowExt;
|
||||||
@@ -643,7 +644,7 @@ impl Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_fullscreen_windowed(&self, fullscreen: bool) {
|
pub fn set_fullscreen(&self, state: FullScreenState) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,6 @@ pub struct MonitorId {
|
|||||||
dimensions: (u32, u32),
|
dimensions: (u32, u32),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for MonitorId {
|
|
||||||
fn eq(&self, other: &MonitorId) -> bool {
|
|
||||||
self.monitor_name == other.monitor_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DeviceEnumerator {
|
struct DeviceEnumerator {
|
||||||
parent_device: *const winapi::WCHAR,
|
parent_device: *const winapi::WCHAR,
|
||||||
current_index: u32,
|
current_index: u32,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use CreationError;
|
|||||||
use CursorState;
|
use CursorState;
|
||||||
use MouseCursor;
|
use MouseCursor;
|
||||||
use WindowAttributes;
|
use WindowAttributes;
|
||||||
|
use FullScreenState;
|
||||||
|
|
||||||
use dwmapi;
|
use dwmapi;
|
||||||
use kernel32;
|
use kernel32;
|
||||||
@@ -282,7 +283,7 @@ impl Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[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
|
// and change the monitor's resolution if necessary
|
||||||
if let Some(ref monitor) = window.fullscreen.get_monitor() {
|
if let Some(ref monitor) = window.fullscreen.get_monitor() {
|
||||||
try!(switch_to_fullscreen(&mut rect, monitor));
|
try!(switch_to_fullscreen(&mut rect, monitor));
|
||||||
}
|
};
|
||||||
|
|
||||||
let fullscreen = window.fullscreen.get_monitor().is_some();
|
let fullscreen = window.fullscreen.get_monitor().is_some();
|
||||||
|
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ pub fn get_primary_monitor() -> MonitorId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Identifier for a monitor.
|
/// Identifier for a monitor.
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone)]
|
||||||
pub struct MonitorId(pub platform::MonitorId);
|
pub struct MonitorId(pub platform::MonitorId);
|
||||||
|
|
||||||
impl MonitorId {
|
impl MonitorId {
|
||||||
|
|||||||
Reference in New Issue
Block a user