diff --git a/rio-window/src/event_loop.rs b/rio-window/src/event_loop.rs index 54f0d153c0..74dac03351 100644 --- a/rio-window/src/event_loop.rs +++ b/rio-window/src/event_loop.rs @@ -418,8 +418,9 @@ impl ActiveEventLoop { &self, custom_cursor: CustomCursorSource, ) -> CustomCursor { - let _span = tracing::debug_span!("rio_window::ActiveEventLoop::create_custom_cursor",) - .entered(); + let _span = + tracing::debug_span!("rio_window::ActiveEventLoop::create_custom_cursor",) + .entered(); self.p.create_custom_cursor(custom_cursor) } @@ -428,7 +429,8 @@ impl ActiveEventLoop { #[inline] pub fn available_monitors(&self) -> impl Iterator { let _span = - tracing::debug_span!("rio_window::ActiveEventLoop::available_monitors",).entered(); + tracing::debug_span!("rio_window::ActiveEventLoop::available_monitors",) + .entered(); #[allow(clippy::useless_conversion)] // false positive on some platforms self.p @@ -446,8 +448,8 @@ impl ActiveEventLoop { /// **Wayland / Web:** Always returns `None`. #[inline] pub fn primary_monitor(&self) -> Option { - let _span = - tracing::debug_span!("rio_window::ActiveEventLoop::primary_monitor",).entered(); + let _span = tracing::debug_span!("rio_window::ActiveEventLoop::primary_monitor",) + .entered(); self.p .primary_monitor() @@ -584,7 +586,8 @@ impl EventLoopProxy { /// /// [`UserEvent(event)`]: Event::UserEvent pub fn send_event(&self, event: T) -> Result<(), EventLoopClosed> { - let _span = tracing::debug_span!("rio_window::EventLoopProxy::send_event",).entered(); + let _span = + tracing::debug_span!("rio_window::EventLoopProxy::send_event",).entered(); self.event_loop_proxy.send_event(event) } diff --git a/rio-window/src/platform_impl/windows/event_loop.rs b/rio-window/src/platform_impl/windows/event_loop.rs index ecc8ef8e1a..91766b2fba 100644 --- a/rio-window/src/platform_impl/windows/event_loop.rs +++ b/rio-window/src/platform_impl/windows/event_loop.rs @@ -2526,10 +2526,6 @@ unsafe extern "system" fn thread_event_target_callback( } let userdata = unsafe { Box::from_raw(userdata_ptr) }; - if msg != WM_PAINT { - unsafe { RedrawWindow(window, ptr::null(), 0, RDW_INTERNALPAINT) }; - } - let mut userdata_removed = false; // I decided to bind the closure to `callback` and pass it to catch_unwind rather than passing @@ -2537,6 +2533,7 @@ unsafe extern "system" fn thread_event_target_callback( // the git blame and history would be preserved. let callback = || match msg { WM_NCDESTROY => { + unsafe { RedrawWindow(window, ptr::null(), 0, RDW_INTERNALPAINT) }; unsafe { super::set_window_long(window, GWL_USERDATA, 0) }; userdata_removed = true; 0 @@ -2549,11 +2546,13 @@ unsafe extern "system" fn thread_event_target_callback( }, WM_INPUT_DEVICE_CHANGE => { + unsafe { RedrawWindow(window, ptr::null(), 0, RDW_INTERNALPAINT) }; let event = match wparam as u32 { GIDC_ARRIVAL => DeviceEvent::Added, GIDC_REMOVAL => DeviceEvent::Removed, _ => unreachable!(), }; + unsafe { RedrawWindow(window, ptr::null(), 0, RDW_INTERNALPAINT) }; userdata.send_event(Event::DeviceEvent { device_id: wrap_device_id(lparam as u32), @@ -2572,6 +2571,7 @@ unsafe extern "system" fn thread_event_target_callback( } _ if msg == USER_EVENT_MSG_ID.get() => { + unsafe { RedrawWindow(window, ptr::null(), 0, RDW_INTERNALPAINT) }; // synthesis a placeholder UserEvent, so that if the callback is // re-entered it can be buffered for later delivery. the real // user event is still in the mpsc channel and will be pulled @@ -2581,6 +2581,7 @@ unsafe extern "system" fn thread_event_target_callback( 0 } _ if msg == EXEC_MSG_ID.get() => { + unsafe { RedrawWindow(window, ptr::null(), 0, RDW_INTERNALPAINT) }; let mut function: ThreadExecFn = unsafe { Box::from_raw(wparam as *mut _) }; function(); 0