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
|
|
@ -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>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue