Skip to content

Commit

Permalink
Rename ELRShared to EventLoopRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
Osspial committed Mar 10, 2020
1 parent 2a53d9c commit 3f8872a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use crate::{
},
window::{Fullscreen, WindowId as RootWindowId},
};
use runner::{ELRShared, EventLoopRunnerShared};
use runner::{EventLoopRunner, EventLoopRunnerShared};

type GetPointerFrameInfoHistory = unsafe extern "system" fn(
pointerId: UINT,
Expand Down Expand Up @@ -155,7 +155,7 @@ impl<T: 'static> EventLoop<T> {
thread::spawn(move || wait_thread(thread_id, send_thread_msg_target as HWND));
let wait_thread_id = get_wait_thread_id();

let runner_shared = Rc::new(ELRShared::new(thread_msg_target, wait_thread_id));
let runner_shared = Rc::new(EventLoopRunner::new(thread_msg_target, wait_thread_id));

let thread_msg_sender =
subclass_event_target_window(thread_msg_target, runner_shared.clone());
Expand Down Expand Up @@ -640,7 +640,7 @@ fn normalize_pointer_pressure(pressure: u32) -> Option<Force> {
/// Returns `true` if this invocation flushed all the redraw events. If this function is re-entrant,
/// it won't flush the redraw events and will return `false`.
#[must_use]
unsafe fn flush_paint_messages<T: 'static>(except: Option<HWND>, runner: &ELRShared<T>) -> bool {
unsafe fn flush_paint_messages<T: 'static>(except: Option<HWND>, runner: &EventLoopRunner<T>) -> bool {
if !runner.redrawing() {
runner.main_events_cleared();
let mut msg = mem::zeroed();
Expand Down Expand Up @@ -668,7 +668,7 @@ unsafe fn flush_paint_messages<T: 'static>(except: Option<HWND>, runner: &ELRSha
}
}

unsafe fn process_control_flow<T: 'static>(runner: &ELRShared<T>) {
unsafe fn process_control_flow<T: 'static>(runner: &EventLoopRunner<T>) {
match runner.control_flow() {
ControlFlow::Poll => {
winuser::PostMessageW(runner.thread_msg_target(), *PROCESS_NEW_EVENTS_MSG_ID, 0, 0);
Expand Down
18 changes: 9 additions & 9 deletions src/platform_impl/windows/event_loop/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use crate::{
window::WindowId,
};

pub(crate) type EventLoopRunnerShared<T> = Rc<ELRShared<T>>;
pub(crate) struct ELRShared<T: 'static> {
pub(crate) type EventLoopRunnerShared<T> = Rc<EventLoopRunner<T>>;
pub(crate) struct EventLoopRunner<T: 'static> {
// The event loop's win32 handles
thread_msg_target: HWND,
wait_thread_id: DWORD,
Expand Down Expand Up @@ -60,9 +60,9 @@ enum BufferedEvent<T: 'static> {
ScaleFactorChanged(WindowId, f64, PhysicalSize<u32>),
}

impl<T> ELRShared<T> {
pub(crate) fn new(thread_msg_target: HWND, wait_thread_id: DWORD) -> ELRShared<T> {
ELRShared {
impl<T> EventLoopRunner<T> {
pub(crate) fn new(thread_msg_target: HWND, wait_thread_id: DWORD) -> EventLoopRunner<T> {
EventLoopRunner {
thread_msg_target,
wait_thread_id,
runner_state: Cell::new(RunnerState::Uninitialized),
Expand All @@ -87,7 +87,7 @@ impl<T> ELRShared<T> {
}

pub(crate) fn reset_runner(&self) {
let ELRShared {
let EventLoopRunner {
thread_msg_target: _,
wait_thread_id: _,
runner_state,
Expand All @@ -106,7 +106,7 @@ impl<T> ELRShared<T> {
}

/// State retrieval functions.
impl<T> ELRShared<T> {
impl<T> EventLoopRunner<T> {
pub fn thread_msg_target(&self) -> HWND {
self.thread_msg_target
}
Expand Down Expand Up @@ -143,7 +143,7 @@ impl<T> ELRShared<T> {
}

/// Misc. functions
impl<T> ELRShared<T> {
impl<T> EventLoopRunner<T> {
pub fn catch_unwind<R>(&self, f: impl FnOnce() -> R) -> Option<R> {
let panic_error = self.panic_error.take();
if panic_error.is_none() {
Expand Down Expand Up @@ -194,7 +194,7 @@ impl<T> ELRShared<T> {
}

/// Event dispatch functions.
impl<T> ELRShared<T> {
impl<T> EventLoopRunner<T> {
pub(crate) unsafe fn poll(&self) {
self.move_state_to(RunnerState::HandlingMainEvents);
}
Expand Down

0 comments on commit 3f8872a

Please sign in to comment.