Implement revamped RedrawRequested on Windows (#1050)

* Move event loop runner to runner module

* Implement new redraw API
This commit is contained in:
Osspial 2019-08-26 22:05:42 -04:00
parent 0c151f9fb3
commit 8eb7853a1a
4 changed files with 466 additions and 428 deletions

View file

@ -38,7 +38,6 @@ use crate::{
drop_handler::FileDropHandler,
event_loop::{
self, EventLoopWindowTarget, DESTROY_MSG_ID, INITIAL_DPI_MSG_ID,
REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID,
},
icon::{self, IconType, WinIcon},
monitor,
@ -142,20 +141,12 @@ impl Window {
#[inline]
pub fn request_redraw(&self) {
unsafe {
if self.thread_executor.trigger_newevents_on_redraw() {
winuser::RedrawWindow(
self.window.0,
ptr::null(),
ptr::null_mut(),
winuser::RDW_INTERNALPAINT,
);
} else {
let mut window_state = self.window_state.lock();
if !window_state.queued_out_of_band_redraw {
window_state.queued_out_of_band_redraw = true;
winuser::PostMessageW(self.window.0, *REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID, 0, 0);
}
}
winuser::RedrawWindow(
self.window.0,
ptr::null(),
ptr::null_mut(),
winuser::RDW_INTERNALPAINT,
);
}
}