Run rustfmt

This commit is contained in:
Osspial 2019-10-24 14:33:50 -04:00
parent 8eb7853a1a
commit eb38ff453a
2 changed files with 19 additions and 25 deletions

View file

@ -1,25 +1,11 @@
use std::{
any::Any,
cell::RefCell,
collections::VecDeque,
mem, panic, ptr,
rc::Rc,
time::Instant,
};
use std::{any::Any, cell::RefCell, collections::VecDeque, mem, panic, ptr, rc::Rc, time::Instant};
use winapi::{
shared::{
windef::HWND,
},
um::winuser,
};
use winapi::{shared::windef::HWND, um::winuser};
use crate::{
event::{Event, StartCause},
event_loop::ControlFlow,
platform_impl::platform::{
event_loop::EventLoop,
},
platform_impl::platform::event_loop::EventLoop,
window::WindowId,
};
@ -159,7 +145,9 @@ impl<T> ELRShared<T> {
fn buffer_event(&self, event: Event<T>) {
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),
}
}
@ -182,7 +170,11 @@ enum RunnerState {
}
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
F: FnMut(Event<T>, &mut ControlFlow),
{
@ -211,7 +203,9 @@ impl<T> EventLoopRunner<T> {
self.runner_state = match self.runner_state {
// If we're already handling events or have deferred `NewEvents`, we don't need to do
// 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.
RunnerState::New => {
@ -311,12 +305,14 @@ impl<T> EventLoopRunner<T> {
}
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(_)) => {
self.call_event_handler(Event::MainEventsCleared);
self.runner_state = RunnerState::HandlingRedraw;
self.call_event_handler(event);
},
}
(RunnerState::HandlingRedraw, _) => {
warn!("Non-redraw event dispatched durning redraw phase");
self.events_cleared();

View file

@ -36,9 +36,7 @@ use crate::{
platform_impl::platform::{
dpi::{dpi_to_scale_factor, hwnd_dpi},
drop_handler::FileDropHandler,
event_loop::{
self, EventLoopWindowTarget, DESTROY_MSG_ID, INITIAL_DPI_MSG_ID,
},
event_loop::{self, EventLoopWindowTarget, DESTROY_MSG_ID, INITIAL_DPI_MSG_ID},
icon::{self, IconType, WinIcon},
monitor,
raw_input::register_all_mice_and_keyboards_for_raw_input,