Migrate to 2018 edition. (#924)
* Migrate to 2018 edition. * Use impl Iterator at one site. * Fix more rust 2018 idioms.
This commit is contained in:
parent
2e0bbc091f
commit
f879bca21c
71 changed files with 411 additions and 436 deletions
|
|
@ -14,17 +14,17 @@ use winapi::um::oleidl::{DROPEFFECT_COPY, DROPEFFECT_NONE, IDropTarget, IDropTar
|
|||
use winapi::um::winnt::HRESULT;
|
||||
use winapi::um::{shellapi, unknwnbase};
|
||||
|
||||
use platform_impl::platform::WindowId;
|
||||
use crate::platform_impl::platform::WindowId;
|
||||
|
||||
use event::Event;
|
||||
use window::WindowId as SuperWindowId;
|
||||
use crate::event::Event;
|
||||
use crate::window::WindowId as SuperWindowId;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct FileDropHandlerData {
|
||||
pub interface: IDropTarget,
|
||||
refcount: AtomicUsize,
|
||||
window: HWND,
|
||||
send_event: Box<Fn(Event<()>)>,
|
||||
send_event: Box<dyn Fn(Event<()>)>,
|
||||
cursor_effect: DWORD,
|
||||
hovered_is_valid: bool, // If the currently hovered item is not valid there must not be any `HoveredFileCancelled` emitted
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ pub struct FileDropHandler {
|
|||
|
||||
#[allow(non_snake_case)]
|
||||
impl FileDropHandler {
|
||||
pub fn new(window: HWND, send_event: Box<Fn(Event<()>)>) -> FileDropHandler {
|
||||
pub fn new(window: HWND, send_event: Box<dyn Fn(Event<()>)>) -> FileDropHandler {
|
||||
let data = Box::new(FileDropHandlerData {
|
||||
interface: IDropTarget {
|
||||
lpVtbl: &DROP_TARGET_VTBL as *const IDropTargetVtbl,
|
||||
|
|
@ -85,7 +85,7 @@ impl FileDropHandler {
|
|||
_pt: *const POINTL,
|
||||
pdwEffect: *mut DWORD,
|
||||
) -> HRESULT {
|
||||
use event::WindowEvent::HoveredFile;
|
||||
use crate::event::WindowEvent::HoveredFile;
|
||||
let drop_handler = Self::from_interface(this);
|
||||
let hdrop = Self::iterate_filenames(pDataObj, |filename| {
|
||||
drop_handler.send_event(Event::WindowEvent {
|
||||
|
|
@ -117,7 +117,7 @@ impl FileDropHandler {
|
|||
}
|
||||
|
||||
pub unsafe extern "system" fn DragLeave(this: *mut IDropTarget) -> HRESULT {
|
||||
use event::WindowEvent::HoveredFileCancelled;
|
||||
use crate::event::WindowEvent::HoveredFileCancelled;
|
||||
let drop_handler = Self::from_interface(this);
|
||||
if drop_handler.hovered_is_valid {
|
||||
drop_handler.send_event(Event::WindowEvent {
|
||||
|
|
@ -136,7 +136,7 @@ impl FileDropHandler {
|
|||
_pt: *const POINTL,
|
||||
_pdwEffect: *mut DWORD,
|
||||
) -> HRESULT {
|
||||
use event::WindowEvent::DroppedFile;
|
||||
use crate::event::WindowEvent::DroppedFile;
|
||||
let drop_handler = Self::from_interface(this);
|
||||
let hdrop = Self::iterate_filenames(pDataObj, |filename| {
|
||||
drop_handler.send_event(Event::WindowEvent {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{char, ptr};
|
|||
use std::os::raw::c_int;
|
||||
use std::sync::atomic::{AtomicBool, AtomicPtr, Ordering};
|
||||
|
||||
use event::{ScanCode, ModifiersState, VirtualKeyCode};
|
||||
use crate::event::{ScanCode, ModifiersState, VirtualKeyCode};
|
||||
|
||||
use winapi::shared::minwindef::{WPARAM, LPARAM, UINT, HKL, HKL__};
|
||||
use winapi::um::winuser;
|
||||
|
|
|
|||
|
|
@ -43,22 +43,22 @@ use winapi::shared::{windowsx, winerror};
|
|||
use winapi::um::{winuser, winbase, ole2, processthreadsapi, commctrl, libloaderapi};
|
||||
use winapi::um::winnt::{LONG, LPCSTR, SHORT};
|
||||
|
||||
use window::WindowId as RootWindowId;
|
||||
use event_loop::{ControlFlow, EventLoopWindowTarget as RootELW, EventLoopClosed};
|
||||
use dpi::{LogicalPosition, LogicalSize, PhysicalSize};
|
||||
use event::{DeviceEvent, Touch, TouchPhase, StartCause, KeyboardInput, Event, WindowEvent};
|
||||
use platform_impl::platform::{event, WindowId, DEVICE_ID, wrap_device_id, util};
|
||||
use platform_impl::platform::dpi::{
|
||||
use crate::window::WindowId as RootWindowId;
|
||||
use crate::event_loop::{ControlFlow, EventLoopWindowTarget as RootELW, EventLoopClosed};
|
||||
use crate::dpi::{LogicalPosition, LogicalSize, PhysicalSize};
|
||||
use crate::event::{DeviceEvent, Touch, TouchPhase, StartCause, KeyboardInput, Event, WindowEvent};
|
||||
use crate::platform_impl::platform::{event, WindowId, DEVICE_ID, wrap_device_id, util};
|
||||
use crate::platform_impl::platform::dpi::{
|
||||
become_dpi_aware,
|
||||
dpi_to_scale_factor,
|
||||
enable_non_client_dpi_scaling,
|
||||
hwnd_scale_factor,
|
||||
};
|
||||
use platform_impl::platform::drop_handler::FileDropHandler;
|
||||
use platform_impl::platform::event::{handle_extended_keys, process_key_params, vkey_to_winit_vkey};
|
||||
use platform_impl::platform::raw_input::{get_raw_input_data, get_raw_mouse_button_state};
|
||||
use platform_impl::platform::window::adjust_size;
|
||||
use platform_impl::platform::window_state::{CursorFlags, WindowFlags, WindowState};
|
||||
use crate::platform_impl::platform::drop_handler::FileDropHandler;
|
||||
use crate::platform_impl::platform::event::{handle_extended_keys, process_key_params, vkey_to_winit_vkey};
|
||||
use crate::platform_impl::platform::raw_input::{get_raw_input_data, get_raw_mouse_button_state};
|
||||
use crate::platform_impl::platform::window::adjust_size;
|
||||
use crate::platform_impl::platform::window_state::{CursorFlags, WindowFlags, WindowState};
|
||||
|
||||
pub(crate) struct SubclassInput<T> {
|
||||
pub window_state: Arc<Mutex<WindowState>>,
|
||||
|
|
@ -237,10 +237,10 @@ pub(crate) struct EventLoopRunner<T> {
|
|||
runner_state: RunnerState,
|
||||
modal_redraw_window: HWND,
|
||||
in_modal_loop: bool,
|
||||
event_handler: Box<FnMut(Event<T>, &mut ControlFlow)>,
|
||||
event_handler: Box<dyn FnMut(Event<T>, &mut ControlFlow)>,
|
||||
panic_error: Option<PanicError>,
|
||||
}
|
||||
type PanicError = Box<Any + Send + 'static>;
|
||||
type PanicError = Box<dyn Any + Send + 'static>;
|
||||
|
||||
impl<T> ELRShared<T> {
|
||||
pub(crate) unsafe fn send_event(&self, event: Event<T>) {
|
||||
|
|
@ -297,8 +297,8 @@ impl<T> EventLoopRunner<T> {
|
|||
in_modal_loop: false,
|
||||
modal_redraw_window: event_loop.window_target.p.thread_msg_target,
|
||||
event_handler: mem::transmute::<
|
||||
Box<FnMut(Event<T>, &mut ControlFlow)>,
|
||||
Box<FnMut(Event<T>, &mut ControlFlow)>
|
||||
Box<dyn FnMut(Event<T>, &mut ControlFlow)>,
|
||||
Box<dyn FnMut(Event<T>, &mut ControlFlow)>
|
||||
>(Box::new(f)),
|
||||
panic_error: None,
|
||||
}
|
||||
|
|
@ -583,7 +583,7 @@ impl EventLoopThreadExecutor {
|
|||
function();
|
||||
} else {
|
||||
// We double-box because the first box is a fat pointer.
|
||||
let boxed = Box::new(function) as Box<FnMut()>;
|
||||
let boxed = Box::new(function) as Box<dyn FnMut()>;
|
||||
let boxed2: ThreadExecFn = Box::new(boxed);
|
||||
|
||||
let raw = Box::into_raw(boxed2);
|
||||
|
|
@ -598,7 +598,7 @@ impl EventLoopThreadExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
type ThreadExecFn = Box<Box<FnMut()>>;
|
||||
type ThreadExecFn = Box<Box<dyn FnMut()>>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct EventLoopProxy<T: 'static> {
|
||||
|
|
@ -629,7 +629,7 @@ lazy_static! {
|
|||
}
|
||||
};
|
||||
// Message sent when we want to execute a closure in the thread.
|
||||
// WPARAM contains a Box<Box<FnMut()>> that must be retrieved with `Box::from_raw`,
|
||||
// WPARAM contains a Box<Box<dyn FnMut()>> that must be retrieved with `Box::from_raw`,
|
||||
// and LPARAM is unused.
|
||||
static ref EXEC_MSG_ID: u32 = {
|
||||
unsafe {
|
||||
|
|
@ -814,7 +814,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_CLOSE => {
|
||||
use event::WindowEvent::CloseRequested;
|
||||
use crate::event::WindowEvent::CloseRequested;
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window)),
|
||||
event: CloseRequested,
|
||||
|
|
@ -823,7 +823,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_DESTROY => {
|
||||
use event::WindowEvent::Destroyed;
|
||||
use crate::event::WindowEvent::Destroyed;
|
||||
ole2::RevokeDragDrop(window);
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window)),
|
||||
|
|
@ -836,7 +836,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
_ if msg == *REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID => {
|
||||
use event::WindowEvent::RedrawRequested;
|
||||
use crate::event::WindowEvent::RedrawRequested;
|
||||
let mut runner = subclass_input.event_loop_runner.runner.borrow_mut();
|
||||
if let Some(ref mut runner) = *runner {
|
||||
// This check makes sure that calls to `request_redraw()` during `EventsCleared`
|
||||
|
|
@ -871,7 +871,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
0
|
||||
},
|
||||
winuser::WM_PAINT => {
|
||||
use event::WindowEvent::RedrawRequested;
|
||||
use crate::event::WindowEvent::RedrawRequested;
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window)),
|
||||
event: RedrawRequested,
|
||||
|
|
@ -881,7 +881,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
|
||||
// WM_MOVE supplies client area positions, so we send Moved here instead.
|
||||
winuser::WM_WINDOWPOSCHANGED => {
|
||||
use event::WindowEvent::Moved;
|
||||
use crate::event::WindowEvent::Moved;
|
||||
|
||||
let windowpos = lparam as *const winuser::WINDOWPOS;
|
||||
if (*windowpos).flags & winuser::SWP_NOMOVE != winuser::SWP_NOMOVE {
|
||||
|
|
@ -901,7 +901,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_SIZE => {
|
||||
use event::WindowEvent::Resized;
|
||||
use crate::event::WindowEvent::Resized;
|
||||
let w = LOWORD(lparam as DWORD) as u32;
|
||||
let h = HIWORD(lparam as DWORD) as u32;
|
||||
|
||||
|
|
@ -926,7 +926,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_CHAR => {
|
||||
use event::WindowEvent::ReceivedCharacter;
|
||||
use crate::event::WindowEvent::ReceivedCharacter;
|
||||
let chr: char = mem::transmute(wparam as u32);
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window)),
|
||||
|
|
@ -944,7 +944,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
}
|
||||
|
||||
winuser::WM_MOUSEMOVE => {
|
||||
use event::WindowEvent::{CursorEntered, CursorMoved};
|
||||
use crate::event::WindowEvent::{CursorEntered, CursorMoved};
|
||||
let mouse_was_outside_window = {
|
||||
let mut w = subclass_input.window_state.lock();
|
||||
|
||||
|
|
@ -982,7 +982,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_MOUSELEAVE => {
|
||||
use event::WindowEvent::CursorLeft;
|
||||
use crate::event::WindowEvent::CursorLeft;
|
||||
{
|
||||
let mut w = subclass_input.window_state.lock();
|
||||
w.mouse.set_cursor_flags(window, |f| f.set(CursorFlags::IN_WINDOW, false)).ok();
|
||||
|
|
@ -997,7 +997,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_MOUSEWHEEL => {
|
||||
use event::MouseScrollDelta::LineDelta;
|
||||
use crate::event::MouseScrollDelta::LineDelta;
|
||||
|
||||
let value = (wparam >> 16) as i16;
|
||||
let value = value as i32;
|
||||
|
|
@ -1012,7 +1012,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_MOUSEHWHEEL => {
|
||||
use event::MouseScrollDelta::LineDelta;
|
||||
use crate::event::MouseScrollDelta::LineDelta;
|
||||
|
||||
let value = (wparam >> 16) as i16;
|
||||
let value = value as i32;
|
||||
|
|
@ -1027,8 +1027,8 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_KEYDOWN | winuser::WM_SYSKEYDOWN => {
|
||||
use event::ElementState::Pressed;
|
||||
use event::VirtualKeyCode;
|
||||
use crate::event::ElementState::Pressed;
|
||||
use crate::event::VirtualKeyCode;
|
||||
if msg == winuser::WM_SYSKEYDOWN && wparam as i32 == winuser::VK_F4 {
|
||||
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
||||
} else {
|
||||
|
|
@ -1059,7 +1059,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_KEYUP | winuser::WM_SYSKEYUP => {
|
||||
use event::ElementState::Released;
|
||||
use crate::event::ElementState::Released;
|
||||
if let Some((scancode, vkey)) = process_key_params(wparam, lparam) {
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window)),
|
||||
|
|
@ -1078,9 +1078,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_LBUTTONDOWN => {
|
||||
use event::WindowEvent::MouseInput;
|
||||
use event::MouseButton::Left;
|
||||
use event::ElementState::Pressed;
|
||||
use crate::event::WindowEvent::MouseInput;
|
||||
use crate::event::MouseButton::Left;
|
||||
use crate::event::ElementState::Pressed;
|
||||
|
||||
capture_mouse(window, &mut *subclass_input.window_state.lock());
|
||||
|
||||
|
|
@ -1092,9 +1092,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_LBUTTONUP => {
|
||||
use event::WindowEvent::MouseInput;
|
||||
use event::MouseButton::Left;
|
||||
use event::ElementState::Released;
|
||||
use crate::event::WindowEvent::MouseInput;
|
||||
use crate::event::MouseButton::Left;
|
||||
use crate::event::ElementState::Released;
|
||||
|
||||
release_mouse(&mut *subclass_input.window_state.lock());
|
||||
|
||||
|
|
@ -1106,9 +1106,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_RBUTTONDOWN => {
|
||||
use event::WindowEvent::MouseInput;
|
||||
use event::MouseButton::Right;
|
||||
use event::ElementState::Pressed;
|
||||
use crate::event::WindowEvent::MouseInput;
|
||||
use crate::event::MouseButton::Right;
|
||||
use crate::event::ElementState::Pressed;
|
||||
|
||||
capture_mouse(window, &mut *subclass_input.window_state.lock());
|
||||
|
||||
|
|
@ -1120,9 +1120,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_RBUTTONUP => {
|
||||
use event::WindowEvent::MouseInput;
|
||||
use event::MouseButton::Right;
|
||||
use event::ElementState::Released;
|
||||
use crate::event::WindowEvent::MouseInput;
|
||||
use crate::event::MouseButton::Right;
|
||||
use crate::event::ElementState::Released;
|
||||
|
||||
release_mouse(&mut *subclass_input.window_state.lock());
|
||||
|
||||
|
|
@ -1134,9 +1134,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_MBUTTONDOWN => {
|
||||
use event::WindowEvent::MouseInput;
|
||||
use event::MouseButton::Middle;
|
||||
use event::ElementState::Pressed;
|
||||
use crate::event::WindowEvent::MouseInput;
|
||||
use crate::event::MouseButton::Middle;
|
||||
use crate::event::ElementState::Pressed;
|
||||
|
||||
capture_mouse(window, &mut *subclass_input.window_state.lock());
|
||||
|
||||
|
|
@ -1148,9 +1148,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_MBUTTONUP => {
|
||||
use event::WindowEvent::MouseInput;
|
||||
use event::MouseButton::Middle;
|
||||
use event::ElementState::Released;
|
||||
use crate::event::WindowEvent::MouseInput;
|
||||
use crate::event::MouseButton::Middle;
|
||||
use crate::event::ElementState::Released;
|
||||
|
||||
release_mouse(&mut *subclass_input.window_state.lock());
|
||||
|
||||
|
|
@ -1162,9 +1162,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_XBUTTONDOWN => {
|
||||
use event::WindowEvent::MouseInput;
|
||||
use event::MouseButton::Other;
|
||||
use event::ElementState::Pressed;
|
||||
use crate::event::WindowEvent::MouseInput;
|
||||
use crate::event::MouseButton::Other;
|
||||
use crate::event::ElementState::Pressed;
|
||||
let xbutton = winuser::GET_XBUTTON_WPARAM(wparam);
|
||||
|
||||
capture_mouse(window, &mut *subclass_input.window_state.lock());
|
||||
|
|
@ -1177,9 +1177,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_XBUTTONUP => {
|
||||
use event::WindowEvent::MouseInput;
|
||||
use event::MouseButton::Other;
|
||||
use event::ElementState::Released;
|
||||
use crate::event::WindowEvent::MouseInput;
|
||||
use crate::event::MouseButton::Other;
|
||||
use crate::event::ElementState::Released;
|
||||
let xbutton = winuser::GET_XBUTTON_WPARAM(wparam);
|
||||
|
||||
release_mouse(&mut *subclass_input.window_state.lock());
|
||||
|
|
@ -1207,9 +1207,9 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_INPUT => {
|
||||
use event::DeviceEvent::{Motion, MouseMotion, MouseWheel, Button, Key};
|
||||
use event::MouseScrollDelta::LineDelta;
|
||||
use event::ElementState::{Pressed, Released};
|
||||
use crate::event::DeviceEvent::{Motion, MouseMotion, MouseWheel, Button, Key};
|
||||
use crate::event::MouseScrollDelta::LineDelta;
|
||||
use crate::event::ElementState::{Pressed, Released};
|
||||
|
||||
if let Some(data) = get_raw_input_data(lparam as _) {
|
||||
let device_id = wrap_device_id(data.header.hDevice as _);
|
||||
|
|
@ -1351,7 +1351,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
}
|
||||
|
||||
winuser::WM_SETFOCUS => {
|
||||
use event::WindowEvent::Focused;
|
||||
use crate::event::WindowEvent::Focused;
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window)),
|
||||
event: Focused(true),
|
||||
|
|
@ -1361,7 +1361,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
},
|
||||
|
||||
winuser::WM_KILLFOCUS => {
|
||||
use event::WindowEvent::Focused;
|
||||
use crate::event::WindowEvent::Focused;
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window)),
|
||||
event: Focused(false),
|
||||
|
|
@ -1423,7 +1423,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
// 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.
|
||||
winuser::WM_DPICHANGED => {
|
||||
use event::WindowEvent::HiDpiFactorChanged;
|
||||
use crate::event::WindowEvent::HiDpiFactorChanged;
|
||||
|
||||
// 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
|
||||
|
|
@ -1473,7 +1473,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
window_state.set_window_flags_in_place(|f| f.set(WindowFlags::MARKER_RETAIN_STATE_ON_SIZE, wparam != 0));
|
||||
0
|
||||
} else if msg == *INITIAL_DPI_MSG_ID {
|
||||
use event::WindowEvent::HiDpiFactorChanged;
|
||||
use crate::event::WindowEvent::HiDpiFactorChanged;
|
||||
let scale_factor = dpi_to_scale_factor(wparam as u32);
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window)),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use winapi::shared::minwindef::{BYTE, LPARAM, WPARAM};
|
|||
use winapi::shared::windef::{HICON, HWND};
|
||||
use winapi::um::winuser;
|
||||
|
||||
use icon::{Pixel, PIXEL_SIZE, Icon};
|
||||
use crate::icon::{Pixel, PIXEL_SIZE, Icon};
|
||||
|
||||
impl Pixel {
|
||||
fn to_bgra(&mut self) {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ pub use self::event_loop::{EventLoop, EventLoopWindowTarget, EventLoopProxy};
|
|||
pub use self::monitor::MonitorHandle;
|
||||
pub use self::window::Window;
|
||||
|
||||
use window::Icon;
|
||||
use event::DeviceId as RootDeviceId;
|
||||
use crate::window::Icon;
|
||||
use crate::event::DeviceId as RootDeviceId;
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct PlatformSpecificWindowBuilderAttributes {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ use std::collections::{HashSet, VecDeque};
|
|||
use std::{io, mem, ptr};
|
||||
|
||||
use super::{util, EventLoop};
|
||||
use dpi::{PhysicalPosition, PhysicalSize};
|
||||
use monitor::VideoMode;
|
||||
use platform_impl::platform::dpi::{dpi_to_scale_factor, get_monitor_dpi};
|
||||
use platform_impl::platform::window::Window;
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize};
|
||||
use crate::monitor::VideoMode;
|
||||
use crate::platform_impl::platform::dpi::{dpi_to_scale_factor, get_monitor_dpi};
|
||||
use crate::platform_impl::platform::window::Window;
|
||||
|
||||
/// Win32 implementation of the main `MonitorHandle` object.
|
||||
#[derive(Derivative)]
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ use winapi::um::winuser::{
|
|||
RID_INPUT,
|
||||
};
|
||||
|
||||
use platform_impl::platform::util;
|
||||
use event::ElementState;
|
||||
use crate::platform_impl::platform::util;
|
||||
use crate::event::ElementState;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_raw_input_device_list() -> Option<Vec<RAWINPUTDEVICELIST>> {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{mem, ptr, slice, io};
|
|||
use std::ops::BitAnd;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use window::CursorIcon;
|
||||
use crate::window::CursorIcon;
|
||||
use winapi::ctypes::wchar_t;
|
||||
use winapi::shared::minwindef::{BOOL, DWORD};
|
||||
use winapi::shared::windef::{HWND, POINT, RECT};
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ use winapi::um::wingdi::{CreateRectRgn, DeleteObject};
|
|||
use winapi::um::oleidl::LPDROPTARGET;
|
||||
use winapi::um::winnt::{LONG, LPCWSTR};
|
||||
|
||||
use window::{Icon, CursorIcon, WindowAttributes};
|
||||
use error::{ExternalError, NotSupportedError, OsError as RootOsError};
|
||||
use dpi::{LogicalPosition, LogicalSize, PhysicalSize};
|
||||
use monitor::MonitorHandle as RootMonitorHandle;
|
||||
use platform_impl::platform::{
|
||||
use crate::window::{Icon, CursorIcon, WindowAttributes};
|
||||
use crate::error::{ExternalError, NotSupportedError, OsError as RootOsError};
|
||||
use crate::dpi::{LogicalPosition, LogicalSize, PhysicalSize};
|
||||
use crate::monitor::MonitorHandle as RootMonitorHandle;
|
||||
use crate::platform_impl::platform::{
|
||||
{PlatformSpecificWindowBuilderAttributes, WindowId},
|
||||
dpi::{dpi_to_scale_factor, hwnd_dpi},
|
||||
drop_handler::FileDropHandler,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use monitor::MonitorHandle;
|
||||
use window::{CursorIcon, WindowAttributes};
|
||||
use crate::monitor::MonitorHandle;
|
||||
use crate::window::{CursorIcon, WindowAttributes};
|
||||
use std::{io, ptr};
|
||||
use parking_lot::MutexGuard;
|
||||
use dpi::LogicalSize;
|
||||
use platform_impl::platform::{util, event_loop};
|
||||
use platform_impl::platform::icon::WinIcon;
|
||||
use crate::dpi::LogicalSize;
|
||||
use crate::platform_impl::platform::{util, event_loop};
|
||||
use crate::platform_impl::platform::icon::WinIcon;
|
||||
use winapi::shared::windef::{RECT, HWND};
|
||||
use winapi::shared::minwindef::DWORD;
|
||||
use winapi::um::winuser;
|
||||
|
|
@ -113,7 +113,7 @@ impl WindowState {
|
|||
self.window_flags
|
||||
}
|
||||
|
||||
pub fn set_window_flags<F>(mut this: MutexGuard<Self>, window: HWND, set_client_rect: Option<RECT>, f: F)
|
||||
pub fn set_window_flags<F>(mut this: MutexGuard<'_, Self>, window: HWND, set_client_rect: Option<RECT>, f: F)
|
||||
where F: FnOnce(&mut WindowFlags)
|
||||
{
|
||||
let old_flags = this.window_flags;
|
||||
|
|
@ -127,7 +127,7 @@ impl WindowState {
|
|||
old_flags.apply_diff(window, new_flags, set_client_rect);
|
||||
}
|
||||
|
||||
pub fn refresh_window_state(this: MutexGuard<Self>, window: HWND, set_client_rect: Option<RECT>) {
|
||||
pub fn refresh_window_state(this: MutexGuard<'_, Self>, window: HWND, set_client_rect: Option<RECT>) {
|
||||
Self::set_window_flags(this, window, set_client_rect, |_| ());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue