mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-02 06:40:06 -04:00
Rename platform to platform_impl
This commit is contained in:
16
src/lib.rs
16
src/lib.rs
@@ -102,7 +102,7 @@ pub use icon::*;
|
|||||||
pub mod dpi;
|
pub mod dpi;
|
||||||
mod events;
|
mod events;
|
||||||
mod icon;
|
mod icon;
|
||||||
mod platform;
|
mod platform_impl;
|
||||||
mod window;
|
mod window;
|
||||||
|
|
||||||
pub mod os;
|
pub mod os;
|
||||||
@@ -127,7 +127,7 @@ pub mod os;
|
|||||||
/// });
|
/// });
|
||||||
/// ```
|
/// ```
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
window: platform::Window,
|
window: platform_impl::Window,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for Window {
|
impl std::fmt::Debug for Window {
|
||||||
@@ -143,7 +143,7 @@ impl std::fmt::Debug for Window {
|
|||||||
/// Whenever you receive an event specific to a window, this event contains a `WindowId` which you
|
/// Whenever you receive an event specific to a window, this event contains a `WindowId` which you
|
||||||
/// can then compare to the ids of your windows.
|
/// can then compare to the ids of your windows.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct WindowId(platform::WindowId);
|
pub struct WindowId(platform_impl::WindowId);
|
||||||
|
|
||||||
/// Identifier of an input device.
|
/// Identifier of an input device.
|
||||||
///
|
///
|
||||||
@@ -151,7 +151,7 @@ pub struct WindowId(platform::WindowId);
|
|||||||
/// identifies its origin. Note that devices may be virtual (representing an on-screen cursor and keyboard focus) or
|
/// identifies its origin. Note that devices may be virtual (representing an on-screen cursor and keyboard focus) or
|
||||||
/// physical. Virtual devices typically aggregate inputs from multiple physical devices.
|
/// physical. Virtual devices typically aggregate inputs from multiple physical devices.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct DeviceId(platform::DeviceId);
|
pub struct DeviceId(platform_impl::DeviceId);
|
||||||
|
|
||||||
/// Provides a way to retrieve events from the system and from the windows that were registered to
|
/// Provides a way to retrieve events from the system and from the windows that were registered to
|
||||||
/// the events loop.
|
/// the events loop.
|
||||||
@@ -167,7 +167,7 @@ pub struct DeviceId(platform::DeviceId);
|
|||||||
/// `Window` created from this `EventLoop` _can_ be sent to an other thread, and the
|
/// `Window` created from this `EventLoop` _can_ be sent to an other thread, and the
|
||||||
/// `EventLoopProxy` allows you to wakeup an `EventLoop` from an other thread.
|
/// `EventLoopProxy` allows you to wakeup an `EventLoop` from an other thread.
|
||||||
pub struct EventLoop<T> {
|
pub struct EventLoop<T> {
|
||||||
events_loop: platform::EventLoop<T>,
|
events_loop: platform_impl::EventLoop<T>,
|
||||||
_marker: ::std::marker::PhantomData<*mut ()> // Not Send nor Sync
|
_marker: ::std::marker::PhantomData<*mut ()> // Not Send nor Sync
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ impl<T> EventLoop<T> {
|
|||||||
/// fallback on x11. If this variable is set with any other value, winit will panic.
|
/// fallback on x11. If this variable is set with any other value, winit will panic.
|
||||||
pub fn new_user_event() -> EventLoop<T> {
|
pub fn new_user_event() -> EventLoop<T> {
|
||||||
EventLoop {
|
EventLoop {
|
||||||
events_loop: platform::EventLoop::new(),
|
events_loop: platform_impl::EventLoop::new(),
|
||||||
_marker: ::std::marker::PhantomData,
|
_marker: ::std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -260,7 +260,7 @@ impl<T> EventLoop<T> {
|
|||||||
/// Used to wake up the `EventLoop` from another thread.
|
/// Used to wake up the `EventLoop` from another thread.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct EventLoopProxy<T> {
|
pub struct EventLoopProxy<T> {
|
||||||
events_loop_proxy: platform::EventLoopProxy<T>,
|
events_loop_proxy: platform_impl::EventLoopProxy<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> std::fmt::Debug for EventLoopProxy<T> {
|
impl<T> std::fmt::Debug for EventLoopProxy<T> {
|
||||||
@@ -304,7 +304,7 @@ pub struct WindowBuilder {
|
|||||||
pub window: WindowAttributes,
|
pub window: WindowAttributes,
|
||||||
|
|
||||||
// Platform-specific configuration. Private.
|
// Platform-specific configuration. Private.
|
||||||
platform_specific: platform::PlatformSpecificWindowBuilderAttributes,
|
platform_specific: platform_impl::PlatformSpecificWindowBuilderAttributes,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for WindowBuilder {
|
impl std::fmt::Debug for WindowBuilder {
|
||||||
|
|||||||
@@ -11,19 +11,19 @@ use {
|
|||||||
Window,
|
Window,
|
||||||
WindowBuilder,
|
WindowBuilder,
|
||||||
};
|
};
|
||||||
use platform::{
|
use platform_impl::{
|
||||||
EventLoop as LinuxEventLoop,
|
EventLoop as LinuxEventLoop,
|
||||||
Window as LinuxWindow,
|
Window as LinuxWindow,
|
||||||
};
|
};
|
||||||
use platform::x11::XConnection;
|
use platform_impl::x11::XConnection;
|
||||||
use platform::x11::ffi::XVisualInfo;
|
use platform_impl::x11::ffi::XVisualInfo;
|
||||||
|
|
||||||
// TODO: stupid hack so that glutin can do its work
|
// TODO: stupid hack so that glutin can do its work
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use platform::x11;
|
pub use platform_impl::x11;
|
||||||
|
|
||||||
pub use platform::XNotSupported;
|
pub use platform_impl::XNotSupported;
|
||||||
pub use platform::x11::util::WindowType as XWindowType;
|
pub use platform_impl::x11::util::WindowType as XWindowType;
|
||||||
|
|
||||||
/// Additional methods on `EventLoop` that are specific to Linux.
|
/// Additional methods on `EventLoop` that are specific to Linux.
|
||||||
pub trait EventLoopExt {
|
pub trait EventLoopExt {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use libc;
|
|||||||
use winapi::shared::windef::HWND;
|
use winapi::shared::windef::HWND;
|
||||||
|
|
||||||
use {DeviceId, EventLoop, Icon, MonitorId, Window, WindowBuilder};
|
use {DeviceId, EventLoop, Icon, MonitorId, Window, WindowBuilder};
|
||||||
use platform::EventLoop as WindowsEventLoop;
|
use platform_impl::EventLoop as WindowsEventLoop;
|
||||||
|
|
||||||
/// Additional methods on `EventLoop` that are specific to Windows.
|
/// Additional methods on `EventLoop` that are specific to Windows.
|
||||||
pub trait EventLoopExt {
|
pub trait EventLoopExt {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use std::sync::{Arc, Mutex, Weak};
|
|||||||
|
|
||||||
use {CreationError, MouseCursor, WindowAttributes};
|
use {CreationError, MouseCursor, WindowAttributes};
|
||||||
use dpi::{LogicalPosition, LogicalSize};
|
use dpi::{LogicalPosition, LogicalSize};
|
||||||
use platform::MonitorId as PlatformMonitorId;
|
use platform_impl::MonitorId as PlatformMonitorId;
|
||||||
use window::MonitorId as RootMonitorId;
|
use window::MonitorId as RootMonitorId;
|
||||||
|
|
||||||
use sctk::window::{ConceptFrame, Event as WEvent, Window as SWindow};
|
use sctk::window::{ConceptFrame, Event as WEvent, Window as SWindow};
|
||||||
@@ -14,7 +14,7 @@ use sctk::reexports::client::protocol::wl_surface::RequestsTrait as SurfaceReque
|
|||||||
use sctk::output::OutputMgr;
|
use sctk::output::OutputMgr;
|
||||||
|
|
||||||
use super::{make_wid, EventLoop, MonitorId, WindowId};
|
use super::{make_wid, EventLoop, MonitorId, WindowId};
|
||||||
use platform::platform::wayland::event_loop::{get_available_monitors, get_primary_monitor};
|
use platform_impl::platform::wayland::event_loop::{get_available_monitors, get_primary_monitor};
|
||||||
|
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
surface: Proxy<wl_surface::WlSurface>,
|
surface: Proxy<wl_surface::WlSurface>,
|
||||||
@@ -37,7 +37,7 @@ use {
|
|||||||
WindowEvent,
|
WindowEvent,
|
||||||
};
|
};
|
||||||
use events::ModifiersState;
|
use events::ModifiersState;
|
||||||
use platform::PlatformSpecificWindowBuilderAttributes;
|
use platform_impl::PlatformSpecificWindowBuilderAttributes;
|
||||||
use self::dnd::{Dnd, DndState};
|
use self::dnd::{Dnd, DndState};
|
||||||
use self::ime::{ImeReceiver, ImeSender, ImeCreationError, Ime};
|
use self::ime::{ImeReceiver, ImeSender, ImeCreationError, Ime};
|
||||||
|
|
||||||
@@ -10,9 +10,9 @@ use parking_lot::Mutex;
|
|||||||
use {Icon, MouseCursor, WindowAttributes};
|
use {Icon, MouseCursor, WindowAttributes};
|
||||||
use CreationError::{self, OsError};
|
use CreationError::{self, OsError};
|
||||||
use dpi::{LogicalPosition, LogicalSize};
|
use dpi::{LogicalPosition, LogicalSize};
|
||||||
use platform::MonitorId as PlatformMonitorId;
|
use platform_impl::MonitorId as PlatformMonitorId;
|
||||||
use platform::PlatformSpecificWindowBuilderAttributes;
|
use platform_impl::PlatformSpecificWindowBuilderAttributes;
|
||||||
use platform::x11::MonitorId as X11MonitorId;
|
use platform_impl::x11::MonitorId as X11MonitorId;
|
||||||
use window::MonitorId as RootMonitorId;
|
use window::MonitorId as RootMonitorId;
|
||||||
|
|
||||||
use super::{ffi, util, ImeSender, XConnection, XError, WindowId, EventLoop};
|
use super::{ffi, util, ImeSender, XConnection, XError, WindowId, EventLoop};
|
||||||
@@ -3,8 +3,8 @@ use cocoa::base::{id, nil};
|
|||||||
use cocoa::foundation::{NSRect, NSUInteger};
|
use cocoa::foundation::{NSRect, NSUInteger};
|
||||||
use core_graphics::display::CGDisplay;
|
use core_graphics::display::CGDisplay;
|
||||||
|
|
||||||
use platform::platform::ffi;
|
use platform_impl::platform::ffi;
|
||||||
use platform::platform::window::IdRef;
|
use platform_impl::platform::window::IdRef;
|
||||||
|
|
||||||
pub const EMPTY_RANGE: ffi::NSRange = ffi::NSRange {
|
pub const EMPTY_RANGE: ffi::NSRange = ffi::NSRange {
|
||||||
location: ffi::NSNotFound as NSUInteger,
|
location: ffi::NSNotFound as NSUInteger,
|
||||||
@@ -14,10 +14,10 @@ use objc::declare::ClassDecl;
|
|||||||
use objc::runtime::{Class, Object, Protocol, Sel, BOOL, YES};
|
use objc::runtime::{Class, Object, Protocol, Sel, BOOL, YES};
|
||||||
|
|
||||||
use {ElementState, Event, KeyboardInput, MouseButton, WindowEvent, WindowId};
|
use {ElementState, Event, KeyboardInput, MouseButton, WindowEvent, WindowId};
|
||||||
use platform::platform::events_loop::{DEVICE_ID, event_mods, Shared, to_virtual_key_code, check_additional_virtual_key_codes};
|
use platform_impl::platform::events_loop::{DEVICE_ID, event_mods, Shared, to_virtual_key_code, check_additional_virtual_key_codes};
|
||||||
use platform::platform::util;
|
use platform_impl::platform::util;
|
||||||
use platform::platform::ffi::*;
|
use platform_impl::platform::ffi::*;
|
||||||
use platform::platform::window::{get_window_id, IdRef};
|
use platform_impl::platform::window::{get_window_id, IdRef};
|
||||||
|
|
||||||
struct ViewState {
|
struct ViewState {
|
||||||
window: id,
|
window: id,
|
||||||
@@ -41,9 +41,9 @@ use {
|
|||||||
};
|
};
|
||||||
use CreationError::OsError;
|
use CreationError::OsError;
|
||||||
use os::macos::{ActivationPolicy, WindowExt};
|
use os::macos::{ActivationPolicy, WindowExt};
|
||||||
use platform::platform::{ffi, util};
|
use platform_impl::platform::{ffi, util};
|
||||||
use platform::platform::events_loop::{EventLoop, Shared};
|
use platform_impl::platform::events_loop::{EventLoop, Shared};
|
||||||
use platform::platform::view::{new_view, set_ime_spot};
|
use platform_impl::platform::view::{new_view, set_ime_spot};
|
||||||
use window::MonitorId as RootMonitorId;
|
use window::MonitorId as RootMonitorId;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
@@ -15,7 +15,7 @@ use winapi::um::oleidl::{IDropTarget, IDropTargetVtbl};
|
|||||||
use winapi::um::winnt::HRESULT;
|
use winapi::um::winnt::HRESULT;
|
||||||
use winapi::um::{shellapi, unknwnbase};
|
use winapi::um::{shellapi, unknwnbase};
|
||||||
|
|
||||||
use platform::platform::WindowId;
|
use platform_impl::platform::WindowId;
|
||||||
|
|
||||||
use {Event, WindowId as SuperWindowId};
|
use {Event, WindowId as SuperWindowId};
|
||||||
|
|
||||||
@@ -52,18 +52,18 @@ use {
|
|||||||
WindowId as SuperWindowId,
|
WindowId as SuperWindowId,
|
||||||
};
|
};
|
||||||
use events::{DeviceEvent, Touch, TouchPhase, StartCause};
|
use events::{DeviceEvent, Touch, TouchPhase, StartCause};
|
||||||
use platform::platform::{event, Cursor, WindowId, DEVICE_ID, wrap_device_id, util};
|
use platform_impl::platform::{event, Cursor, WindowId, DEVICE_ID, wrap_device_id, util};
|
||||||
use platform::platform::dpi::{
|
use platform_impl::platform::dpi::{
|
||||||
become_dpi_aware,
|
become_dpi_aware,
|
||||||
dpi_to_scale_factor,
|
dpi_to_scale_factor,
|
||||||
enable_non_client_dpi_scaling,
|
enable_non_client_dpi_scaling,
|
||||||
get_hwnd_scale_factor,
|
get_hwnd_scale_factor,
|
||||||
};
|
};
|
||||||
use platform::platform::drop_handler::FileDropHandler;
|
use platform_impl::platform::drop_handler::FileDropHandler;
|
||||||
use platform::platform::event::{handle_extended_keys, process_key_params, vkey_to_winit_vkey};
|
use platform_impl::platform::event::{handle_extended_keys, process_key_params, vkey_to_winit_vkey};
|
||||||
use platform::platform::icon::WinIcon;
|
use platform_impl::platform::icon::WinIcon;
|
||||||
use platform::platform::raw_input::{get_raw_input_data, get_raw_mouse_button_state};
|
use platform_impl::platform::raw_input::{get_raw_input_data, get_raw_mouse_button_state};
|
||||||
use platform::platform::window::adjust_size;
|
use platform_impl::platform::window::adjust_size;
|
||||||
|
|
||||||
/// Contains saved window info for switching between fullscreen
|
/// Contains saved window info for switching between fullscreen
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@@ -8,7 +8,7 @@ use winapi::shared::windef::{HICON, HWND};
|
|||||||
use winapi::um::winuser;
|
use winapi::um::winuser;
|
||||||
|
|
||||||
use {Pixel, PIXEL_SIZE, Icon};
|
use {Pixel, PIXEL_SIZE, Icon};
|
||||||
use platform::platform::util;
|
use platform_impl::platform::util;
|
||||||
|
|
||||||
impl Pixel {
|
impl Pixel {
|
||||||
fn to_bgra(&mut self) {
|
fn to_bgra(&mut self) {
|
||||||
@@ -8,8 +8,8 @@ use std::collections::VecDeque;
|
|||||||
|
|
||||||
use super::{EventLoop, util};
|
use super::{EventLoop, util};
|
||||||
use dpi::{PhysicalPosition, PhysicalSize};
|
use dpi::{PhysicalPosition, PhysicalSize};
|
||||||
use platform::platform::dpi::{dpi_to_scale_factor, get_monitor_dpi};
|
use platform_impl::platform::dpi::{dpi_to_scale_factor, get_monitor_dpi};
|
||||||
use platform::platform::window::Window;
|
use platform_impl::platform::window::Window;
|
||||||
|
|
||||||
/// Win32 implementation of the main `MonitorId` object.
|
/// Win32 implementation of the main `MonitorId` object.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@@ -31,7 +31,7 @@ use winapi::um::winuser::{
|
|||||||
RID_INPUT,
|
RID_INPUT,
|
||||||
};
|
};
|
||||||
|
|
||||||
use platform::platform::util;
|
use platform_impl::platform::util;
|
||||||
use events::ElementState;
|
use events::ElementState;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@@ -28,15 +28,15 @@ use {
|
|||||||
PhysicalSize,
|
PhysicalSize,
|
||||||
WindowAttributes,
|
WindowAttributes,
|
||||||
};
|
};
|
||||||
use platform::platform::{Cursor, PlatformSpecificWindowBuilderAttributes, WindowId};
|
use platform_impl::platform::{Cursor, PlatformSpecificWindowBuilderAttributes, WindowId};
|
||||||
use platform::platform::dpi::{dpi_to_scale_factor, get_hwnd_dpi};
|
use platform_impl::platform::dpi::{dpi_to_scale_factor, get_hwnd_dpi};
|
||||||
use platform::platform::events_loop::{self, EventLoop, DESTROY_MSG_ID, INITIAL_DPI_MSG_ID, REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID};
|
use platform_impl::platform::events_loop::{self, EventLoop, DESTROY_MSG_ID, INITIAL_DPI_MSG_ID, REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID};
|
||||||
use platform::platform::events_loop::WindowState;
|
use platform_impl::platform::events_loop::WindowState;
|
||||||
use platform::platform::icon::{self, IconType, WinIcon};
|
use platform_impl::platform::icon::{self, IconType, WinIcon};
|
||||||
use platform::platform::monitor;
|
use platform_impl::platform::monitor;
|
||||||
use platform::platform::raw_input::register_all_mice_and_keyboards_for_raw_input;
|
use platform_impl::platform::raw_input::register_all_mice_and_keyboards_for_raw_input;
|
||||||
use platform::platform::drop_handler::FileDropHandler;
|
use platform_impl::platform::drop_handler::FileDropHandler;
|
||||||
use platform::platform::util;
|
use platform_impl::platform::util;
|
||||||
|
|
||||||
const WS_RESIZABLE: DWORD = winuser::WS_SIZEBOX | winuser::WS_MAXIMIZEBOX;
|
const WS_RESIZABLE: DWORD = winuser::WS_SIZEBOX | winuser::WS_MAXIMIZEBOX;
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ use {
|
|||||||
MouseCursor,
|
MouseCursor,
|
||||||
PhysicalPosition,
|
PhysicalPosition,
|
||||||
PhysicalSize,
|
PhysicalSize,
|
||||||
platform,
|
platform_impl,
|
||||||
Window,
|
Window,
|
||||||
WindowBuilder,
|
WindowBuilder,
|
||||||
WindowId,
|
WindowId,
|
||||||
@@ -154,7 +154,7 @@ impl WindowBuilder {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// building
|
// building
|
||||||
platform::Window::new(
|
platform_impl::Window::new(
|
||||||
&events_loop.events_loop,
|
&events_loop.events_loop,
|
||||||
self.window,
|
self.window,
|
||||||
self.platform_specific,
|
self.platform_specific,
|
||||||
@@ -449,7 +449,7 @@ impl Window {
|
|||||||
// This may change in the future.
|
// This may change in the future.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AvailableMonitorsIter {
|
pub struct AvailableMonitorsIter {
|
||||||
pub(crate) data: VecDequeIter<platform::MonitorId>,
|
pub(crate) data: VecDequeIter<platform_impl::MonitorId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Iterator for AvailableMonitorsIter {
|
impl Iterator for AvailableMonitorsIter {
|
||||||
@@ -469,7 +469,7 @@ impl Iterator for AvailableMonitorsIter {
|
|||||||
/// Identifier for a monitor.
|
/// Identifier for a monitor.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct MonitorId {
|
pub struct MonitorId {
|
||||||
pub(crate) inner: platform::MonitorId
|
pub(crate) inner: platform_impl::MonitorId
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MonitorId {
|
impl MonitorId {
|
||||||
|
|||||||
Reference in New Issue
Block a user