mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Run rustfmt
This commit is contained in:
parent
8eb7853a1a
commit
eb38ff453a
|
@ -1,25 +1,11 @@
|
||||||
use std::{
|
use std::{any::Any, cell::RefCell, collections::VecDeque, mem, panic, ptr, rc::Rc, time::Instant};
|
||||||
any::Any,
|
|
||||||
cell::RefCell,
|
|
||||||
collections::VecDeque,
|
|
||||||
mem, panic, ptr,
|
|
||||||
rc::Rc,
|
|
||||||
time::Instant,
|
|
||||||
};
|
|
||||||
|
|
||||||
use winapi::{
|
use winapi::{shared::windef::HWND, um::winuser};
|
||||||
shared::{
|
|
||||||
windef::HWND,
|
|
||||||
},
|
|
||||||
um::winuser,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
event::{Event, StartCause},
|
event::{Event, StartCause},
|
||||||
event_loop::ControlFlow,
|
event_loop::ControlFlow,
|
||||||
platform_impl::platform::{
|
platform_impl::platform::event_loop::EventLoop,
|
||||||
event_loop::EventLoop,
|
|
||||||
},
|
|
||||||
window::WindowId,
|
window::WindowId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,7 +145,9 @@ impl<T> ELRShared<T> {
|
||||||
|
|
||||||
fn buffer_event(&self, event: Event<T>) {
|
fn buffer_event(&self, event: Event<T>) {
|
||||||
match event {
|
match event {
|
||||||
Event::RedrawRequested(window_id) => self.redraw_buffer.borrow_mut().push_back(window_id),
|
Event::RedrawRequested(window_id) => {
|
||||||
|
self.redraw_buffer.borrow_mut().push_back(window_id)
|
||||||
|
}
|
||||||
_ => self.buffer.borrow_mut().push_back(event),
|
_ => self.buffer.borrow_mut().push_back(event),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +170,11 @@ enum RunnerState {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> EventLoopRunner<T> {
|
impl<T> EventLoopRunner<T> {
|
||||||
unsafe fn new<F>(event_loop: &EventLoop<T>, redraw_buffer: Rc<RefCell<VecDeque<WindowId>>>, f: F) -> EventLoopRunner<T>
|
unsafe fn new<F>(
|
||||||
|
event_loop: &EventLoop<T>,
|
||||||
|
redraw_buffer: Rc<RefCell<VecDeque<WindowId>>>,
|
||||||
|
f: F,
|
||||||
|
) -> EventLoopRunner<T>
|
||||||
where
|
where
|
||||||
F: FnMut(Event<T>, &mut ControlFlow),
|
F: FnMut(Event<T>, &mut ControlFlow),
|
||||||
{
|
{
|
||||||
|
@ -211,7 +203,9 @@ impl<T> EventLoopRunner<T> {
|
||||||
self.runner_state = match self.runner_state {
|
self.runner_state = match self.runner_state {
|
||||||
// If we're already handling events or have deferred `NewEvents`, we don't need to do
|
// If we're already handling events or have deferred `NewEvents`, we don't need to do
|
||||||
// do any processing.
|
// do any processing.
|
||||||
RunnerState::HandlingEvents | RunnerState::HandlingRedraw | RunnerState::DeferredNewEvents(..) => self.runner_state,
|
RunnerState::HandlingEvents
|
||||||
|
| RunnerState::HandlingRedraw
|
||||||
|
| RunnerState::DeferredNewEvents(..) => self.runner_state,
|
||||||
|
|
||||||
// Send the `Init` `NewEvents` and immediately move into event processing.
|
// Send the `Init` `NewEvents` and immediately move into event processing.
|
||||||
RunnerState::New => {
|
RunnerState::New => {
|
||||||
|
@ -311,12 +305,14 @@ impl<T> EventLoopRunner<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
match (self.runner_state, &event) {
|
match (self.runner_state, &event) {
|
||||||
(RunnerState::HandlingRedraw, Event::RedrawRequested(_)) => self.call_event_handler(event),
|
(RunnerState::HandlingRedraw, Event::RedrawRequested(_)) => {
|
||||||
|
self.call_event_handler(event)
|
||||||
|
}
|
||||||
(_, Event::RedrawRequested(_)) => {
|
(_, Event::RedrawRequested(_)) => {
|
||||||
self.call_event_handler(Event::MainEventsCleared);
|
self.call_event_handler(Event::MainEventsCleared);
|
||||||
self.runner_state = RunnerState::HandlingRedraw;
|
self.runner_state = RunnerState::HandlingRedraw;
|
||||||
self.call_event_handler(event);
|
self.call_event_handler(event);
|
||||||
},
|
}
|
||||||
(RunnerState::HandlingRedraw, _) => {
|
(RunnerState::HandlingRedraw, _) => {
|
||||||
warn!("Non-redraw event dispatched durning redraw phase");
|
warn!("Non-redraw event dispatched durning redraw phase");
|
||||||
self.events_cleared();
|
self.events_cleared();
|
||||||
|
|
|
@ -36,9 +36,7 @@ use crate::{
|
||||||
platform_impl::platform::{
|
platform_impl::platform::{
|
||||||
dpi::{dpi_to_scale_factor, hwnd_dpi},
|
dpi::{dpi_to_scale_factor, hwnd_dpi},
|
||||||
drop_handler::FileDropHandler,
|
drop_handler::FileDropHandler,
|
||||||
event_loop::{
|
event_loop::{self, EventLoopWindowTarget, DESTROY_MSG_ID, INITIAL_DPI_MSG_ID},
|
||||||
self, EventLoopWindowTarget, DESTROY_MSG_ID, INITIAL_DPI_MSG_ID,
|
|
||||||
},
|
|
||||||
icon::{self, IconType, WinIcon},
|
icon::{self, IconType, WinIcon},
|
||||||
monitor,
|
monitor,
|
||||||
raw_input::register_all_mice_and_keyboards_for_raw_input,
|
raw_input::register_all_mice_and_keyboards_for_raw_input,
|
||||||
|
|
Loading…
Reference in a new issue