mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Merge pull request #340 from tomaka/winimpl-platform
Rename "winimpl" module to "platform"
This commit is contained in:
commit
e51b694d59
|
@ -6,7 +6,7 @@ use GlRequest;
|
||||||
use gl_common;
|
use gl_common;
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
use winimpl;
|
use platform;
|
||||||
|
|
||||||
/// Object that allows you to build headless contexts.
|
/// Object that allows you to build headless contexts.
|
||||||
pub struct HeadlessRendererBuilder {
|
pub struct HeadlessRendererBuilder {
|
||||||
|
@ -52,7 +52,7 @@ impl HeadlessRendererBuilder {
|
||||||
/// Error should be very rare and only occur in case of permission denied, incompatible system,
|
/// Error should be very rare and only occur in case of permission denied, incompatible system,
|
||||||
/// out of memory, etc.
|
/// out of memory, etc.
|
||||||
pub fn build(self) -> Result<HeadlessContext, CreationError> {
|
pub fn build(self) -> Result<HeadlessContext, CreationError> {
|
||||||
winimpl::HeadlessContext::new(self.attribs).map(|w| HeadlessContext { context: w })
|
platform::HeadlessContext::new(self.attribs).map(|w| HeadlessContext { context: w })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the headless context.
|
/// Builds the headless context.
|
||||||
|
@ -67,7 +67,7 @@ impl HeadlessRendererBuilder {
|
||||||
|
|
||||||
/// Represents a headless OpenGL context.
|
/// Represents a headless OpenGL context.
|
||||||
pub struct HeadlessContext {
|
pub struct HeadlessContext {
|
||||||
context: winimpl::HeadlessContext,
|
context: platform::HeadlessContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeadlessContext {
|
impl HeadlessContext {
|
||||||
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -62,16 +62,16 @@ use this_platform_is_not_supported;
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
#[path="win32/mod.rs"]
|
#[path="win32/mod.rs"]
|
||||||
mod winimpl;
|
mod platform;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
#[path="x11/mod.rs"]
|
#[path="x11/mod.rs"]
|
||||||
mod winimpl;
|
mod platform;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
#[path="cocoa/mod.rs"]
|
#[path="cocoa/mod.rs"]
|
||||||
mod winimpl;
|
mod platform;
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
#[path="android/mod.rs"]
|
#[path="android/mod.rs"]
|
||||||
mod winimpl;
|
mod platform;
|
||||||
|
|
||||||
mod events;
|
mod events;
|
||||||
#[cfg(feature = "headless")]
|
#[cfg(feature = "headless")]
|
||||||
|
@ -239,10 +239,10 @@ pub struct BuilderAttribs<'a> {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
headless: bool,
|
headless: bool,
|
||||||
strict: bool,
|
strict: bool,
|
||||||
sharing: Option<&'a winimpl::Window>,
|
sharing: Option<&'a platform::Window>,
|
||||||
dimensions: Option<(u32, u32)>,
|
dimensions: Option<(u32, u32)>,
|
||||||
title: String,
|
title: String,
|
||||||
monitor: Option<winimpl::MonitorID>,
|
monitor: Option<platform::MonitorID>,
|
||||||
gl_version: GlRequest,
|
gl_version: GlRequest,
|
||||||
gl_debug: bool,
|
gl_debug: bool,
|
||||||
vsync: bool,
|
vsync: bool,
|
||||||
|
@ -279,7 +279,7 @@ impl BuilderAttribs<'static> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BuilderAttribs<'a> {
|
impl<'a> BuilderAttribs<'a> {
|
||||||
fn extract_non_static(mut self) -> (BuilderAttribs<'static>, Option<&'a winimpl::Window>) {
|
fn extract_non_static(mut self) -> (BuilderAttribs<'static>, Option<&'a platform::Window>) {
|
||||||
let sharing = self.sharing.take();
|
let sharing = self.sharing.take();
|
||||||
|
|
||||||
let new_attribs = BuilderAttribs {
|
let new_attribs = BuilderAttribs {
|
||||||
|
|
|
@ -13,7 +13,7 @@ use native_monitor::NativeMonitorId;
|
||||||
use gl_common;
|
use gl_common;
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
use winimpl;
|
use platform;
|
||||||
|
|
||||||
/// Object that allows you to build windows.
|
/// Object that allows you to build windows.
|
||||||
pub struct WindowBuilder<'a> {
|
pub struct WindowBuilder<'a> {
|
||||||
|
@ -145,7 +145,7 @@ impl<'a> WindowBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// building
|
// building
|
||||||
winimpl::Window::new(self.attribs).map(|w| Window { window: w })
|
platform::Window::new(self.attribs).map(|w| Window { window: w })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the window.
|
/// Builds the window.
|
||||||
|
@ -182,7 +182,7 @@ impl<'a> WindowBuilder<'a> {
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
window: winimpl::Window,
|
window: platform::Window,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Window {
|
impl Default for Window {
|
||||||
|
@ -435,7 +435,7 @@ impl gl_common::GlFunctionsSource for Window {
|
||||||
/// threads.
|
/// threads.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct WindowProxy {
|
pub struct WindowProxy {
|
||||||
proxy: winimpl::WindowProxy,
|
proxy: platform::WindowProxy,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowProxy {
|
impl WindowProxy {
|
||||||
|
@ -449,7 +449,7 @@ impl WindowProxy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// An iterator for the `poll_events` function.
|
/// An iterator for the `poll_events` function.
|
||||||
pub struct PollEventsIterator<'a>(winimpl::PollEventsIterator<'a>);
|
pub struct PollEventsIterator<'a>(platform::PollEventsIterator<'a>);
|
||||||
|
|
||||||
impl<'a> Iterator for PollEventsIterator<'a> {
|
impl<'a> Iterator for PollEventsIterator<'a> {
|
||||||
type Item = Event;
|
type Item = Event;
|
||||||
|
@ -464,7 +464,7 @@ impl<'a> Iterator for PollEventsIterator<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An iterator for the `wait_events` function.
|
/// An iterator for the `wait_events` function.
|
||||||
pub struct WaitEventsIterator<'a>(winimpl::WaitEventsIterator<'a>);
|
pub struct WaitEventsIterator<'a>(platform::WaitEventsIterator<'a>);
|
||||||
|
|
||||||
impl<'a> Iterator for WaitEventsIterator<'a> {
|
impl<'a> Iterator for WaitEventsIterator<'a> {
|
||||||
type Item = Event;
|
type Item = Event;
|
||||||
|
@ -482,7 +482,7 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
|
||||||
// Implementation note: we retreive the list once, then serve each element by one by one.
|
// Implementation note: we retreive the list once, then serve each element by one by one.
|
||||||
// This may change in the future.
|
// This may change in the future.
|
||||||
pub struct AvailableMonitorsIter {
|
pub struct AvailableMonitorsIter {
|
||||||
data: VecDequeIter<winimpl::MonitorID>,
|
data: VecDequeIter<platform::MonitorID>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Iterator for AvailableMonitorsIter {
|
impl Iterator for AvailableMonitorsIter {
|
||||||
|
@ -499,17 +499,17 @@ impl Iterator for AvailableMonitorsIter {
|
||||||
|
|
||||||
/// Returns the list of all available monitors.
|
/// Returns the list of all available monitors.
|
||||||
pub fn get_available_monitors() -> AvailableMonitorsIter {
|
pub fn get_available_monitors() -> AvailableMonitorsIter {
|
||||||
let data = winimpl::get_available_monitors();
|
let data = platform::get_available_monitors();
|
||||||
AvailableMonitorsIter{ data: data.into_iter() }
|
AvailableMonitorsIter{ data: data.into_iter() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the primary monitor of the system.
|
/// Returns the primary monitor of the system.
|
||||||
pub fn get_primary_monitor() -> MonitorID {
|
pub fn get_primary_monitor() -> MonitorID {
|
||||||
MonitorID(winimpl::get_primary_monitor())
|
MonitorID(platform::get_primary_monitor())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Identifier for a monitor.
|
/// Identifier for a monitor.
|
||||||
pub struct MonitorID(winimpl::MonitorID);
|
pub struct MonitorID(platform::MonitorID);
|
||||||
|
|
||||||
impl MonitorID {
|
impl MonitorID {
|
||||||
/// Returns a human-readable name of the monitor.
|
/// Returns a human-readable name of the monitor.
|
||||||
|
|
Loading…
Reference in a new issue