Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use winit::platform::web::{ActiveEventLoopExtWeb, WindowAttributesWeb};
use winit::platform::x11::{ActiveEventLoopExtX11, WindowAttributesX11};
use winit::window::{
CursorGrabMode, ImeCapabilities, ImeEnableRequest, ImePurpose, ImeRequestData, ResizeDirection,
Theme, Window, WindowAttributes, WindowId,
WindowId, Theme, Window, WindowAttributes,
};
use winit_core::application::macos::ApplicationHandlerExtMacOS;
use winit_core::window::ImeRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/child_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn main() -> Result<(), impl std::error::Error> {
use winit::event::{ElementState, KeyEvent, WindowEvent};
use winit::event_loop::{ActiveEventLoop, EventLoop};
use winit::raw_window_handle::HasRawWindowHandle;
use winit::window::{Window, WindowAttributes, WindowId};
use winit::window::{WindowId, Window, WindowAttributes};

#[path = "util/fill.rs"]
mod fill;
Expand Down
2 changes: 1 addition & 1 deletion examples/control_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use winit::application::ApplicationHandler;
use winit::event::{ElementState, KeyEvent, StartCause, WindowEvent};
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
use winit::keyboard::{Key, NamedKey};
use winit::window::{Window, WindowAttributes, WindowId};
use winit::window::{WindowId, Window, WindowAttributes};

#[path = "util/fill.rs"]
mod fill;
Expand Down
2 changes: 1 addition & 1 deletion examples/dnd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::error::Error;
use winit::application::ApplicationHandler;
use winit::event::WindowEvent;
use winit::event_loop::{ActiveEventLoop, EventLoop};
use winit::window::{Window, WindowAttributes, WindowId};
use winit::window::{WindowId, Window, WindowAttributes};

#[path = "util/fill.rs"]
mod fill;
Expand Down
2 changes: 1 addition & 1 deletion examples/pump_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() -> std::process::ExitCode {
use winit::event::WindowEvent;
use winit::event_loop::pump_events::{EventLoopExtPumpEvents, PumpStatus};
use winit::event_loop::{ActiveEventLoop, EventLoop};
use winit::window::{Window, WindowAttributes, WindowId};
use winit::window::{WindowId, Window, WindowAttributes};

#[path = "util/fill.rs"]
mod fill;
Expand Down
2 changes: 1 addition & 1 deletion examples/run_on_demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
use winit::event::WindowEvent;
use winit::event_loop::run_on_demand::EventLoopExtRunOnDemand;
use winit::event_loop::{ActiveEventLoop, EventLoop};
use winit::window::{Window, WindowAttributes, WindowId};
use winit::window::{WindowId, Window, WindowAttributes};

#[path = "util/fill.rs"]
mod fill;
Expand Down
2 changes: 1 addition & 1 deletion examples/util/fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod platform {
use softbuffer::{Context, Surface};
#[cfg(all(web_platform, not(android_platform)))]
use web_time::Instant;
use winit::window::{Window, WindowId};
use winit::window::{WindowId, Window};

thread_local! {
// NOTE: You should never do things like that, create context and drop it before
Expand Down
2 changes: 1 addition & 1 deletion examples/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use winit::event::WindowEvent;
use winit::event_loop::{ActiveEventLoop, EventLoop};
#[cfg(web_platform)]
use winit::platform::web::WindowAttributesWeb;
use winit::window::{Window, WindowAttributes, WindowId};
use winit::window::{WindowId, Window, WindowAttributes};

#[path = "util/fill.rs"]
mod fill;
Expand Down
2 changes: 1 addition & 1 deletion examples/x11_embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main() -> Result<(), Box<dyn Error>> {
use winit::event::WindowEvent;
use winit::event_loop::{ActiveEventLoop, EventLoop};
use winit::platform::x11::WindowAttributesX11;
use winit::window::{Window, WindowAttributes, WindowId};
use winit::window::{WindowId, Window, WindowAttributes};

#[path = "util/fill.rs"]
mod fill;
Expand Down
80 changes: 42 additions & 38 deletions winit-android/src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ use winit_core::event_loop::{
EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider,
OwnedDisplayHandle as CoreOwnedDisplayHandle,
};
use winit_core::impl_surface_downcast;
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
use winit_core::window::{
self, CursorGrabMode, ImeCapabilities, ImePurpose, ImeRequest, ImeRequestError,
ResizeDirection, Theme, Window as CoreWindow, WindowAttributes, WindowButtons, WindowId,
WindowLevel,
ResizeDirection, Surface as CoreSurface, Theme, Window as CoreWindow, WindowAttributes,
WindowButtons, WindowId, WindowLevel,
};

use crate::keycodes;
Expand Down Expand Up @@ -821,7 +822,9 @@ impl rwh_06::HasWindowHandle for Window {
}
}

impl CoreWindow for Window {
impl CoreSurface for Window {
impl_surface_downcast!(Window);

fn id(&self) -> WindowId {
GLOBAL_WINDOW
}
Expand All @@ -848,6 +851,42 @@ impl CoreWindow for Window {

fn pre_present_notify(&self) {}

fn surface_size(&self) -> PhysicalSize<u32> {
self.outer_size()
}

fn request_surface_size(&self, _size: Size) -> Option<PhysicalSize<u32>> {
Some(self.surface_size())
}

fn set_transparent(&self, _transparent: bool) {}

fn set_cursor(&self, _: Cursor) {}

fn set_cursor_position(&self, _: Position) -> Result<(), RequestError> {
Err(NotSupportedError::new("set_cursor_position is not supported").into())
}

fn set_cursor_grab(&self, _: CursorGrabMode) -> Result<(), RequestError> {
Err(NotSupportedError::new("set_cursor_grab is not supported").into())
}

fn set_cursor_visible(&self, _: bool) {}

fn set_cursor_hittest(&self, _hittest: bool) -> Result<(), RequestError> {
Err(NotSupportedError::new("set_cursor_hittest is not supported").into())
}

fn rwh_06_display_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
self
}

fn rwh_06_window_handle(&self) -> &dyn rwh_06::HasWindowHandle {
self
}
}

impl CoreWindow for Window {
fn surface_position(&self) -> PhysicalPosition<i32> {
(0, 0).into()
}
Expand All @@ -859,15 +898,6 @@ impl CoreWindow for Window {
fn set_outer_position(&self, _position: Position) {
// no effect
}

fn surface_size(&self) -> PhysicalSize<u32> {
self.outer_size()
}

fn request_surface_size(&self, _size: Size) -> Option<PhysicalSize<u32>> {
Some(self.surface_size())
}

fn outer_size(&self) -> PhysicalSize<u32> {
screen_size(&self.app)
}
Expand All @@ -888,8 +918,6 @@ impl CoreWindow for Window {

fn set_title(&self, _title: &str) {}

fn set_transparent(&self, _transparent: bool) {}

fn set_blur(&self, _blur: bool) {}

fn set_visible(&self, _visibility: bool) {}
Expand Down Expand Up @@ -977,18 +1005,6 @@ impl CoreWindow for Window {

fn request_user_attention(&self, _request_type: Option<window::UserAttentionType>) {}

fn set_cursor(&self, _: Cursor) {}

fn set_cursor_position(&self, _: Position) -> Result<(), RequestError> {
Err(NotSupportedError::new("set_cursor_position is not supported").into())
}

fn set_cursor_grab(&self, _: CursorGrabMode) -> Result<(), RequestError> {
Err(NotSupportedError::new("set_cursor_grab is not supported").into())
}

fn set_cursor_visible(&self, _: bool) {}

fn drag_window(&self) -> Result<(), RequestError> {
Err(NotSupportedError::new("drag_window is not supported").into())
}
Expand All @@ -1000,10 +1016,6 @@ impl CoreWindow for Window {
#[inline]
fn show_window_menu(&self, _position: Position) {}

fn set_cursor_hittest(&self, _hittest: bool) -> Result<(), RequestError> {
Err(NotSupportedError::new("set_cursor_hittest is not supported").into())
}

fn set_theme(&self, _theme: Option<Theme>) {}

fn theme(&self) -> Option<Theme> {
Expand All @@ -1021,14 +1033,6 @@ impl CoreWindow for Window {
}

fn reset_dead_keys(&self) {}

fn rwh_06_display_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
self
}

fn rwh_06_window_handle(&self) -> &dyn rwh_06::HasWindowHandle {
self
}
}

fn screen_size(app: &AndroidApp) -> PhysicalSize<u32> {
Expand Down
2 changes: 1 addition & 1 deletion winit-appkit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ pub enum ActivationPolicy {
/// - `with_titlebar_buttons_hidden`
/// - `with_fullsize_content_view`
///
/// [`WindowAttributes::with_decorations`]: crate::window::WindowAttributes::with_decorations
/// [`WindowAttributes::with_decorations`]: winit_core::window::WindowAttributes::with_decorations
#[derive(Clone, Debug, PartialEq)]
pub struct WindowAttributesMacOS {
pub(crate) movable_by_window_background: bool,
Expand Down
Loading
Loading