mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 15:13:13 -04:00
On Windows, fix RedrawRequested delivery
When calling `Window::request_redraw` from the `RedrawRequested` handler the `RedrawWindow` won't result in `WM_PAINT` being delivered due since user callback is run before `DefWindowProcW` is called. Track whether the user called `Window::request_redraw` and ask for `RedrawWindow` after running the said function during `WM_PAINT` handling. Fixes #3150.
This commit is contained in:
@@ -149,6 +149,8 @@ impl Window {
|
||||
|
||||
#[inline]
|
||||
pub fn request_redraw(&self) {
|
||||
// NOTE: mark that we requested a redraw to handle requests during `WM_PAINT` handling.
|
||||
self.window_state.lock().unwrap().redraw_requested = true;
|
||||
unsafe {
|
||||
RedrawWindow(self.hwnd(), ptr::null(), 0, RDW_INTERNALPAINT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user