chore: import from winit-core instead of the top-level crate
Reproduce with:
find ./src/platform_impl -type f -exec sed -i '' 's/crate::/winit_core::/g' {} \;
find ./src/platform_impl -type f -exec sed -i '' 's/winit_core::platform/crate::platform/g' {} \;
find ./src/platform_impl -type f -exec sed -i '' 's/winit_core::dpi::/dpi::/g' {} \;
cargo +nightly fmt
This commit is contained in:
parent
03c01e038b
commit
c846f67bcb
79 changed files with 428 additions and 417 deletions
|
|
@ -1,7 +1,8 @@
|
|||
use android_activity::input::{KeyAction, KeyEvent, KeyMapChar, Keycode};
|
||||
use android_activity::AndroidApp;
|
||||
|
||||
use crate::keyboard::{Key, KeyCode, KeyLocation, NamedKey, NativeKey, NativeKeyCode, PhysicalKey};
|
||||
use winit_core::keyboard::{
|
||||
Key, KeyCode, KeyLocation, NamedKey, NativeKey, NativeKeyCode, PhysicalKey,
|
||||
};
|
||||
|
||||
pub fn to_physical_key(keycode: Keycode) -> PhysicalKey {
|
||||
PhysicalKey::Code(match keycode {
|
||||
|
|
|
|||
|
|
@ -8,25 +8,25 @@ use android_activity::input::{InputEvent, KeyAction, Keycode, MotionAction};
|
|||
use android_activity::{
|
||||
AndroidApp, AndroidAppWaker, ConfigurationRef, InputStatus, MainEvent, Rect,
|
||||
};
|
||||
use dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::{Cursor, CustomCursor, CustomCursorSource};
|
||||
use crate::dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use crate::error::{EventLoopError, NotSupportedError, RequestError};
|
||||
use crate::event::{self, DeviceId, FingerId, Force, StartCause, SurfaceSizeWriter};
|
||||
use crate::event_loop::{
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::{Cursor, CustomCursor, CustomCursorSource};
|
||||
use winit_core::error::{EventLoopError, NotSupportedError, RequestError};
|
||||
use winit_core::event::{self, DeviceId, FingerId, Force, StartCause, SurfaceSizeWriter};
|
||||
use winit_core::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider,
|
||||
OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use crate::platform::pump_events::PumpStatus;
|
||||
use crate::window::{
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use winit_core::window::{
|
||||
self, CursorGrabMode, ImePurpose, ResizeDirection, Theme, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
use crate::platform::pump_events::PumpStatus;
|
||||
|
||||
mod keycodes;
|
||||
|
||||
static HAS_FOCUS: AtomicBool = AtomicBool::new(true);
|
||||
|
|
@ -928,7 +928,7 @@ impl CoreWindow for Window {
|
|||
|
||||
fn set_window_level(&self, _level: WindowLevel) {}
|
||||
|
||||
fn set_window_icon(&self, _window_icon: Option<crate::icon::Icon>) {}
|
||||
fn set_window_icon(&self, _window_icon: Option<winit_core::icon::Icon>) {}
|
||||
|
||||
fn set_ime_cursor_area(&self, _position: Position, _size: Size) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ use objc2::runtime::{Imp, Sel};
|
|||
use objc2::sel;
|
||||
use objc2_app_kit::{NSApplication, NSEvent, NSEventModifierFlags, NSEventType};
|
||||
use objc2_foundation::MainThreadMarker;
|
||||
use winit_core::event::{DeviceEvent, ElementState};
|
||||
|
||||
use super::app_state::AppState;
|
||||
use crate::event::{DeviceEvent, ElementState};
|
||||
|
||||
type SendEvent = extern "C-unwind" fn(&NSApplication, Sel, &NSEvent);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,16 +8,16 @@ use dispatch2::MainThreadBound;
|
|||
use objc2::MainThreadMarker;
|
||||
use objc2_app_kit::{NSApplication, NSApplicationActivationPolicy, NSRunningApplication};
|
||||
use objc2_foundation::NSNotification;
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::event::{StartCause, WindowEvent};
|
||||
use winit_core::event_loop::ControlFlow;
|
||||
use winit_core::window::WindowId;
|
||||
|
||||
use super::super::event_handler::EventHandler;
|
||||
use super::super::event_loop_proxy::EventLoopProxy;
|
||||
use super::event_loop::{notify_windows_of_exit, stop_app_immediately, ActiveEventLoop, PanicInfo};
|
||||
use super::menu;
|
||||
use super::observer::{EventLoopWaker, RunLoop};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::event::{StartCause, WindowEvent};
|
||||
use crate::event_loop::ControlFlow;
|
||||
use crate::window::WindowId;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(super) struct AppState {
|
||||
|
|
|
|||
|
|
@ -9,9 +9,8 @@ use objc2_app_kit::{NSBitmapImageRep, NSCursor, NSDeviceRGBColorSpace, NSImage};
|
|||
use objc2_foundation::{
|
||||
ns_string, NSData, NSDictionary, NSNumber, NSObject, NSPoint, NSSize, NSString,
|
||||
};
|
||||
|
||||
use crate::cursor::{CursorIcon, CursorImage, CustomCursorProvider, CustomCursorSource};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use winit_core::cursor::{CursorIcon, CursorImage, CustomCursorProvider, CustomCursorSource};
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct CustomCursor(pub(crate) Retained<NSCursor>);
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ use objc2_app_kit::{NSEvent, NSEventModifierFlags, NSEventSubtype, NSEventType};
|
|||
use objc2_core_foundation::{CFData, CFRetained};
|
||||
use objc2_foundation::NSPoint;
|
||||
use smol_str::SmolStr;
|
||||
|
||||
use super::ffi;
|
||||
use crate::event::{ElementState, KeyEvent, Modifiers};
|
||||
use crate::keyboard::{
|
||||
use winit_core::event::{ElementState, KeyEvent, Modifiers};
|
||||
use winit_core::keyboard::{
|
||||
Key, KeyCode, KeyLocation, ModifiersKeys, ModifiersState, NamedKey, NativeKey, NativeKeyCode,
|
||||
PhysicalKey,
|
||||
};
|
||||
|
||||
use super::ffi;
|
||||
|
||||
/// Ignores ALL modifiers.
|
||||
pub fn get_modifierless_char(scancode: u16) -> Key {
|
||||
let Some(ptr) = NonNull::new(unsafe { ffi::TISCopyCurrentKeyboardLayoutInputSource() }) else {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,15 @@ use objc2_app_kit::{
|
|||
};
|
||||
use objc2_foundation::{NSNotificationCenter, NSObjectProtocol};
|
||||
use rwh_06::HasDisplayHandle;
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
|
||||
use winit_core::error::{EventLoopError, RequestError};
|
||||
use winit_core::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use winit_core::monitor::MonitorHandle as CoreMonitorHandle;
|
||||
use winit_core::window::Theme;
|
||||
|
||||
use super::super::notification_center::create_observer;
|
||||
use super::app::override_send_event;
|
||||
|
|
@ -23,18 +32,9 @@ use super::cursor::CustomCursor;
|
|||
use super::event::dummy_event;
|
||||
use super::monitor;
|
||||
use super::observer::setup_control_flow_observers;
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
|
||||
use crate::error::{EventLoopError, RequestError};
|
||||
use crate::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use crate::monitor::MonitorHandle as CoreMonitorHandle;
|
||||
use crate::platform::macos::ActivationPolicy;
|
||||
use crate::platform::pump_events::PumpStatus;
|
||||
use crate::platform_impl::Window;
|
||||
use crate::window::Theme;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct PanicInfo {
|
||||
|
|
@ -103,8 +103,8 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
|
||||
fn create_window(
|
||||
&self,
|
||||
window_attributes: crate::window::WindowAttributes,
|
||||
) -> Result<Box<dyn crate::window::Window>, RequestError> {
|
||||
window_attributes: winit_core::window::WindowAttributes,
|
||||
) -> Result<Box<dyn winit_core::window::Window>, RequestError> {
|
||||
Ok(Box::new(Window::new(self, window_attributes)?))
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
)
|
||||
}
|
||||
|
||||
fn primary_monitor(&self) -> Option<crate::monitor::MonitorHandle> {
|
||||
fn primary_monitor(&self) -> Option<winit_core::monitor::MonitorHandle> {
|
||||
let monitor = monitor::primary_monitor();
|
||||
Some(CoreMonitorHandle(Arc::new(monitor)))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use std::ptr::NonNull;
|
|||
use std::{fmt, ptr};
|
||||
|
||||
use dispatch2::run_on_main;
|
||||
use dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use objc2::rc::Retained;
|
||||
use objc2::MainThreadMarker;
|
||||
use objc2_app_kit::NSScreen;
|
||||
|
|
@ -17,11 +18,10 @@ use objc2_core_graphics::{
|
|||
use objc2_core_video::{kCVReturnSuccess, CVDisplayLink, CVTimeFlags};
|
||||
use objc2_foundation::{ns_string, NSNumber, NSPoint, NSRect};
|
||||
use tracing::warn;
|
||||
use winit_core::monitor::{MonitorHandleProvider, VideoMode};
|
||||
|
||||
use super::ffi;
|
||||
use super::util::cgerr;
|
||||
use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use crate::monitor::{MonitorHandleProvider, VideoMode};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct VideoModeHandle {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use objc2_core_graphics::CGError;
|
||||
use tracing::trace;
|
||||
|
||||
use crate::error::OsError;
|
||||
use winit_core::error::OsError;
|
||||
|
||||
macro_rules! trace_scope {
|
||||
($s:literal) => {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use std::collections::{HashMap, VecDeque};
|
|||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
|
||||
use dpi::{LogicalPosition, LogicalSize};
|
||||
use objc2::rc::Retained;
|
||||
use objc2::runtime::{AnyObject, Sel};
|
||||
use objc2::{define_class, msg_send, DefinedClass, MainThreadMarker};
|
||||
|
|
@ -15,6 +16,11 @@ use objc2_foundation::{
|
|||
NSArray, NSAttributedString, NSAttributedStringKey, NSCopying, NSMutableAttributedString,
|
||||
NSNotFound, NSObject, NSPoint, NSRange, NSRect, NSSize, NSString, NSUInteger,
|
||||
};
|
||||
use winit_core::event::{
|
||||
DeviceEvent, ElementState, Ime, KeyEvent, Modifiers, MouseButton, MouseScrollDelta,
|
||||
PointerKind, PointerSource, TouchPhase, WindowEvent,
|
||||
};
|
||||
use winit_core::keyboard::{Key, KeyCode, KeyLocation, ModifiersState, NamedKey};
|
||||
|
||||
use super::app_state::AppState;
|
||||
use super::cursor::{default_cursor, invisible_cursor};
|
||||
|
|
@ -23,12 +29,6 @@ use super::event::{
|
|||
scancode_to_physicalkey,
|
||||
};
|
||||
use super::window::window_id;
|
||||
use crate::dpi::{LogicalPosition, LogicalSize};
|
||||
use crate::event::{
|
||||
DeviceEvent, ElementState, Ime, KeyEvent, Modifiers, MouseButton, MouseScrollDelta,
|
||||
PointerKind, PointerSource, TouchPhase, WindowEvent,
|
||||
};
|
||||
use crate::keyboard::{Key, KeyCode, KeyLocation, ModifiersState, NamedKey};
|
||||
use crate::platform::macos::OptionAsAlt;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@ use objc2::rc::{autoreleasepool, Retained};
|
|||
use objc2::{define_class, MainThreadMarker, Message};
|
||||
use objc2_app_kit::{NSPanel, NSResponder, NSWindow};
|
||||
use objc2_foundation::NSObject;
|
||||
|
||||
use super::event_loop::ActiveEventLoop;
|
||||
use super::window_delegate::WindowDelegate;
|
||||
use crate::cursor::Cursor;
|
||||
use crate::error::RequestError;
|
||||
use crate::icon::Icon;
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use crate::window::{
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::RequestError;
|
||||
use winit_core::icon::Icon;
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use winit_core::window::{
|
||||
ImePurpose, Theme, UserAttentionType, Window as CoreWindow, WindowAttributes, WindowButtons,
|
||||
WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
use super::event_loop::ActiveEventLoop;
|
||||
use super::window_delegate::WindowDelegate;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Window {
|
||||
window: MainThreadBound<Retained<NSWindow>>,
|
||||
|
|
@ -93,7 +93,7 @@ impl rwh_06::HasWindowHandle for Window {
|
|||
}
|
||||
|
||||
impl CoreWindow for Window {
|
||||
fn id(&self) -> crate::window::WindowId {
|
||||
fn id(&self) -> winit_core::window::WindowId {
|
||||
self.maybe_wait_on_main(|delegate| delegate.id())
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +281,10 @@ impl CoreWindow for Window {
|
|||
self.maybe_wait_on_main(|delegate| delegate.set_cursor_position(position))
|
||||
}
|
||||
|
||||
fn set_cursor_grab(&self, mode: crate::window::CursorGrabMode) -> Result<(), RequestError> {
|
||||
fn set_cursor_grab(
|
||||
&self,
|
||||
mode: winit_core::window::CursorGrabMode,
|
||||
) -> Result<(), RequestError> {
|
||||
self.maybe_wait_on_main(|delegate| delegate.set_cursor_grab(mode))
|
||||
}
|
||||
|
||||
|
|
@ -295,7 +298,7 @@ impl CoreWindow for Window {
|
|||
|
||||
fn drag_resize_window(
|
||||
&self,
|
||||
direction: crate::window::ResizeDirection,
|
||||
direction: winit_core::window::ResizeDirection,
|
||||
) -> Result<(), RequestError> {
|
||||
Ok(self.maybe_wait_on_main(|delegate| delegate.drag_resize_window(direction))?)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ use std::ptr;
|
|||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use dpi::{
|
||||
LogicalInsets, LogicalPosition, LogicalSize, PhysicalInsets, PhysicalPosition, PhysicalSize,
|
||||
Position, Size,
|
||||
};
|
||||
use objc2::rc::{autoreleasepool, Retained};
|
||||
use objc2::runtime::{AnyObject, ProtocolObject};
|
||||
use objc2::{
|
||||
|
|
@ -36,6 +40,15 @@ use objc2_foundation::{
|
|||
NSRect, NSSize, NSString,
|
||||
};
|
||||
use tracing::{trace, warn};
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use winit_core::event::{SurfaceSizeWriter, WindowEvent};
|
||||
use winit_core::icon::Icon;
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle, MonitorHandleProvider};
|
||||
use winit_core::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, WindowAttributes,
|
||||
WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
use super::app_state::AppState;
|
||||
use super::cursor::{cursor_from_icon, CustomCursor};
|
||||
|
|
@ -45,20 +58,7 @@ use super::util::cgerr;
|
|||
use super::view::WinitView;
|
||||
use super::window::{window_id, WinitPanel, WinitWindow};
|
||||
use super::{ffi, MonitorHandle};
|
||||
use crate::cursor::Cursor;
|
||||
use crate::dpi::{
|
||||
LogicalInsets, LogicalPosition, LogicalSize, PhysicalInsets, PhysicalPosition, PhysicalSize,
|
||||
Position, Size,
|
||||
};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use crate::event::{SurfaceSizeWriter, WindowEvent};
|
||||
use crate::icon::Icon;
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle, MonitorHandleProvider};
|
||||
use crate::platform::macos::{OptionAsAlt, WindowAttributesMacOS, WindowExtMacOS};
|
||||
use crate::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, WindowAttributes,
|
||||
WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct State {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::cell::RefCell;
|
||||
use std::{fmt, mem};
|
||||
|
||||
use crate::application::ApplicationHandler;
|
||||
use winit_core::application::ApplicationHandler;
|
||||
|
||||
/// A helper type for storing a reference to `ApplicationHandler`, allowing interior mutable access
|
||||
/// to it within the execution of a closure.
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ use objc2::MainThreadMarker;
|
|||
use objc2_core_foundation::{
|
||||
kCFRunLoopCommonModes, CFIndex, CFRetained, CFRunLoop, CFRunLoopSource, CFRunLoopSourceContext,
|
||||
};
|
||||
|
||||
use crate::event_loop::EventLoopProxyProvider;
|
||||
use winit_core::event_loop::EventLoopProxyProvider;
|
||||
|
||||
/// A waker that signals a `CFRunLoopSource` on the main thread.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use std::time::Instant;
|
|||
use std::{mem, ptr};
|
||||
|
||||
use dispatch2::MainThreadBound;
|
||||
use dpi::PhysicalSize;
|
||||
use objc2::rc::Retained;
|
||||
use objc2::MainThreadMarker;
|
||||
use objc2_core_foundation::{
|
||||
|
|
@ -15,16 +16,15 @@ use objc2_core_foundation::{
|
|||
CGSize,
|
||||
};
|
||||
use objc2_ui_kit::{UIApplication, UICoordinateSpace, UIView};
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::event::{StartCause, SurfaceSizeWriter, WindowEvent};
|
||||
use winit_core::event_loop::ControlFlow;
|
||||
use winit_core::window::WindowId;
|
||||
|
||||
use super::super::event_handler::EventHandler;
|
||||
use super::super::event_loop_proxy::EventLoopProxy;
|
||||
use super::window::WinitUIWindow;
|
||||
use super::ActiveEventLoop;
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::dpi::PhysicalSize;
|
||||
use crate::event::{StartCause, SurfaceSizeWriter, WindowEvent};
|
||||
use crate::event_loop::ControlFlow;
|
||||
use crate::window::WindowId;
|
||||
|
||||
macro_rules! bug {
|
||||
($($msg:tt)*) => {
|
||||
|
|
|
|||
|
|
@ -16,20 +16,20 @@ use objc2_ui_kit::{
|
|||
UIApplicationWillResignActiveNotification, UIApplicationWillTerminateNotification, UIScreen,
|
||||
};
|
||||
use rwh_06::HasDisplayHandle;
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::{CustomCursor, CustomCursorSource};
|
||||
use winit_core::error::{EventLoopError, NotSupportedError, RequestError};
|
||||
use winit_core::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use winit_core::monitor::MonitorHandle as CoreMonitorHandle;
|
||||
use winit_core::window::{Theme, Window as CoreWindow};
|
||||
|
||||
use super::super::notification_center::create_observer;
|
||||
use super::app_state::{send_occluded_event_for_all_windows, AppState};
|
||||
use super::{app_state, monitor, MonitorHandle};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::{CustomCursor, CustomCursorSource};
|
||||
use crate::error::{EventLoopError, NotSupportedError, RequestError};
|
||||
use crate::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use crate::monitor::MonitorHandle as CoreMonitorHandle;
|
||||
use crate::platform_impl::Window;
|
||||
use crate::window::{Theme, Window as CoreWindow};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct ActiveEventLoop {
|
||||
|
|
@ -43,7 +43,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
|
||||
fn create_window(
|
||||
&self,
|
||||
window_attributes: crate::window::WindowAttributes,
|
||||
window_attributes: winit_core::window::WindowAttributes,
|
||||
) -> Result<Box<dyn CoreWindow>, RequestError> {
|
||||
Ok(Box::new(Window::new(self, window_attributes)?))
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
)
|
||||
}
|
||||
|
||||
fn primary_monitor(&self) -> Option<crate::monitor::MonitorHandle> {
|
||||
fn primary_monitor(&self) -> Option<winit_core::monitor::MonitorHandle> {
|
||||
#[allow(deprecated)]
|
||||
let monitor = MonitorHandle::new(UIScreen::mainScreen(self.mtm));
|
||||
Some(CoreMonitorHandle(Arc::new(monitor)))
|
||||
|
|
|
|||
|
|
@ -5,13 +5,12 @@ use std::num::NonZeroU32;
|
|||
use std::{fmt, hash, ptr};
|
||||
|
||||
use dispatch2::{run_on_main, MainThreadBound};
|
||||
use dpi::PhysicalPosition;
|
||||
use objc2::rc::Retained;
|
||||
use objc2::{available, MainThreadMarker, Message};
|
||||
use objc2_foundation::NSInteger;
|
||||
use objc2_ui_kit::{UIScreen, UIScreenMode};
|
||||
|
||||
use crate::dpi::PhysicalPosition;
|
||||
use crate::monitor::{MonitorHandleProvider, VideoMode};
|
||||
use winit_core::monitor::{MonitorHandleProvider, VideoMode};
|
||||
|
||||
// Workaround for `MainThreadBound` implementing almost no traits
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#![allow(clippy::unnecessary_cast)]
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
||||
use dpi::PhysicalPosition;
|
||||
use objc2::rc::Retained;
|
||||
use objc2::runtime::{NSObjectProtocol, ProtocolObject};
|
||||
use objc2::{available, define_class, msg_send, sel, DefinedClass, MainThreadMarker};
|
||||
|
|
@ -13,15 +14,14 @@ use objc2_ui_kit::{
|
|||
UITouchPhase, UITouchType, UITraitEnvironment, UIView,
|
||||
};
|
||||
use tracing::debug;
|
||||
|
||||
use super::app_state::{self, EventWrapper};
|
||||
use super::window::WinitUIWindow;
|
||||
use crate::dpi::PhysicalPosition;
|
||||
use crate::event::{
|
||||
use winit_core::event::{
|
||||
ButtonSource, ElementState, FingerId, Force, KeyEvent, PointerKind, PointerSource, TouchPhase,
|
||||
WindowEvent,
|
||||
};
|
||||
use crate::keyboard::{Key, KeyCode, KeyLocation, NamedKey, NativeKeyCode, PhysicalKey};
|
||||
use winit_core::keyboard::{Key, KeyCode, KeyLocation, NamedKey, NativeKeyCode, PhysicalKey};
|
||||
|
||||
use super::app_state::{self, EventWrapper};
|
||||
use super::window::WinitUIWindow;
|
||||
|
||||
pub struct WinitViewState {
|
||||
pinch_gesture_recognizer: RefCell<Option<Retained<UIPinchGestureRecognizer>>>,
|
||||
|
|
@ -64,7 +64,7 @@ define_class!(
|
|||
|
||||
let frame = self.frame();
|
||||
let scale_factor = self.contentScaleFactor() as f64;
|
||||
let size = crate::dpi::LogicalSize {
|
||||
let size = dpi::LogicalSize {
|
||||
width: frame.size.width as f64,
|
||||
height: frame.size.height as f64,
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ define_class!(
|
|||
);
|
||||
let scale_factor = scale_factor as f64;
|
||||
let frame = self.frame();
|
||||
let size = crate::dpi::LogicalSize {
|
||||
let size = dpi::LogicalSize {
|
||||
width: frame.size.width as f64,
|
||||
height: frame.size.height as f64,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ use std::collections::VecDeque;
|
|||
use std::sync::Arc;
|
||||
|
||||
use dispatch2::MainThreadBound;
|
||||
use dpi::{
|
||||
LogicalInsets, LogicalPosition, LogicalSize, PhysicalInsets, PhysicalPosition, PhysicalSize,
|
||||
Position, Size,
|
||||
};
|
||||
use objc2::rc::Retained;
|
||||
use objc2::{available, class, define_class, msg_send, MainThreadMarker};
|
||||
use objc2_core_foundation::{CGFloat, CGPoint, CGRect, CGSize};
|
||||
|
|
@ -13,25 +17,21 @@ use objc2_ui_kit::{
|
|||
UIScreenOverscanCompensation, UIViewController, UIWindow,
|
||||
};
|
||||
use tracing::{debug, warn};
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use winit_core::event::WindowEvent;
|
||||
use winit_core::icon::Icon;
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use winit_core::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
use super::app_state::EventWrapper;
|
||||
use super::view::WinitView;
|
||||
use super::view_controller::WinitViewController;
|
||||
use super::{app_state, monitor, ActiveEventLoop, MonitorHandle};
|
||||
use crate::cursor::Cursor;
|
||||
use crate::dpi::{
|
||||
LogicalInsets, LogicalPosition, LogicalSize, PhysicalInsets, PhysicalPosition, PhysicalSize,
|
||||
Position, Size,
|
||||
};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use crate::event::WindowEvent;
|
||||
use crate::icon::Icon;
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use crate::platform::ios::{ScreenEdge, StatusBarStyle, ValidOrientations, WindowAttributesIos};
|
||||
use crate::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
define_class!(
|
||||
#[unsafe(super(UIWindow, UIResponder, NSObject))]
|
||||
|
|
@ -569,7 +569,7 @@ impl rwh_06::HasWindowHandle for Window {
|
|||
}
|
||||
|
||||
impl CoreWindow for Window {
|
||||
fn id(&self) -> crate::window::WindowId {
|
||||
fn id(&self) -> winit_core::window::WindowId {
|
||||
self.maybe_wait_on_main(|delegate| delegate.id())
|
||||
}
|
||||
|
||||
|
|
@ -757,7 +757,10 @@ impl CoreWindow for Window {
|
|||
Ok(self.maybe_wait_on_main(|delegate| delegate.set_cursor_position(position))?)
|
||||
}
|
||||
|
||||
fn set_cursor_grab(&self, mode: crate::window::CursorGrabMode) -> Result<(), RequestError> {
|
||||
fn set_cursor_grab(
|
||||
&self,
|
||||
mode: winit_core::window::CursorGrabMode,
|
||||
) -> Result<(), RequestError> {
|
||||
Ok(self.maybe_wait_on_main(|delegate| delegate.set_cursor_grab(mode))?)
|
||||
}
|
||||
|
||||
|
|
@ -771,7 +774,7 @@ impl CoreWindow for Window {
|
|||
|
||||
fn drag_resize_window(
|
||||
&self,
|
||||
direction: crate::window::ResizeDirection,
|
||||
direction: winit_core::window::ResizeDirection,
|
||||
) -> Result<(), RequestError> {
|
||||
Ok(self.maybe_wait_on_main(|delegate| delegate.drag_resize_window(direction))?)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ use std::ffi::c_char;
|
|||
use std::ops::Deref;
|
||||
use std::ptr::{self, NonNull};
|
||||
|
||||
use winit_core::keyboard::{
|
||||
Key, KeyCode, KeyLocation, NamedKey, NativeKey, NativeKeyCode, PhysicalKey,
|
||||
};
|
||||
#[cfg(x11_platform)]
|
||||
use x11_dl::xlib_xcb::xcb_connection_t;
|
||||
use xkb::XKB_MOD_INVALID;
|
||||
|
|
@ -14,7 +17,6 @@ use xkbcommon_dl::{
|
|||
#[cfg(wayland_platform)]
|
||||
use {memmap2::MmapOptions, std::os::unix::io::OwnedFd};
|
||||
|
||||
use crate::keyboard::{Key, KeyCode, KeyLocation, NamedKey, NativeKey, NativeKeyCode, PhysicalKey};
|
||||
#[cfg(x11_platform)]
|
||||
use crate::platform_impl::common::xkb::XKBXH;
|
||||
use crate::platform_impl::common::xkb::{XkbContext, XKBH};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use std::sync::LazyLock;
|
|||
|
||||
use smol_str::SmolStr;
|
||||
use tracing::warn;
|
||||
use winit_core::event::{ElementState, KeyEvent};
|
||||
use winit_core::keyboard::{Key, KeyLocation};
|
||||
use xkbcommon_dl::{
|
||||
self as xkb, xkb_compose_status, xkb_context, xkb_context_flags, xkbcommon_compose_handle,
|
||||
xkbcommon_handle, XkbCommon, XkbCommonCompose,
|
||||
|
|
@ -15,9 +17,6 @@ use xkbcommon_dl::{
|
|||
#[cfg(x11_platform)]
|
||||
use {x11_dl::xlib_xcb::xcb_connection_t, xkbcommon_dl::x11::xkbcommon_x11_handle};
|
||||
|
||||
use crate::event::{ElementState, KeyEvent};
|
||||
use crate::keyboard::{Key, KeyLocation};
|
||||
|
||||
mod compose;
|
||||
mod keymap;
|
||||
mod state;
|
||||
|
|
|
|||
|
|
@ -177,13 +177,13 @@ pub struct ModifiersState {
|
|||
pub num_lock: bool,
|
||||
}
|
||||
|
||||
impl From<ModifiersState> for crate::keyboard::ModifiersState {
|
||||
fn from(mods: ModifiersState) -> crate::keyboard::ModifiersState {
|
||||
let mut to_mods = crate::keyboard::ModifiersState::empty();
|
||||
to_mods.set(crate::keyboard::ModifiersState::SHIFT, mods.shift);
|
||||
to_mods.set(crate::keyboard::ModifiersState::CONTROL, mods.ctrl);
|
||||
to_mods.set(crate::keyboard::ModifiersState::ALT, mods.alt);
|
||||
to_mods.set(crate::keyboard::ModifiersState::META, mods.logo);
|
||||
impl From<ModifiersState> for winit_core::keyboard::ModifiersState {
|
||||
fn from(mods: ModifiersState) -> winit_core::keyboard::ModifiersState {
|
||||
let mut to_mods = winit_core::keyboard::ModifiersState::empty();
|
||||
to_mods.set(winit_core::keyboard::ModifiersState::SHIFT, mods.shift);
|
||||
to_mods.set(winit_core::keyboard::ModifiersState::CONTROL, mods.ctrl);
|
||||
to_mods.set(winit_core::keyboard::ModifiersState::ALT, mods.alt);
|
||||
to_mods.set(winit_core::keyboard::ModifiersState::META, mods.logo);
|
||||
to_mods
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,16 +7,17 @@ use std::env;
|
|||
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
|
||||
use std::time::Duration;
|
||||
|
||||
pub(crate) use self::common::xkb::{physicalkey_to_scancode, scancode_to_physicalkey};
|
||||
use crate::application::ApplicationHandler;
|
||||
#[cfg(x11_platform)]
|
||||
use crate::dpi::Size;
|
||||
use crate::error::{EventLoopError, NotSupportedError};
|
||||
use crate::event_loop::ActiveEventLoop;
|
||||
use dpi::Size;
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::error::{EventLoopError, NotSupportedError};
|
||||
use winit_core::event_loop::ActiveEventLoop;
|
||||
use winit_core::window::ActivationToken;
|
||||
|
||||
pub(crate) use self::common::xkb::{physicalkey_to_scancode, scancode_to_physicalkey};
|
||||
use crate::platform::pump_events::PumpStatus;
|
||||
#[cfg(x11_platform)]
|
||||
use crate::platform::x11::WindowType as XWindowType;
|
||||
use crate::window::ActivationToken;
|
||||
|
||||
pub(crate) mod common;
|
||||
#[cfg(wayland_platform)]
|
||||
|
|
|
|||
|
|
@ -11,38 +11,38 @@ use std::thread::JoinHandle;
|
|||
use std::time::{Duration, Instant};
|
||||
|
||||
use calloop::ping::Ping;
|
||||
use dpi::LogicalSize;
|
||||
use rustix::event::{PollFd, PollFlags};
|
||||
use rustix::pipe::{self, PipeFlags};
|
||||
use sctk::reexports::calloop_wayland_source::WaylandSource;
|
||||
use sctk::reexports::client::{globals, Connection, QueueHandle};
|
||||
use tracing::warn;
|
||||
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
|
||||
use crate::dpi::LogicalSize;
|
||||
use crate::error::{EventLoopError, NotSupportedError, OsError, RequestError};
|
||||
use crate::event::{DeviceEvent, StartCause, SurfaceSizeWriter, WindowEvent};
|
||||
use crate::event_loop::{
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
|
||||
use winit_core::error::{EventLoopError, NotSupportedError, OsError, RequestError};
|
||||
use winit_core::event::{DeviceEvent, StartCause, SurfaceSizeWriter, WindowEvent};
|
||||
use winit_core::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use crate::monitor::MonitorHandle as CoreMonitorHandle;
|
||||
use winit_core::monitor::MonitorHandle as CoreMonitorHandle;
|
||||
use winit_core::window::Theme;
|
||||
|
||||
use crate::platform::pump_events::PumpStatus;
|
||||
use crate::platform_impl::platform::min_timeout;
|
||||
use crate::platform_impl::wayland::types::cursor::WaylandCustomCursor;
|
||||
use crate::window::Theme;
|
||||
|
||||
mod proxy;
|
||||
pub mod sink;
|
||||
|
||||
use proxy::EventLoopProxy;
|
||||
use sink::EventSink;
|
||||
pub use winit_core::event_loop::EventLoopProxy as CoreEventLoopProxy;
|
||||
|
||||
use super::output::MonitorHandle;
|
||||
use super::state::{WindowCompositorUpdate, WinitState};
|
||||
use super::window::state::FrameCallbackState;
|
||||
use super::{logical_to_physical_rounded, WindowId};
|
||||
pub use crate::event_loop::EventLoopProxy as CoreEventLoopProxy;
|
||||
|
||||
type WaylandDispatcher = calloop::Dispatcher<'static, WaylandSource<WinitState>, WinitState>;
|
||||
|
||||
|
|
@ -648,8 +648,8 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
|
||||
fn create_window(
|
||||
&self,
|
||||
window_attributes: crate::window::WindowAttributes,
|
||||
) -> Result<Box<dyn crate::window::Window>, RequestError> {
|
||||
window_attributes: winit_core::window::WindowAttributes,
|
||||
) -> Result<Box<dyn winit_core::window::Window>, RequestError> {
|
||||
let window = crate::platform_impl::wayland::Window::new(self, window_attributes)?;
|
||||
Ok(Box::new(window))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use sctk::reexports::calloop::ping::Ping;
|
||||
|
||||
use crate::event_loop::{EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider};
|
||||
use winit_core::event_loop::{EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider};
|
||||
|
||||
/// A handle that can be sent across the threads and used to wake up the `EventLoop`.
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
use std::vec::Drain;
|
||||
|
||||
use winit_core::event::{DeviceEvent, WindowEvent};
|
||||
use winit_core::window::WindowId;
|
||||
|
||||
use super::Event;
|
||||
use crate::event::{DeviceEvent, WindowEvent};
|
||||
use crate::window::WindowId;
|
||||
|
||||
/// An event loop's sink to deliver events from the Wayland event callbacks
|
||||
/// to the winit's user.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
//! Winit's Wayland backend.
|
||||
|
||||
use dpi::{LogicalSize, PhysicalSize};
|
||||
use sctk::reexports::client::protocol::wl_surface::WlSurface;
|
||||
use sctk::reexports::client::Proxy;
|
||||
|
||||
use crate::dpi::{LogicalSize, PhysicalSize};
|
||||
use crate::window::WindowId;
|
||||
use winit_core::window::WindowId;
|
||||
|
||||
mod event_loop;
|
||||
mod output;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
use std::borrow::Cow;
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
use dpi::{LogicalPosition, PhysicalPosition};
|
||||
use sctk::output::{Mode, OutputData};
|
||||
use sctk::reexports::client::protocol::wl_output::WlOutput;
|
||||
use sctk::reexports::client::Proxy;
|
||||
|
||||
use crate::dpi::{LogicalPosition, PhysicalPosition};
|
||||
use crate::monitor::{MonitorHandleProvider as CoreMonitorHandle, VideoMode};
|
||||
use winit_core::monitor::{MonitorHandleProvider as CoreMonitorHandle, VideoMode};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MonitorHandle {
|
||||
|
|
@ -56,7 +55,7 @@ impl CoreMonitorHandle for MonitorHandle {
|
|||
output_data.scale_factor() as f64
|
||||
}
|
||||
|
||||
fn current_video_mode(&self) -> Option<crate::monitor::VideoMode> {
|
||||
fn current_video_mode(&self) -> Option<winit_core::monitor::VideoMode> {
|
||||
let output_data = self.proxy.data::<OutputData>().unwrap();
|
||||
output_data.with_output_info(|info| {
|
||||
let mode = info.modes.iter().find(|mode| mode.current).cloned();
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ use sctk::reexports::client::protocol::wl_keyboard::{
|
|||
use sctk::reexports::client::protocol::wl_seat::WlSeat;
|
||||
use sctk::reexports::client::{Connection, Dispatch, Proxy, QueueHandle, WEnum};
|
||||
use tracing::warn;
|
||||
use winit_core::event::{ElementState, WindowEvent};
|
||||
use winit_core::keyboard::ModifiersState;
|
||||
|
||||
use crate::event::{ElementState, WindowEvent};
|
||||
use crate::keyboard::ModifiersState;
|
||||
use crate::platform_impl::common::xkb::Context;
|
||||
use crate::platform_impl::wayland::event_loop::sink::EventSink;
|
||||
use crate::platform_impl::wayland::state::WinitState;
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ use sctk::reexports::protocols::wp::text_input::zv3::client::zwp_text_input_v3::
|
|||
use sctk::seat::pointer::{ThemeSpec, ThemedPointer};
|
||||
use sctk::seat::{Capability as SeatCapability, SeatHandler, SeatState};
|
||||
use tracing::warn;
|
||||
use winit_core::event::WindowEvent;
|
||||
use winit_core::keyboard::ModifiersState;
|
||||
|
||||
use crate::event::WindowEvent;
|
||||
use crate::keyboard::ModifiersState;
|
||||
use crate::platform_impl::wayland::state::WinitState;
|
||||
|
||||
mod keyboard;
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ use sctk::seat::pointer::{
|
|||
};
|
||||
use sctk::seat::SeatState;
|
||||
|
||||
use crate::dpi::{LogicalPosition, PhysicalPosition};
|
||||
use crate::event::{
|
||||
use dpi::{LogicalPosition, PhysicalPosition};
|
||||
use winit_core::event::{
|
||||
ElementState, MouseButton, MouseScrollDelta, PointerKind, PointerSource, TouchPhase,
|
||||
WindowEvent,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use sctk::reexports::protocols::wp::relative_pointer::zv1::{
|
|||
|
||||
use sctk::globals::GlobalData;
|
||||
|
||||
use crate::event::DeviceEvent;
|
||||
use winit_core::event::DeviceEvent;
|
||||
use crate::platform_impl::wayland::state::WinitState;
|
||||
|
||||
/// Wrapper around the relative pointer.
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ use sctk::reexports::protocols::wp::text_input::zv3::client::zwp_text_input_mana
|
|||
use sctk::reexports::protocols::wp::text_input::zv3::client::zwp_text_input_v3::{
|
||||
ContentHint, ContentPurpose, Event as TextInputEvent, ZwpTextInputV3,
|
||||
};
|
||||
use winit_core::event::{Ime, WindowEvent};
|
||||
use winit_core::window::ImePurpose;
|
||||
|
||||
use crate::event::{Ime, WindowEvent};
|
||||
use crate::platform_impl::wayland;
|
||||
use crate::platform_impl::wayland::state::WinitState;
|
||||
use crate::window::ImePurpose;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TextInputState {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
//! Touch handling.
|
||||
|
||||
use dpi::LogicalPosition;
|
||||
use sctk::reexports::client::protocol::wl_seat::WlSeat;
|
||||
use sctk::reexports::client::protocol::wl_surface::WlSurface;
|
||||
use sctk::reexports::client::protocol::wl_touch::WlTouch;
|
||||
use sctk::reexports::client::{Connection, Proxy, QueueHandle};
|
||||
use sctk::seat::touch::{TouchData, TouchHandler};
|
||||
use tracing::warn;
|
||||
use winit_core::event::{
|
||||
ButtonSource, ElementState, FingerId, PointerKind, PointerSource, WindowEvent,
|
||||
};
|
||||
|
||||
use crate::dpi::LogicalPosition;
|
||||
use crate::event::{ButtonSource, ElementState, FingerId, PointerKind, PointerSource, WindowEvent};
|
||||
use crate::platform_impl::wayland;
|
||||
use crate::platform_impl::wayland::state::WinitState;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ use sctk::shell::WaylandSurface;
|
|||
use sctk::shm::slot::SlotPool;
|
||||
use sctk::shm::{Shm, ShmHandler};
|
||||
use sctk::subcompositor::SubcompositorState;
|
||||
use winit_core::error::OsError;
|
||||
|
||||
use crate::error::OsError;
|
||||
use crate::platform_impl::wayland::event_loop::sink::EventSink;
|
||||
use crate::platform_impl::wayland::output::MonitorHandle;
|
||||
use crate::platform_impl::wayland::seat::{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
use cursor_icon::CursorIcon;
|
||||
use sctk::reexports::client::protocol::wl_shm::Format;
|
||||
use sctk::shm::slot::{Buffer, SlotPool};
|
||||
|
||||
use crate::cursor::{CursorImage, CustomCursorProvider};
|
||||
use winit_core::cursor::{CursorImage, CustomCursorProvider};
|
||||
|
||||
// Wrap in our own type to not impl trait on global type.
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ use sctk::reexports::protocols::xdg::activation::v1::client::xdg_activation_toke
|
|||
Event as ActivationTokenEvent, XdgActivationTokenV1,
|
||||
};
|
||||
use sctk::reexports::protocols::xdg::activation::v1::client::xdg_activation_v1::XdgActivationV1;
|
||||
use winit_core::event_loop::AsyncRequestSerial;
|
||||
use winit_core::window::{ActivationToken, WindowId};
|
||||
|
||||
use crate::event_loop::AsyncRequestSerial;
|
||||
use crate::platform_impl::wayland::state::WinitState;
|
||||
use crate::window::{ActivationToken, WindowId};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct XdgActivationState {
|
||||
|
|
@ -77,7 +77,7 @@ impl Dispatch<XdgActivationTokenV1, XdgActivationTokenData, WinitState> for XdgA
|
|||
},
|
||||
XdgActivationTokenData::Obtain((window_id, serial)) => {
|
||||
state.events_sink.push_window_event(
|
||||
crate::event::WindowEvent::ActivationTokenDone {
|
||||
winit_core::event::WindowEvent::ActivationTokenDone {
|
||||
serial: *serial,
|
||||
token: ActivationToken::from_raw(token),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use std::ptr::NonNull;
|
|||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use dpi::{LogicalSize, PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use sctk::compositor::{CompositorState, Region, SurfaceData};
|
||||
use sctk::reexports::client::protocol::wl_display::WlDisplay;
|
||||
use sctk::reexports::client::protocol::wl_surface::WlSurface;
|
||||
|
|
@ -13,24 +14,23 @@ use sctk::reexports::protocols::xdg::activation::v1::client::xdg_activation_v1::
|
|||
use sctk::shell::xdg::window::{Window as SctkWindow, WindowDecorations};
|
||||
use sctk::shell::WaylandSurface;
|
||||
use tracing::warn;
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use winit_core::event::{Ime, WindowEvent};
|
||||
use winit_core::event_loop::AsyncRequestSerial;
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use winit_core::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
use super::event_loop::sink::EventSink;
|
||||
use super::output::MonitorHandle;
|
||||
use super::state::WinitState;
|
||||
use super::types::xdg_activation::XdgActivationTokenData;
|
||||
use super::ActiveEventLoop;
|
||||
use crate::cursor::Cursor;
|
||||
use crate::dpi::{LogicalSize, PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use crate::event::{Ime, WindowEvent};
|
||||
use crate::event_loop::AsyncRequestSerial;
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use crate::platform::wayland::WindowAttributesWayland;
|
||||
use crate::platform_impl::wayland::output;
|
||||
use crate::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
pub(crate) mod state;
|
||||
|
||||
|
|
@ -504,7 +504,7 @@ impl CoreWindow for Window {
|
|||
|
||||
fn set_window_level(&self, _level: WindowLevel) {}
|
||||
|
||||
fn set_window_icon(&self, _window_icon: Option<crate::icon::Icon>) {}
|
||||
fn set_window_icon(&self, _window_icon: Option<winit_core::icon::Icon>) {}
|
||||
|
||||
#[inline]
|
||||
fn set_ime_cursor_area(&self, position: Position, size: Size) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use std::sync::{Arc, Mutex, Weak};
|
|||
use std::time::Duration;
|
||||
|
||||
use ahash::HashSet;
|
||||
use dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Size};
|
||||
use sctk::compositor::{CompositorState, Region, SurfaceData, SurfaceDataExt};
|
||||
use sctk::reexports::client::backend::ObjectId;
|
||||
use sctk::reexports::client::protocol::wl_seat::WlSeat;
|
||||
|
|
@ -27,10 +28,10 @@ use sctk::shm::Shm;
|
|||
use sctk::subcompositor::SubcompositorState;
|
||||
use tracing::{info, warn};
|
||||
use wayland_protocols_plasma::blur::client::org_kde_kwin_blur::OrgKdeKwinBlur;
|
||||
use winit_core::cursor::{CursorIcon, CustomCursor as CoreCustomCursor};
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use winit_core::window::{CursorGrabMode, ImePurpose, ResizeDirection, Theme, WindowId};
|
||||
|
||||
use crate::cursor::{CursorIcon, CustomCursor as CoreCustomCursor};
|
||||
use crate::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Size};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use crate::platform_impl::wayland::event_loop::OwnedDisplayHandle;
|
||||
use crate::platform_impl::wayland::logical_to_physical_rounded;
|
||||
use crate::platform_impl::wayland::seat::{
|
||||
|
|
@ -41,7 +42,6 @@ use crate::platform_impl::wayland::types::cursor::{
|
|||
CustomCursor, SelectedCursor, WaylandCustomCursor,
|
||||
};
|
||||
use crate::platform_impl::wayland::types::kwin_blur::KWinBlurManager;
|
||||
use crate::window::{CursorGrabMode, ImePurpose, ResizeDirection, Theme, WindowId};
|
||||
|
||||
#[cfg(feature = "sctk-adwaita")]
|
||||
pub type WinitFrame = sctk_adwaita::AdwaitaFrame<WinitState>;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,14 @@ use std::os::raw::{c_char, c_int, c_long, c_ulong};
|
|||
use std::slice;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use dpi::{PhysicalPosition, PhysicalSize};
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::event::{
|
||||
ButtonSource, DeviceEvent, DeviceId, ElementState, FingerId, Ime, MouseButton,
|
||||
MouseScrollDelta, PointerKind, PointerSource, RawKeyEvent, SurfaceSizeWriter, TouchPhase,
|
||||
WindowEvent,
|
||||
};
|
||||
use winit_core::keyboard::ModifiersState;
|
||||
use x11_dl::xinput2::{
|
||||
self, XIDeviceEvent, XIEnterEvent, XIFocusInEvent, XIFocusOutEvent, XIHierarchyEvent,
|
||||
XILeaveEvent, XIModifierState, XIRawEvent,
|
||||
|
|
@ -20,14 +28,6 @@ use x11rb::protocol::xproto::{self, ConnectionExt as _, ModMask};
|
|||
use x11rb::x11_utils::{ExtensionInformation, Serialize};
|
||||
use xkbcommon_dl::xkb_mod_mask_t;
|
||||
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize};
|
||||
use crate::event::{
|
||||
ButtonSource, DeviceEvent, DeviceId, ElementState, FingerId, Ime, MouseButton,
|
||||
MouseScrollDelta, PointerKind, PointerSource, RawKeyEvent, SurfaceSizeWriter, TouchPhase,
|
||||
WindowEvent,
|
||||
};
|
||||
use crate::keyboard::ModifiersState;
|
||||
use crate::platform_impl::common::xkb::{self, XkbState};
|
||||
use crate::platform_impl::platform::common::xkb::Context;
|
||||
use crate::platform_impl::platform::x11::ime::{ImeEvent, ImeEventReceiver, ImeRequest};
|
||||
|
|
@ -934,7 +934,7 @@ impl EventProcessor {
|
|||
|
||||
fn send_synthic_modifier_from_core(
|
||||
&mut self,
|
||||
window_id: crate::window::WindowId,
|
||||
window_id: winit_core::window::WindowId,
|
||||
state: u16,
|
||||
app: &mut dyn ApplicationHandler,
|
||||
) {
|
||||
|
|
@ -1551,7 +1551,7 @@ impl EventProcessor {
|
|||
|
||||
fn update_mods_from_query(
|
||||
&mut self,
|
||||
window_id: crate::window::WindowId,
|
||||
window_id: winit_core::window::WindowId,
|
||||
app: &mut dyn ApplicationHandler,
|
||||
) {
|
||||
let xkb_state = match self.xkb_context.state_mut() {
|
||||
|
|
@ -1584,7 +1584,7 @@ impl EventProcessor {
|
|||
|
||||
pub(crate) fn update_mods_from_core_event(
|
||||
&mut self,
|
||||
window_id: crate::window::WindowId,
|
||||
window_id: winit_core::window::WindowId,
|
||||
state: u16,
|
||||
app: &mut dyn ApplicationHandler,
|
||||
) {
|
||||
|
|
@ -1661,7 +1661,7 @@ impl EventProcessor {
|
|||
/// unless `force` is passed. The `force` should be passed when the active window changes.
|
||||
fn send_modifiers(
|
||||
&self,
|
||||
window_id: crate::window::WindowId,
|
||||
window_id: winit_core::window::WindowId,
|
||||
modifiers: ModifiersState,
|
||||
force: bool,
|
||||
app: &mut dyn ApplicationHandler,
|
||||
|
|
@ -1676,7 +1676,7 @@ impl EventProcessor {
|
|||
|
||||
fn handle_pressed_keys(
|
||||
target: &ActiveEventLoop,
|
||||
window_id: crate::window::WindowId,
|
||||
window_id: winit_core::window::WindowId,
|
||||
state: ElementState,
|
||||
xkb_context: &mut Context,
|
||||
app: &mut dyn ApplicationHandler,
|
||||
|
|
|
|||
|
|
@ -15,6 +15,17 @@ use calloop::ping::Ping;
|
|||
use calloop::{EventLoop as Loop, Readiness};
|
||||
use libc::{setlocale, LC_CTYPE};
|
||||
use tracing::warn;
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
|
||||
use winit_core::error::{EventLoopError, RequestError};
|
||||
use winit_core::event::{DeviceId, StartCause, WindowEvent};
|
||||
use winit_core::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider,
|
||||
OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use winit_core::monitor::MonitorHandle as CoreMonitorHandle;
|
||||
use winit_core::window::{Theme, Window as CoreWindow, WindowAttributes, WindowId};
|
||||
use x11rb::connection::RequestConnection;
|
||||
use x11rb::errors::{ConnectError, ConnectionError, IdsExhausted, ReplyError};
|
||||
use x11rb::protocol::xinput::{self, ConnectionExt as _};
|
||||
|
|
@ -22,22 +33,11 @@ use x11rb::protocol::{xkb, xproto};
|
|||
use x11rb::x11_utils::X11Error as LogicalError;
|
||||
use x11rb::xcb_ffi::ReplyOrIdError;
|
||||
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
|
||||
use crate::error::{EventLoopError, RequestError};
|
||||
use crate::event::{DeviceId, StartCause, WindowEvent};
|
||||
use crate::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider,
|
||||
OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use crate::monitor::MonitorHandle as CoreMonitorHandle;
|
||||
use crate::platform::pump_events::PumpStatus;
|
||||
use crate::platform::x11::XlibErrorHook;
|
||||
use crate::platform_impl::common::xkb::Context;
|
||||
use crate::platform_impl::platform::min_timeout;
|
||||
use crate::platform_impl::x11::window::Window;
|
||||
use crate::window::{Theme, Window as CoreWindow, WindowAttributes, WindowId};
|
||||
|
||||
mod activation;
|
||||
mod atoms;
|
||||
|
|
@ -213,7 +213,7 @@ pub struct EventLoop {
|
|||
state: EventLoopState,
|
||||
}
|
||||
|
||||
type ActivationToken = (WindowId, crate::event_loop::AsyncRequestSerial);
|
||||
type ActivationToken = (WindowId, winit_core::event_loop::AsyncRequestSerial);
|
||||
|
||||
#[derive(Debug)]
|
||||
struct EventLoopState {
|
||||
|
|
@ -597,7 +597,7 @@ impl EventLoop {
|
|||
Some(Ok(token)) => {
|
||||
let event = WindowEvent::ActivationTokenDone {
|
||||
serial,
|
||||
token: crate::window::ActivationToken::from_raw(token),
|
||||
token: winit_core::window::ActivationToken::from_raw(token),
|
||||
};
|
||||
app.window_event(&self.event_processor.target, window_id, event);
|
||||
},
|
||||
|
|
@ -1003,8 +1003,8 @@ impl<E: fmt::Debug> CookieResultExt for Result<VoidCookie<'_>, E> {
|
|||
}
|
||||
}
|
||||
|
||||
fn mkwid(w: xproto::Window) -> crate::window::WindowId {
|
||||
crate::window::WindowId::from_raw(w as _)
|
||||
fn mkwid(w: xproto::Window) -> winit_core::window::WindowId {
|
||||
winit_core::window::WindowId::from_raw(w as _)
|
||||
}
|
||||
fn mkdid(w: xinput::DeviceId) -> DeviceId {
|
||||
DeviceId::from_raw(w as i64)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use std::num::NonZeroU32;
|
||||
|
||||
use dpi::PhysicalPosition;
|
||||
use winit_core::monitor::{MonitorHandleProvider, VideoMode};
|
||||
use x11rb::connection::RequestConnection;
|
||||
use x11rb::protocol::randr::{self, ConnectionExt as _};
|
||||
use x11rb::protocol::xproto;
|
||||
|
||||
use super::{util, X11Error, XConnection};
|
||||
use crate::dpi::PhysicalPosition;
|
||||
use crate::monitor::{MonitorHandleProvider, VideoMode};
|
||||
|
||||
// Used for testing. This should always be committed as false.
|
||||
const DISABLE_MONITOR_LIST_CACHING: bool = false;
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ use std::hash::{Hash, Hasher};
|
|||
use std::iter;
|
||||
use std::sync::Arc;
|
||||
|
||||
use winit_core::cursor::{CursorIcon, CustomCursorProvider, CustomCursorSource};
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use x11rb::connection::Connection;
|
||||
use x11rb::protocol::render::{self, ConnectionExt as _};
|
||||
use x11rb::protocol::xproto;
|
||||
|
||||
use super::super::ActiveEventLoop;
|
||||
use super::*;
|
||||
use crate::cursor::{CursorIcon, CustomCursorProvider, CustomCursorSource};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
|
||||
impl XConnection {
|
||||
pub fn set_cursor_icon(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#![allow(clippy::assertions_on_constants)]
|
||||
|
||||
use winit_core::icon::RgbaIcon;
|
||||
|
||||
use super::*;
|
||||
use crate::icon::RgbaIcon;
|
||||
|
||||
pub(crate) const PIXEL_SIZE: usize = mem::size_of::<Pixel>();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{collections::HashMap, slice};
|
|||
|
||||
use super::*;
|
||||
|
||||
use crate::event::{ElementState, ModifiersState};
|
||||
use winit_core::event::{ElementState, ModifiersState};
|
||||
|
||||
// Offsets within XModifierKeymap to each set of keycodes.
|
||||
// We are only interested in Shift, Control, Alt, and Logo.
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ use std::num::NonZeroU16;
|
|||
use std::str::FromStr;
|
||||
use std::{env, str};
|
||||
|
||||
use dpi::validate_scale_factor;
|
||||
use tracing::warn;
|
||||
use winit_core::monitor::VideoMode;
|
||||
use x11rb::protocol::randr::{self, ConnectionExt as _};
|
||||
|
||||
use super::*;
|
||||
use crate::dpi::validate_scale_factor;
|
||||
use crate::monitor::VideoMode;
|
||||
use crate::platform_impl::platform::x11::{monitor, VideoModeHandle};
|
||||
|
||||
/// Represents values of `WINIT_HIDPI_FACTOR`.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,21 @@ use std::path::Path;
|
|||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
use std::{cmp, env};
|
||||
|
||||
use dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use tracing::{debug, info, warn};
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use winit_core::event::{SurfaceSizeWriter, WindowEvent};
|
||||
use winit_core::event_loop::AsyncRequestSerial;
|
||||
use winit_core::icon::RgbaIcon;
|
||||
use winit_core::monitor::{
|
||||
Fullscreen, MonitorHandle as CoreMonitorHandle, MonitorHandleProvider, VideoMode,
|
||||
};
|
||||
use winit_core::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
use x11rb::connection::{Connection, RequestConnection};
|
||||
use x11rb::properties::{WmHints, WmSizeHints, WmSizeHintsSpecification};
|
||||
use x11rb::protocol::shape::SK;
|
||||
|
|
@ -22,16 +36,6 @@ use super::{
|
|||
ffi, ActiveEventLoop, CookieResultExt, CustomCursor, ImeRequest, ImeSender, VoidCookie,
|
||||
XConnection,
|
||||
};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::Cursor;
|
||||
use crate::dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use crate::event::{SurfaceSizeWriter, WindowEvent};
|
||||
use crate::event_loop::AsyncRequestSerial;
|
||||
use crate::icon::RgbaIcon;
|
||||
use crate::monitor::{
|
||||
Fullscreen, MonitorHandle as CoreMonitorHandle, MonitorHandleProvider, VideoMode,
|
||||
};
|
||||
use crate::platform::x11::{WindowAttributesX11, WindowType};
|
||||
use crate::platform_impl::common;
|
||||
use crate::platform_impl::x11::atoms::*;
|
||||
|
|
@ -39,10 +43,6 @@ use crate::platform_impl::x11::util::rgba_to_cardinals;
|
|||
use crate::platform_impl::x11::{
|
||||
xinput_fp1616_to_float, MonitorHandle as X11MonitorHandle, WakeSender, X11Error,
|
||||
};
|
||||
use crate::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Window(Arc<UnownedWindow>);
|
||||
|
|
@ -204,7 +204,7 @@ impl CoreWindow for Window {
|
|||
self.0.set_window_level(level);
|
||||
}
|
||||
|
||||
fn set_window_icon(&self, window_icon: Option<crate::icon::Icon>) {
|
||||
fn set_window_icon(&self, window_icon: Option<winit_core::icon::Icon>) {
|
||||
let icon = match window_icon.as_ref() {
|
||||
Some(icon) => icon.cast_ref::<RgbaIcon>(),
|
||||
None => None,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use std::sync::{Arc, Mutex, RwLock, RwLockReadGuard};
|
|||
use std::{fmt, ptr};
|
||||
|
||||
use rwh_06::HasDisplayHandle;
|
||||
use winit_core::cursor::CursorIcon;
|
||||
use x11rb::connection::Connection;
|
||||
use x11rb::protocol::randr::ConnectionExt as _;
|
||||
use x11rb::protocol::render;
|
||||
|
|
@ -16,7 +17,6 @@ use x11rb::xcb_ffi::XCBConnection;
|
|||
use super::atoms::Atoms;
|
||||
use super::ffi;
|
||||
use super::monitor::MonitorHandle;
|
||||
use crate::cursor::CursorIcon;
|
||||
|
||||
/// A connection to an X server.
|
||||
pub struct XConnection {
|
||||
|
|
|
|||
|
|
@ -10,23 +10,23 @@ use orbclient::{
|
|||
MoveEvent, QuitEvent, ResizeEvent, ScrollEvent, TextInputEvent,
|
||||
};
|
||||
use smol_str::SmolStr;
|
||||
|
||||
use super::{PlatformSpecificEventLoopAttributes, RedoxSocket, TimeSocket, WindowProperties};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::{CustomCursor, CustomCursorSource};
|
||||
use crate::error::{EventLoopError, NotSupportedError, RequestError};
|
||||
use crate::event::{self, Ime, Modifiers, StartCause};
|
||||
use crate::event_loop::{
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::{CustomCursor, CustomCursorSource};
|
||||
use winit_core::error::{EventLoopError, NotSupportedError, RequestError};
|
||||
use winit_core::event::{self, Ime, Modifiers, StartCause};
|
||||
use winit_core::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider,
|
||||
OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use crate::keyboard::{
|
||||
use winit_core::keyboard::{
|
||||
Key, KeyCode, KeyLocation, ModifiersKeys, ModifiersState, NamedKey, NativeKey, NativeKeyCode,
|
||||
PhysicalKey,
|
||||
};
|
||||
use winit_core::window::{Theme, Window as CoreWindow, WindowId};
|
||||
|
||||
use super::{PlatformSpecificEventLoopAttributes, RedoxSocket, TimeSocket, WindowProperties};
|
||||
use crate::platform_impl::Window;
|
||||
use crate::window::{Theme, Window as CoreWindow, WindowId};
|
||||
|
||||
fn convert_scancode(scancode: u8) -> (PhysicalKey, Option<NamedKey>) {
|
||||
// Key constants from https://docs.rs/orbclient/latest/orbclient/event/index.html
|
||||
|
|
@ -693,7 +693,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
|
||||
fn create_window(
|
||||
&self,
|
||||
window_attributes: crate::window::WindowAttributes,
|
||||
window_attributes: winit_core::window::WindowAttributes,
|
||||
) -> Result<Box<dyn CoreWindow>, RequestError> {
|
||||
Ok(Box::new(Window::new(self, window_attributes)?))
|
||||
}
|
||||
|
|
@ -702,7 +702,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
Err(NotSupportedError::new("create_custom_cursor is not supported").into())
|
||||
}
|
||||
|
||||
fn available_monitors(&self) -> Box<dyn Iterator<Item = crate::monitor::MonitorHandle>> {
|
||||
fn available_monitors(&self) -> Box<dyn Iterator<Item = winit_core::monitor::MonitorHandle>> {
|
||||
Box::new(iter::empty())
|
||||
}
|
||||
|
||||
|
|
@ -710,7 +710,7 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
None
|
||||
}
|
||||
|
||||
fn primary_monitor(&self) -> Option<crate::monitor::MonitorHandle> {
|
||||
fn primary_monitor(&self) -> Option<winit_core::monitor::MonitorHandle> {
|
||||
None
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@ use std::collections::VecDeque;
|
|||
use std::iter;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use winit_core::window::{self, ImePurpose, Window as CoreWindow, WindowId};
|
||||
|
||||
use super::event_loop::EventLoopProxy;
|
||||
use super::{ActiveEventLoop, RedoxSocket, WindowProperties};
|
||||
use crate::cursor::Cursor;
|
||||
use crate::dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use crate::window::{self, ImePurpose, Window as CoreWindow, WindowId};
|
||||
|
||||
// These values match the values uses in the `window_new` function in orbital:
|
||||
// https://gitlab.redox-os.org/redox-os/orbital/-/blob/master/src/scheme.rs
|
||||
|
|
@ -351,7 +352,7 @@ impl CoreWindow for Window {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn set_window_icon(&self, _window_icon: Option<crate::icon::Icon>) {}
|
||||
fn set_window_icon(&self, _window_icon: Option<winit_core::icon::Icon>) {}
|
||||
|
||||
#[inline]
|
||||
fn set_ime_cursor_area(&self, _position: Position, _size: Size) {}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ use web_sys::{
|
|||
Blob, Document, DomException, HtmlCanvasElement, HtmlImageElement, ImageBitmap,
|
||||
ImageBitmapOptions, ImageBitmapRenderingContext, ImageData, PremultiplyAlpha, Url, Window,
|
||||
};
|
||||
use winit_core::cursor::{Cursor, CursorImage, CustomCursorProvider, CustomCursorSource};
|
||||
|
||||
use super::backend::Style;
|
||||
use super::main_thread::{MainThreadMarker, MainThreadSafe};
|
||||
use super::r#async::{AbortHandle, Abortable, DropAbortHandle, Notified, Notifier};
|
||||
use super::ActiveEventLoop;
|
||||
use crate::cursor::{Cursor, CursorImage, CustomCursorProvider, CustomCursorSource};
|
||||
use crate::platform::web::CustomCursorError;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
@ -640,7 +640,7 @@ async fn from_url(
|
|||
async fn from_animation(
|
||||
main_thread: MainThreadMarker,
|
||||
duration: Duration,
|
||||
cursors: impl ExactSizeIterator<Item = crate::cursor::CustomCursor>,
|
||||
cursors: impl ExactSizeIterator<Item = winit_core::cursor::CustomCursor>,
|
||||
) -> Result<Animation, CustomCursorError> {
|
||||
let keyframes = Array::new();
|
||||
let mut images = Vec::with_capacity(cursors.len());
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::event::DeviceId;
|
||||
use winit_core::event::DeviceId;
|
||||
|
||||
pub(crate) fn mkdid(pointer_id: i32) -> Option<DeviceId> {
|
||||
if let Ok(pointer_id) = u32::try_from(pointer_id) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::error::{EventLoopError, NotSupportedError};
|
||||
use winit_core::event_loop::ActiveEventLoop as RootActiveEventLoop;
|
||||
|
||||
use super::{backend, HasMonitorPermissionFuture, MonitorPermissionFuture};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::error::{EventLoopError, NotSupportedError};
|
||||
use crate::event_loop::ActiveEventLoop as RootActiveEventLoop;
|
||||
use crate::platform::web::{PollStrategy, WaitUntilStrategy};
|
||||
|
||||
mod proxy;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||
use std::sync::Arc;
|
||||
use std::task::Poll;
|
||||
|
||||
use winit_core::event_loop::EventLoopProxyProvider;
|
||||
|
||||
use super::super::main_thread::MainThreadMarker;
|
||||
use crate::event_loop::EventLoopProxyProvider;
|
||||
use crate::platform_impl::web::event_loop::runner::WeakShared;
|
||||
use crate::platform_impl::web::r#async::{AtomicWaker, Wrapper};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,17 @@ use std::rc::{Rc, Weak};
|
|||
use std::sync::Arc;
|
||||
use std::{fmt, iter};
|
||||
|
||||
use dpi::PhysicalSize;
|
||||
use wasm_bindgen::prelude::Closure;
|
||||
use wasm_bindgen::JsCast;
|
||||
use web_sys::{Document, KeyboardEvent, Navigator, PageTransitionEvent, PointerEvent, WheelEvent};
|
||||
use web_time::{Duration, Instant};
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::event::{
|
||||
DeviceEvent, DeviceId, ElementState, RawKeyEvent, StartCause, WindowEvent,
|
||||
};
|
||||
use winit_core::event_loop::{ControlFlow, DeviceEvents};
|
||||
use winit_core::window::WindowId;
|
||||
|
||||
use super::super::event;
|
||||
use super::super::main_thread::MainThreadMarker;
|
||||
|
|
@ -16,16 +23,11 @@ use super::super::monitor::MonitorHandler;
|
|||
use super::proxy::EventLoopProxy;
|
||||
use super::state::State;
|
||||
use super::{backend, ActiveEventLoop};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::dpi::PhysicalSize;
|
||||
use crate::event::{DeviceEvent, DeviceId, ElementState, RawKeyEvent, StartCause, WindowEvent};
|
||||
use crate::event_loop::{ControlFlow, DeviceEvents};
|
||||
use crate::platform::web::{PollStrategy, WaitUntilStrategy};
|
||||
use crate::platform_impl::platform::backend::{EventListenerHandle, SafeAreaHandle};
|
||||
use crate::platform_impl::platform::r#async::DispatchRunner;
|
||||
use crate::platform_impl::platform::window::Inner;
|
||||
use crate::platform_impl::web::web_sys::event::mouse_button_to_id;
|
||||
use crate::window::WindowId;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Shared(Rc<Execution>);
|
||||
|
|
@ -602,7 +604,7 @@ impl Shared {
|
|||
self.0.all_canvases.borrow_mut().retain(|&(item_id, ..)| item_id != id);
|
||||
self.handle_event(Event::WindowEvent {
|
||||
window_id: id,
|
||||
event: crate::event::WindowEvent::Destroyed,
|
||||
event: winit_core::event::WindowEvent::Destroyed,
|
||||
});
|
||||
self.0.redraw_pending.borrow_mut().remove(&id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,26 +5,26 @@ use std::rc::Rc;
|
|||
use std::sync::Arc;
|
||||
|
||||
use web_sys::Element;
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use winit_core::event::{ElementState, KeyEvent, TouchPhase, WindowEvent};
|
||||
use winit_core::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as RootEventLoopProxy, OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use winit_core::keyboard::ModifiersState;
|
||||
use winit_core::monitor::MonitorHandle as CoremMonitorHandle;
|
||||
use winit_core::window::{Theme, WindowId};
|
||||
|
||||
use super::super::lock;
|
||||
use super::super::monitor::MonitorPermissionFuture;
|
||||
use super::runner::Event;
|
||||
use super::{backend, runner};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::{CustomCursor as CoreCustomCursor, CustomCursorSource};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use crate::event::{ElementState, KeyEvent, TouchPhase, WindowEvent};
|
||||
use crate::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as RootEventLoopProxy, OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use crate::keyboard::ModifiersState;
|
||||
use crate::monitor::MonitorHandle as CoremMonitorHandle;
|
||||
use crate::platform::web::{CustomCursorFuture, PollStrategy, WaitUntilStrategy};
|
||||
use crate::platform_impl::platform::cursor::CustomCursor;
|
||||
use crate::platform_impl::web::event_loop::proxy::EventLoopProxy;
|
||||
use crate::platform_impl::Window;
|
||||
use crate::window::{Theme, WindowId};
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
struct ModifiersShared(Rc<Cell<ModifiersState>>);
|
||||
|
|
@ -490,8 +490,8 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
|
||||
fn create_window(
|
||||
&self,
|
||||
window_attributes: crate::window::WindowAttributes,
|
||||
) -> Result<Box<dyn crate::window::Window>, RequestError> {
|
||||
window_attributes: winit_core::window::WindowAttributes,
|
||||
) -> Result<Box<dyn winit_core::window::Window>, RequestError> {
|
||||
let window = Window::new(self, window_attributes)?;
|
||||
Ok(Box::new(window))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use smol_str::SmolStr;
|
||||
|
||||
use crate::keyboard::{Key, KeyCode, NamedKey, NativeKey, NativeKeyCode, PhysicalKey};
|
||||
use winit_core::keyboard::{Key, KeyCode, NamedKey, NativeKey, NativeKeyCode, PhysicalKey};
|
||||
|
||||
pub trait FromAttributeValue {
|
||||
fn from_attribute_value(kav: &str) -> Self
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use std::rc::{Rc, Weak};
|
|||
use std::sync::{Arc, OnceLock};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
use dpi::LogicalSize;
|
||||
use dpi::{LogicalSize, PhysicalPosition, PhysicalSize};
|
||||
use js_sys::{Object, Promise};
|
||||
use tracing::error;
|
||||
use wasm_bindgen::closure::Closure;
|
||||
|
|
@ -22,13 +22,12 @@ use web_sys::{
|
|||
console, DomException, Navigator, OrientationLockType, OrientationType, PermissionState,
|
||||
PermissionStatus, ScreenOrientation, Window,
|
||||
};
|
||||
use winit_core::monitor::{MonitorHandle as CoreMonitorHandle, MonitorHandleProvider, VideoMode};
|
||||
|
||||
use super::event_loop::runner::WeakShared;
|
||||
use super::main_thread::MainThreadMarker;
|
||||
use super::r#async::{Dispatcher, Notified, Notifier};
|
||||
use super::web_sys::{Engine, EventListenerHandle};
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize};
|
||||
use crate::monitor::{MonitorHandle as CoreMonitorHandle, MonitorHandleProvider, VideoMode};
|
||||
use crate::platform::web::{
|
||||
MonitorPermissionError, Orientation, OrientationData, OrientationLock, OrientationLockError,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use std::ops::Deref;
|
|||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use smol_str::SmolStr;
|
||||
use wasm_bindgen::closure::Closure;
|
||||
use wasm_bindgen::JsCast;
|
||||
|
|
@ -10,6 +11,14 @@ use web_sys::{
|
|||
CssStyleDeclaration, Document, Event, FocusEvent, HtmlCanvasElement, KeyboardEvent, Navigator,
|
||||
PointerEvent, WheelEvent,
|
||||
};
|
||||
use winit_core::error::RequestError;
|
||||
use winit_core::event::{
|
||||
ButtonSource, DeviceId, ElementState, MouseScrollDelta, PointerKind, PointerSource,
|
||||
SurfaceSizeWriter, WindowEvent,
|
||||
};
|
||||
use winit_core::keyboard::{Key, KeyLocation, ModifiersState, PhysicalKey};
|
||||
use winit_core::monitor::Fullscreen;
|
||||
use winit_core::window::{WindowAttributes, WindowId};
|
||||
|
||||
use super::super::cursor::CursorHandler;
|
||||
use super::super::event_loop::runner;
|
||||
|
|
@ -20,16 +29,7 @@ use super::intersection_handle::IntersectionObserverHandle;
|
|||
use super::media_query_handle::MediaQueryListHandle;
|
||||
use super::pointer::PointerHandler;
|
||||
use super::{event, fullscreen, ResizeScaleHandle};
|
||||
use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};
|
||||
use crate::error::RequestError;
|
||||
use crate::event::{
|
||||
ButtonSource, DeviceId, ElementState, MouseScrollDelta, PointerKind, PointerSource,
|
||||
SurfaceSizeWriter, WindowEvent,
|
||||
};
|
||||
use crate::keyboard::{Key, KeyLocation, ModifiersState, PhysicalKey};
|
||||
use crate::monitor::Fullscreen;
|
||||
use crate::platform::web::WindowAttributesWeb;
|
||||
use crate::window::{WindowAttributes, WindowId};
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct Canvas {
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ use smol_str::SmolStr;
|
|||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
use wasm_bindgen::{JsCast, JsValue};
|
||||
use web_sys::{KeyboardEvent, MouseEvent, Navigator, PointerEvent, WheelEvent};
|
||||
use winit_core::event::{FingerId, MouseButton, MouseScrollDelta, PointerKind};
|
||||
use winit_core::keyboard::{Key, KeyLocation, ModifiersState, NamedKey, PhysicalKey};
|
||||
|
||||
use super::Engine;
|
||||
use crate::event::{FingerId, MouseButton, MouseScrollDelta, PointerKind};
|
||||
use crate::keyboard::{Key, KeyLocation, ModifiersState, NamedKey, PhysicalKey};
|
||||
use crate::platform_impl::web::keyboard::FromAttributeValue;
|
||||
|
||||
bitflags::bitflags! {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ use wasm_bindgen::closure::Closure;
|
|||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
use wasm_bindgen::{JsCast, JsValue};
|
||||
use web_sys::{console, Document, Element, HtmlCanvasElement, Window};
|
||||
use winit_core::monitor::Fullscreen;
|
||||
|
||||
use super::super::main_thread::MainThreadMarker;
|
||||
use super::super::monitor::{self, ScreenDetailed};
|
||||
use crate::monitor::Fullscreen;
|
||||
use crate::platform_impl::MonitorHandle;
|
||||
|
||||
pub(crate) fn request_fullscreen(
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ mod schedule;
|
|||
|
||||
use std::cell::OnceCell;
|
||||
|
||||
use dpi::{LogicalPosition, LogicalSize};
|
||||
use js_sys::Array;
|
||||
use wasm_bindgen::closure::Closure;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
|
@ -23,7 +24,6 @@ pub use self::event_handle::EventListenerHandle;
|
|||
pub use self::resize_scaling::ResizeScaleHandle;
|
||||
pub use self::safe_area::SafeAreaHandle;
|
||||
pub use self::schedule::Schedule;
|
||||
use crate::dpi::{LogicalPosition, LogicalSize};
|
||||
|
||||
pub fn throw(msg: &str) {
|
||||
wasm_bindgen::throw_str(msg);
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use dpi::PhysicalPosition;
|
||||
use web_sys::PointerEvent;
|
||||
use winit_core::event::{ButtonSource, DeviceId, ElementState, Force, PointerKind, PointerSource};
|
||||
use winit_core::keyboard::ModifiersState;
|
||||
|
||||
use super::canvas::Common;
|
||||
use super::event;
|
||||
use super::event_handle::EventListenerHandle;
|
||||
use crate::dpi::PhysicalPosition;
|
||||
use crate::event::{ButtonSource, DeviceId, ElementState, Force, PointerKind, PointerSource};
|
||||
use crate::keyboard::ModifiersState;
|
||||
use crate::platform_impl::web::event::mkdid;
|
||||
use crate::platform_impl::web::web_sys::event::mouse_button_to_id;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
|
||||
use dpi::{LogicalSize, PhysicalSize};
|
||||
use js_sys::{Array, Object};
|
||||
use tracing::warn;
|
||||
use wasm_bindgen::prelude::{wasm_bindgen, Closure};
|
||||
|
|
@ -13,7 +14,6 @@ use web_sys::{
|
|||
use super::super::backend;
|
||||
use super::canvas::Style;
|
||||
use super::media_query_handle::MediaQueryListHandle;
|
||||
use crate::dpi::{LogicalSize, PhysicalSize};
|
||||
|
||||
pub struct ResizeScaleHandle(Rc<ResizeScaleInternal>);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,22 +2,24 @@ use std::cell::Ref;
|
|||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
|
||||
use dpi::{LogicalPosition, LogicalSize};
|
||||
use dpi::{
|
||||
LogicalInsets, LogicalPosition, LogicalSize, PhysicalInsets, PhysicalPosition, PhysicalSize,
|
||||
Position, Size,
|
||||
};
|
||||
use web_sys::HtmlCanvasElement;
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::{NotSupportedError, RequestError};
|
||||
use winit_core::icon::Icon;
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoremMonitorHandle};
|
||||
use winit_core::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as RootWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
use super::main_thread::MainThreadMarker;
|
||||
use super::monitor::MonitorHandler;
|
||||
use super::r#async::Dispatcher;
|
||||
use super::{backend, lock, ActiveEventLoop};
|
||||
use crate::cursor::Cursor;
|
||||
use crate::dpi::{LogicalInsets, PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use crate::error::{NotSupportedError, RequestError};
|
||||
use crate::icon::Icon;
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoremMonitorHandle};
|
||||
use crate::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as RootWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
pub struct Window {
|
||||
inner: Dispatcher<Inner>,
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ use windows_sys::Win32::System::SystemInformation::OSVERSIONINFOW;
|
|||
use windows_sys::Win32::UI::Accessibility::{HCF_HIGHCONTRASTON, HIGHCONTRASTA};
|
||||
use windows_sys::Win32::UI::Controls::SetWindowTheme;
|
||||
use windows_sys::Win32::UI::WindowsAndMessaging::{SystemParametersInfoA, SPI_GETHIGHCONTRAST};
|
||||
use winit_core::window::Theme;
|
||||
|
||||
use super::util;
|
||||
use crate::window::Theme;
|
||||
|
||||
static WIN10_BUILD_VERSION: LazyLock<Option<u32>> = LazyLock::new(|| {
|
||||
type RtlGetVersion = unsafe extern "system" fn(*mut OSVERSIONINFOW) -> NTSTATUS;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use std::path::PathBuf;
|
|||
use std::ptr;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
use dpi::PhysicalPosition;
|
||||
use tracing::debug;
|
||||
use windows_sys::core::{GUID, HRESULT};
|
||||
use windows_sys::Win32::Foundation::{DV_E_FORMATETC, HWND, POINT, POINTL, S_OK};
|
||||
|
|
@ -11,9 +12,8 @@ use windows_sys::Win32::Graphics::Gdi::ScreenToClient;
|
|||
use windows_sys::Win32::System::Com::{DVASPECT_CONTENT, FORMATETC, TYMED_HGLOBAL};
|
||||
use windows_sys::Win32::System::Ole::{CF_HDROP, DROPEFFECT_COPY, DROPEFFECT_NONE};
|
||||
use windows_sys::Win32::UI::Shell::{DragFinish, DragQueryFileW, HDROP};
|
||||
use winit_core::event::WindowEvent;
|
||||
|
||||
use crate::dpi::PhysicalPosition;
|
||||
use crate::event::WindowEvent;
|
||||
use crate::platform_impl::platform::definitions::{
|
||||
IDataObject, IDataObjectVtbl, IDropTarget, IDropTargetVtbl, IUnknown, IUnknownVtbl,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use std::sync::{Arc, LazyLock, Mutex, MutexGuard};
|
|||
use std::time::{Duration, Instant};
|
||||
use std::{fmt, mem, panic, ptr};
|
||||
|
||||
use dpi::{PhysicalPosition, PhysicalSize};
|
||||
use windows_sys::Win32::Foundation::{
|
||||
GetLastError, FALSE, HANDLE, HWND, LPARAM, LRESULT, POINT, RECT, WAIT_FAILED, WPARAM,
|
||||
};
|
||||
|
|
@ -58,25 +59,25 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
|
|||
WM_XBUTTONDOWN, WM_XBUTTONUP, WNDCLASSEXW, WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW,
|
||||
WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP, WS_VISIBLE,
|
||||
};
|
||||
|
||||
pub(super) use self::runner::{Event, EventLoopRunner};
|
||||
use super::window::set_skip_taskbar;
|
||||
use super::SelectedCursor;
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::cursor::{CustomCursor, CustomCursorSource};
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize};
|
||||
use crate::error::{EventLoopError, NotSupportedError, RequestError};
|
||||
use crate::event::{
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::cursor::{CustomCursor, CustomCursorSource};
|
||||
use winit_core::error::{EventLoopError, NotSupportedError, RequestError};
|
||||
use winit_core::event::{
|
||||
DeviceEvent, DeviceId, FingerId, Force, Ime, RawKeyEvent, SurfaceSizeWriter, TouchPhase,
|
||||
WindowEvent,
|
||||
};
|
||||
use crate::event_loop::{
|
||||
use winit_core::event_loop::{
|
||||
ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents,
|
||||
EventLoopProxy as RootEventLoopProxy, EventLoopProxyProvider,
|
||||
OwnedDisplayHandle as CoreOwnedDisplayHandle,
|
||||
};
|
||||
use crate::keyboard::ModifiersState;
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use winit_core::keyboard::ModifiersState;
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle};
|
||||
use winit_core::window::{Theme, Window as CoreWindow, WindowAttributes, WindowId};
|
||||
|
||||
pub(super) use self::runner::{Event, EventLoopRunner};
|
||||
use super::window::set_skip_taskbar;
|
||||
use super::SelectedCursor;
|
||||
use crate::platform::pump_events::PumpStatus;
|
||||
use crate::platform_impl::platform::dark_mode::try_theme;
|
||||
use crate::platform_impl::platform::dpi::{become_dpi_aware, dpi_to_scale_factor};
|
||||
|
|
@ -92,7 +93,6 @@ use crate::platform_impl::platform::window_state::{
|
|||
};
|
||||
use crate::platform_impl::platform::{raw_input, util, wrap_device_id};
|
||||
use crate::platform_impl::Window;
|
||||
use crate::window::{Theme, Window as CoreWindow, WindowAttributes, WindowId};
|
||||
|
||||
pub(crate) struct WindowData {
|
||||
pub window_state: Arc<Mutex<WindowState>>,
|
||||
|
|
@ -930,7 +930,7 @@ fn normalize_pointer_pressure(pressure: u32) -> Option<Force> {
|
|||
/// Emit a `ModifiersChanged` event whenever modifiers have changed.
|
||||
/// Returns the current modifier state
|
||||
fn update_modifiers(window: HWND, userdata: &WindowData) {
|
||||
use crate::event::WindowEvent::ModifiersChanged;
|
||||
use winit_core::event::WindowEvent::ModifiersChanged;
|
||||
|
||||
let modifiers = {
|
||||
let mut layouts = LAYOUT_CACHE.lock().unwrap();
|
||||
|
|
@ -949,7 +949,7 @@ fn update_modifiers(window: HWND, userdata: &WindowData) {
|
|||
}
|
||||
|
||||
unsafe fn gain_active_focus(window: HWND, userdata: &WindowData) {
|
||||
use crate::event::WindowEvent::Focused;
|
||||
use winit_core::event::WindowEvent::Focused;
|
||||
|
||||
update_modifiers(window, userdata);
|
||||
|
||||
|
|
@ -957,7 +957,7 @@ unsafe fn gain_active_focus(window: HWND, userdata: &WindowData) {
|
|||
}
|
||||
|
||||
unsafe fn lose_active_focus(window: HWND, userdata: &WindowData) {
|
||||
use crate::event::WindowEvent::{Focused, ModifiersChanged};
|
||||
use winit_core::event::WindowEvent::{Focused, ModifiersChanged};
|
||||
|
||||
userdata.window_state_lock().modifiers_state = ModifiersState::empty();
|
||||
userdata.send_window_event(window, ModifiersChanged(ModifiersState::empty().into()));
|
||||
|
|
@ -1053,7 +1053,7 @@ unsafe fn public_window_callback_inner(
|
|||
.unwrap_or_else(|| result = ProcResult::Value(-1));
|
||||
|
||||
let keyboard_callback = || {
|
||||
use crate::event::WindowEvent::KeyboardInput;
|
||||
use winit_core::event::WindowEvent::KeyboardInput;
|
||||
let events =
|
||||
userdata.key_event_builder.process_message(window, msg, wparam, lparam, &mut result);
|
||||
for event in events {
|
||||
|
|
@ -1163,13 +1163,13 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_CLOSE => {
|
||||
use crate::event::WindowEvent::CloseRequested;
|
||||
use winit_core::event::WindowEvent::CloseRequested;
|
||||
userdata.send_window_event(window, CloseRequested);
|
||||
result = ProcResult::Value(0);
|
||||
},
|
||||
|
||||
WM_DESTROY => {
|
||||
use crate::event::WindowEvent::Destroyed;
|
||||
use winit_core::event::WindowEvent::Destroyed;
|
||||
unsafe { RevokeDragDrop(window) };
|
||||
userdata.send_window_event(window, Destroyed);
|
||||
result = ProcResult::Value(0);
|
||||
|
|
@ -1286,7 +1286,7 @@ unsafe fn public_window_callback_inner(
|
|||
|
||||
// WM_MOVE supplies client area positions, so we send Moved here instead.
|
||||
WM_WINDOWPOSCHANGED => {
|
||||
use crate::event::WindowEvent::Moved;
|
||||
use winit_core::event::WindowEvent::Moved;
|
||||
|
||||
let windowpos = lparam as *const WINDOWPOS;
|
||||
if unsafe { (*windowpos).flags & SWP_NOMOVE != SWP_NOMOVE } {
|
||||
|
|
@ -1300,7 +1300,7 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_SIZE => {
|
||||
use crate::event::WindowEvent::SurfaceResized;
|
||||
use winit_core::event::WindowEvent::SurfaceResized;
|
||||
let w = super::loword(lparam as u32) as u32;
|
||||
let h = super::hiword(lparam as u32) as u32;
|
||||
|
||||
|
|
@ -1530,8 +1530,8 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_MOUSEMOVE => {
|
||||
use crate::event::WindowEvent::{PointerEntered, PointerLeft, PointerMoved};
|
||||
use crate::event::{PointerKind, PointerSource};
|
||||
use winit_core::event::WindowEvent::{PointerEntered, PointerLeft, PointerMoved};
|
||||
use winit_core::event::{PointerKind, PointerSource};
|
||||
|
||||
let x = super::get_x_lparam(lparam as u32) as i32;
|
||||
let y = super::get_y_lparam(lparam as u32) as i32;
|
||||
|
|
@ -1606,8 +1606,8 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_MOUSELEAVE => {
|
||||
use crate::event::PointerKind::Mouse;
|
||||
use crate::event::WindowEvent::PointerLeft;
|
||||
use winit_core::event::PointerKind::Mouse;
|
||||
use winit_core::event::WindowEvent::PointerLeft;
|
||||
|
||||
{
|
||||
let mut w = userdata.window_state_lock();
|
||||
|
|
@ -1625,7 +1625,7 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_MOUSEWHEEL => {
|
||||
use crate::event::MouseScrollDelta::LineDelta;
|
||||
use winit_core::event::MouseScrollDelta::LineDelta;
|
||||
|
||||
let value = (wparam >> 16) as i16;
|
||||
let value = value as f32 / WHEEL_DELTA as f32;
|
||||
|
|
@ -1642,7 +1642,7 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_MOUSEHWHEEL => {
|
||||
use crate::event::MouseScrollDelta::LineDelta;
|
||||
use winit_core::event::MouseScrollDelta::LineDelta;
|
||||
|
||||
let value = (wparam >> 16) as i16;
|
||||
let value = -value as f32 / WHEEL_DELTA as f32; // NOTE: inverted! See https://github.com/rust-windowing/winit/pull/2105/
|
||||
|
|
@ -1673,9 +1673,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_LBUTTONDOWN => {
|
||||
use crate::event::ElementState::Pressed;
|
||||
use crate::event::MouseButton::Left;
|
||||
use crate::event::WindowEvent::PointerButton;
|
||||
use winit_core::event::ElementState::Pressed;
|
||||
use winit_core::event::MouseButton::Left;
|
||||
use winit_core::event::WindowEvent::PointerButton;
|
||||
|
||||
unsafe { capture_mouse(window, &mut userdata.window_state_lock()) };
|
||||
|
||||
|
|
@ -1696,9 +1696,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_LBUTTONUP => {
|
||||
use crate::event::ElementState::Released;
|
||||
use crate::event::MouseButton::Left;
|
||||
use crate::event::WindowEvent::PointerButton;
|
||||
use winit_core::event::ElementState::Released;
|
||||
use winit_core::event::MouseButton::Left;
|
||||
use winit_core::event::WindowEvent::PointerButton;
|
||||
|
||||
unsafe { release_mouse(userdata.window_state_lock()) };
|
||||
|
||||
|
|
@ -1719,9 +1719,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_RBUTTONDOWN => {
|
||||
use crate::event::ElementState::Pressed;
|
||||
use crate::event::MouseButton::Right;
|
||||
use crate::event::WindowEvent::PointerButton;
|
||||
use winit_core::event::ElementState::Pressed;
|
||||
use winit_core::event::MouseButton::Right;
|
||||
use winit_core::event::WindowEvent::PointerButton;
|
||||
|
||||
unsafe { capture_mouse(window, &mut userdata.window_state_lock()) };
|
||||
|
||||
|
|
@ -1742,9 +1742,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_RBUTTONUP => {
|
||||
use crate::event::ElementState::Released;
|
||||
use crate::event::MouseButton::Right;
|
||||
use crate::event::WindowEvent::PointerButton;
|
||||
use winit_core::event::ElementState::Released;
|
||||
use winit_core::event::MouseButton::Right;
|
||||
use winit_core::event::WindowEvent::PointerButton;
|
||||
|
||||
unsafe { release_mouse(userdata.window_state_lock()) };
|
||||
|
||||
|
|
@ -1765,9 +1765,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_MBUTTONDOWN => {
|
||||
use crate::event::ElementState::Pressed;
|
||||
use crate::event::MouseButton::Middle;
|
||||
use crate::event::WindowEvent::PointerButton;
|
||||
use winit_core::event::ElementState::Pressed;
|
||||
use winit_core::event::MouseButton::Middle;
|
||||
use winit_core::event::WindowEvent::PointerButton;
|
||||
|
||||
unsafe { capture_mouse(window, &mut userdata.window_state_lock()) };
|
||||
|
||||
|
|
@ -1788,9 +1788,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_MBUTTONUP => {
|
||||
use crate::event::ElementState::Released;
|
||||
use crate::event::MouseButton::Middle;
|
||||
use crate::event::WindowEvent::PointerButton;
|
||||
use winit_core::event::ElementState::Released;
|
||||
use winit_core::event::MouseButton::Middle;
|
||||
use winit_core::event::WindowEvent::PointerButton;
|
||||
|
||||
unsafe { release_mouse(userdata.window_state_lock()) };
|
||||
|
||||
|
|
@ -1811,9 +1811,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_XBUTTONDOWN => {
|
||||
use crate::event::ElementState::Pressed;
|
||||
use crate::event::MouseButton::{Back, Forward, Other};
|
||||
use crate::event::WindowEvent::PointerButton;
|
||||
use winit_core::event::ElementState::Pressed;
|
||||
use winit_core::event::MouseButton::{Back, Forward, Other};
|
||||
use winit_core::event::WindowEvent::PointerButton;
|
||||
let xbutton = super::get_xbutton_wparam(wparam as u32);
|
||||
|
||||
unsafe { capture_mouse(window, &mut userdata.window_state_lock()) };
|
||||
|
|
@ -1840,9 +1840,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_XBUTTONUP => {
|
||||
use crate::event::ElementState::Released;
|
||||
use crate::event::MouseButton::{Back, Forward, Other};
|
||||
use crate::event::WindowEvent::PointerButton;
|
||||
use winit_core::event::ElementState::Released;
|
||||
use winit_core::event::MouseButton::{Back, Forward, Other};
|
||||
use winit_core::event::WindowEvent::PointerButton;
|
||||
let xbutton = super::get_xbutton_wparam(wparam as u32);
|
||||
|
||||
unsafe { release_mouse(userdata.window_state_lock()) };
|
||||
|
|
@ -1880,9 +1880,9 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_TOUCH => {
|
||||
use crate::event::ButtonSource::Touch;
|
||||
use crate::event::ElementState::{Pressed, Released};
|
||||
use crate::event::{PointerKind, PointerSource};
|
||||
use winit_core::event::ButtonSource::Touch;
|
||||
use winit_core::event::ElementState::{Pressed, Released};
|
||||
use winit_core::event::{PointerKind, PointerSource};
|
||||
|
||||
let pcount = super::loword(wparam as u32) as usize;
|
||||
let mut inputs = Vec::with_capacity(pcount);
|
||||
|
|
@ -1955,8 +1955,8 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_POINTERDOWN | WM_POINTERUPDATE | WM_POINTERUP => {
|
||||
use crate::event::ElementState::{Pressed, Released};
|
||||
use crate::event::{ButtonSource, PointerKind, PointerSource};
|
||||
use winit_core::event::ElementState::{Pressed, Released};
|
||||
use winit_core::event::{ButtonSource, PointerKind, PointerSource};
|
||||
|
||||
if let (
|
||||
Some(GetPointerFrameInfoHistory),
|
||||
|
|
@ -2215,7 +2215,7 @@ unsafe fn public_window_callback_inner(
|
|||
// Only sent on Windows 8.1 or newer. On Windows 7 and older user has to log out to change
|
||||
// DPI, therefore all applications are closed while DPI is changing.
|
||||
WM_DPICHANGED => {
|
||||
use crate::event::WindowEvent::ScaleFactorChanged;
|
||||
use winit_core::event::WindowEvent::ScaleFactorChanged;
|
||||
|
||||
// This message actually provides two DPI values - x and y. However MSDN says that
|
||||
// "you only need to use either the X-axis or the Y-axis value when scaling your
|
||||
|
|
@ -2419,7 +2419,7 @@ unsafe fn public_window_callback_inner(
|
|||
},
|
||||
|
||||
WM_SETTINGCHANGE => {
|
||||
use crate::event::WindowEvent::ThemeChanged;
|
||||
use winit_core::event::WindowEvent::ThemeChanged;
|
||||
|
||||
let preferred_theme = userdata.window_state_lock().preferred_theme;
|
||||
|
||||
|
|
@ -2538,9 +2538,9 @@ unsafe extern "system" fn thread_event_target_callback(
|
|||
}
|
||||
|
||||
unsafe fn handle_raw_input(userdata: &ThreadMsgTargetData, data: RAWINPUT) {
|
||||
use crate::event::DeviceEvent::{Button, Key, MouseWheel, PointerMotion};
|
||||
use crate::event::ElementState::{Pressed, Released};
|
||||
use crate::event::MouseScrollDelta::LineDelta;
|
||||
use winit_core::event::DeviceEvent::{Button, Key, MouseWheel, PointerMotion};
|
||||
use winit_core::event::ElementState::{Pressed, Released};
|
||||
use winit_core::event::MouseScrollDelta::LineDelta;
|
||||
|
||||
let device_id = wrap_device_id(data.header.hDevice as _);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@ use std::sync::{Arc, Mutex};
|
|||
use std::time::Instant;
|
||||
use std::{fmt, mem, panic};
|
||||
|
||||
use dpi::PhysicalSize;
|
||||
use windows_sys::Win32::Foundation::HWND;
|
||||
use winit_core::application::ApplicationHandler;
|
||||
use winit_core::event::{DeviceEvent, DeviceId, StartCause, SurfaceSizeWriter, WindowEvent};
|
||||
use winit_core::event_loop::ActiveEventLoop as RootActiveEventLoop;
|
||||
use winit_core::window::WindowId;
|
||||
|
||||
use super::{ActiveEventLoop, ControlFlow, EventLoopThreadExecutor};
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::dpi::PhysicalSize;
|
||||
use crate::event::{DeviceEvent, DeviceId, StartCause, SurfaceSizeWriter, WindowEvent};
|
||||
use crate::event_loop::ActiveEventLoop as RootActiveEventLoop;
|
||||
use crate::platform_impl::platform::event_loop::{WindowData, GWL_USERDATA};
|
||||
use crate::platform_impl::platform::get_window_long;
|
||||
use crate::window::WindowId;
|
||||
|
||||
type EventHandler = Cell<Option<&'static mut (dyn ApplicationHandler + 'static)>>;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use std::sync::Arc;
|
|||
use std::{fmt, io, mem, ptr};
|
||||
|
||||
use cursor_icon::CursorIcon;
|
||||
use dpi::PhysicalSize;
|
||||
use windows_sys::core::PCWSTR;
|
||||
use windows_sys::Win32::Graphics::Gdi::{
|
||||
CreateBitmap, CreateCompatibleBitmap, DeleteObject, GetDC, ReleaseDC, SetBitmapBits,
|
||||
|
|
@ -12,12 +13,11 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
|
|||
CreateIcon, CreateIconIndirect, DestroyCursor, DestroyIcon, LoadImageW, HCURSOR, HICON,
|
||||
ICONINFO, ICON_BIG, ICON_SMALL, IMAGE_ICON, LR_DEFAULTSIZE, LR_LOADFROMFILE,
|
||||
};
|
||||
use winit_core::cursor::{CursorImage, CustomCursorProvider};
|
||||
use winit_core::error::RequestError;
|
||||
use winit_core::icon::*;
|
||||
|
||||
use super::util;
|
||||
use crate::cursor::{CursorImage, CustomCursorProvider};
|
||||
use crate::dpi::PhysicalSize;
|
||||
use crate::error::RequestError;
|
||||
use crate::icon::*;
|
||||
use crate::platform::windows::WinIcon;
|
||||
|
||||
pub(crate) const PIXEL_SIZE: usize = mem::size_of::<Pixel>();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use std::ffi::{c_void, OsString};
|
|||
use std::os::windows::prelude::OsStringExt;
|
||||
use std::ptr::null_mut;
|
||||
|
||||
use dpi::{Position, Size};
|
||||
use windows_sys::Win32::Foundation::{POINT, RECT};
|
||||
use windows_sys::Win32::UI::Input::Ime::{
|
||||
ImmAssociateContextEx, ImmGetCompositionStringW, ImmGetContext, ImmReleaseContext,
|
||||
|
|
@ -11,7 +12,6 @@ use windows_sys::Win32::UI::Input::Ime::{
|
|||
};
|
||||
use windows_sys::Win32::UI::WindowsAndMessaging::{GetSystemMetrics, SM_IMMENABLED};
|
||||
|
||||
use crate::dpi::{Position, Size};
|
||||
use crate::platform::windows::HWND;
|
||||
|
||||
pub struct ImeContext {
|
||||
|
|
|
|||
|
|
@ -24,9 +24,11 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
|
|||
PeekMessageW, MSG, PM_NOREMOVE, WM_CHAR, WM_DEADCHAR, WM_KEYDOWN, WM_KEYFIRST, WM_KEYLAST,
|
||||
WM_KEYUP, WM_KILLFOCUS, WM_SETFOCUS, WM_SYSCHAR, WM_SYSDEADCHAR, WM_SYSKEYDOWN, WM_SYSKEYUP,
|
||||
};
|
||||
use winit_core::event::{ElementState, KeyEvent};
|
||||
use winit_core::keyboard::{
|
||||
Key, KeyCode, KeyLocation, NamedKey, NativeKey, NativeKeyCode, PhysicalKey,
|
||||
};
|
||||
|
||||
use crate::event::{ElementState, KeyEvent};
|
||||
use crate::keyboard::{Key, KeyCode, KeyLocation, NamedKey, NativeKey, NativeKeyCode, PhysicalKey};
|
||||
use crate::platform_impl::platform::event_loop::ProcResult;
|
||||
use crate::platform_impl::platform::keyboard_layout::{
|
||||
Layout, LayoutCache, WindowsModifiers, LAYOUT_CACHE,
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ use windows_sys::Win32::UI::Input::KeyboardAndMouse::{
|
|||
VK_SCROLL, VK_SELECT, VK_SEPARATOR, VK_SHIFT, VK_SLEEP, VK_SNAPSHOT, VK_SPACE, VK_SUBTRACT,
|
||||
VK_TAB, VK_UP, VK_VOLUME_DOWN, VK_VOLUME_MUTE, VK_VOLUME_UP, VK_XBUTTON1, VK_XBUTTON2, VK_ZOOM,
|
||||
};
|
||||
use winit_core::keyboard::{Key, KeyCode, ModifiersState, NamedKey, NativeKey, PhysicalKey};
|
||||
|
||||
use crate::keyboard::{Key, KeyCode, ModifiersState, NamedKey, NativeKey, PhysicalKey};
|
||||
use crate::platform_impl::{loword, primarylangid, scancode_to_physicalkey};
|
||||
|
||||
pub(crate) static LAYOUT_CACHE: LazyLock<Mutex<LayoutCache>> =
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use windows_sys::Win32::Foundation::HWND;
|
||||
use windows_sys::Win32::UI::WindowsAndMessaging::WINDOW_LONG_PTR_INDEX;
|
||||
use winit_core::event::DeviceId;
|
||||
|
||||
pub(crate) use self::event_loop::{EventLoop, PlatformSpecificEventLoopAttributes};
|
||||
pub(crate) use self::icon::{RaiiIcon, SelectedCursor};
|
||||
pub(crate) use self::keyboard::{physicalkey_to_scancode, scancode_to_physicalkey};
|
||||
pub(crate) use self::monitor::MonitorHandle;
|
||||
pub(crate) use self::window::Window;
|
||||
use crate::event::DeviceId;
|
||||
|
||||
fn wrap_device_id(id: u32) -> DeviceId {
|
||||
DeviceId::from_raw(id as i64)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use std::hash::Hash;
|
|||
use std::num::{NonZeroU16, NonZeroU32};
|
||||
use std::{io, iter, mem, ptr};
|
||||
|
||||
use dpi::{PhysicalPosition, PhysicalSize};
|
||||
use windows_sys::Win32::Foundation::{BOOL, HWND, LPARAM, POINT, RECT};
|
||||
use windows_sys::Win32::Graphics::Gdi::{
|
||||
EnumDisplayMonitors, EnumDisplaySettingsExW, GetMonitorInfoW, MonitorFromPoint,
|
||||
|
|
@ -10,10 +11,9 @@ use windows_sys::Win32::Graphics::Gdi::{
|
|||
ENUM_CURRENT_SETTINGS, HDC, HMONITOR, MONITORINFO, MONITORINFOEXW, MONITOR_DEFAULTTONEAREST,
|
||||
MONITOR_DEFAULTTOPRIMARY,
|
||||
};
|
||||
use winit_core::monitor::{MonitorHandleProvider, VideoMode};
|
||||
|
||||
use super::util::decode_wide;
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize};
|
||||
use crate::monitor::{MonitorHandleProvider, VideoMode};
|
||||
use crate::platform_impl::platform::dpi::{dpi_to_scale_factor, get_monitor_dpi};
|
||||
use crate::platform_impl::platform::util::has_flag;
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ impl MonitorHandleProvider for MonitorHandle {
|
|||
dpi_to_scale_factor(get_monitor_dpi(self.0).unwrap_or(96))
|
||||
}
|
||||
|
||||
fn current_video_mode(&self) -> Option<crate::monitor::VideoMode> {
|
||||
fn current_video_mode(&self) -> Option<winit_core::monitor::VideoMode> {
|
||||
let monitor_info = get_monitor_info(self.0).ok()?;
|
||||
let device_name = monitor_info.szDevice.as_ptr();
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
|
|||
RI_MOUSE_BUTTON_2_UP, RI_MOUSE_BUTTON_3_DOWN, RI_MOUSE_BUTTON_3_UP, RI_MOUSE_BUTTON_4_DOWN,
|
||||
RI_MOUSE_BUTTON_4_UP, RI_MOUSE_BUTTON_5_DOWN, RI_MOUSE_BUTTON_5_UP,
|
||||
};
|
||||
use winit_core::event::ElementState;
|
||||
use winit_core::event_loop::DeviceEvents;
|
||||
use winit_core::keyboard::{KeyCode, PhysicalKey};
|
||||
|
||||
use super::scancode_to_physicalkey;
|
||||
use crate::event::ElementState;
|
||||
use crate::event_loop::DeviceEvents;
|
||||
use crate::keyboard::{KeyCode, PhysicalKey};
|
||||
use crate::platform_impl::platform::util;
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
|
|||
SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN, SW_MAXIMIZE,
|
||||
WINDOWPLACEMENT,
|
||||
};
|
||||
|
||||
use crate::cursor::CursorIcon;
|
||||
use winit_core::cursor::CursorIcon;
|
||||
|
||||
pub fn encode_wide(string: impl AsRef<OsStr>) -> Vec<u16> {
|
||||
string.as_ref().encode_wide().chain(once(0)).collect()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use std::sync::mpsc::channel;
|
|||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
use std::{io, panic, ptr};
|
||||
|
||||
use dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use tracing::warn;
|
||||
use windows_sys::Win32::Foundation::{
|
||||
HWND, LPARAM, OLE_E_WRONGCOMPOBJ, POINT, POINTS, RECT, RPC_E_CHANGED_MODE, S_OK, WPARAM,
|
||||
|
|
@ -47,14 +48,17 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
|
|||
TPM_RETURNCMD, WDA_EXCLUDEFROMCAPTURE, WDA_NONE, WM_NCLBUTTONDOWN, WM_SETICON, WM_SYSCOMMAND,
|
||||
WNDCLASSEXW,
|
||||
};
|
||||
use winit_core::cursor::Cursor;
|
||||
use winit_core::error::RequestError;
|
||||
use winit_core::icon::{Icon, RgbaIcon};
|
||||
use winit_core::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle, MonitorHandleProvider};
|
||||
use winit_core::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
use super::icon::WinCursor;
|
||||
use super::MonitorHandle;
|
||||
use crate::cursor::Cursor;
|
||||
use crate::dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use crate::error::RequestError;
|
||||
use crate::icon::{Icon, RgbaIcon};
|
||||
use crate::monitor::{Fullscreen, MonitorHandle as CoreMonitorHandle, MonitorHandleProvider};
|
||||
use crate::platform::windows::{
|
||||
BackdropType, Color, CornerPreference, WinIcon, WindowAttributesWindows,
|
||||
};
|
||||
|
|
@ -76,10 +80,6 @@ use crate::platform_impl::platform::window_state::{
|
|||
CursorFlags, SavedWindow, WindowFlags, WindowState,
|
||||
};
|
||||
use crate::platform_impl::platform::{monitor, util, SelectedCursor};
|
||||
use crate::window::{
|
||||
CursorGrabMode, ImePurpose, ResizeDirection, Theme, UserAttentionType, Window as CoreWindow,
|
||||
WindowAttributes, WindowButtons, WindowId, WindowLevel,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(transparent)]
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use std::sync::MutexGuard;
|
|||
use std::{fmt, io, ptr};
|
||||
|
||||
use bitflags::bitflags;
|
||||
use dpi::{PhysicalPosition, PhysicalSize, Size};
|
||||
use windows_sys::Win32::Foundation::{HWND, RECT};
|
||||
use windows_sys::Win32::Graphics::Gdi::InvalidateRgn;
|
||||
use windows_sys::Win32::UI::WindowsAndMessaging::{
|
||||
|
|
@ -15,13 +16,12 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
|
|||
WS_EX_TOPMOST, WS_EX_TRANSPARENT, WS_EX_WINDOWEDGE, WS_MAXIMIZE, WS_MAXIMIZEBOX, WS_MINIMIZE,
|
||||
WS_MINIMIZEBOX, WS_OVERLAPPEDWINDOW, WS_POPUP, WS_SIZEBOX, WS_SYSMENU, WS_VISIBLE,
|
||||
};
|
||||
use winit_core::icon::Icon;
|
||||
use winit_core::keyboard::ModifiersState;
|
||||
use winit_core::monitor::Fullscreen;
|
||||
use winit_core::window::{Theme, WindowAttributes};
|
||||
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize, Size};
|
||||
use crate::icon::Icon;
|
||||
use crate::keyboard::ModifiersState;
|
||||
use crate::monitor::Fullscreen;
|
||||
use crate::platform_impl::platform::{event_loop, util, SelectedCursor};
|
||||
use crate::window::{Theme, WindowAttributes};
|
||||
|
||||
/// Contains information about states and the window that the callback is going to use.
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue