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