Skip to content

Commit d6d5c67

Browse files
committed
On Windows, replace all calls to UpdateWindow by calls to InvalidateRgn
This avoids directly sending a WM_PAINT message, which might cause buffering of RedrawRequested events. We don't want to buffer RedrawRequested events because: - we wan't to handle RedrawRequested during processing of WM_PAINT messages - state transitionning is broken when handling buffered RedrawRequested events Fixes rust-windowing#1469
1 parent 3674583 commit d6d5c67

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/platform_impl/windows/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub(crate) fn set_inner_size_physical(window: HWND, x: u32, y: u32) {
116116
| winuser::SWP_NOMOVE
117117
| winuser::SWP_NOACTIVATE,
118118
);
119-
winuser::UpdateWindow(window);
119+
winuser::InvalidateRgn(window, ptr::null_mut(), 0);
120120
}
121121
}
122122

src/platform_impl/windows/window.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl Window {
187187
| winuser::SWP_NOSIZE
188188
| winuser::SWP_NOACTIVATE,
189189
);
190-
winuser::UpdateWindow(self.window.0);
190+
winuser::InvalidateRgn(self.window.0, ptr::null_mut(), 0);
191191
}
192192
}
193193

@@ -506,7 +506,7 @@ impl Window {
506506
size.1 as i32,
507507
winuser::SWP_ASYNCWINDOWPOS | winuser::SWP_NOZORDER,
508508
);
509-
winuser::UpdateWindow(window.0);
509+
winuser::InvalidateRgn(window.0, ptr::null_mut(), 0);
510510
}
511511
}
512512
None => {
@@ -532,7 +532,7 @@ impl Window {
532532
| winuser::SWP_NOZORDER
533533
| winuser::SWP_NOACTIVATE,
534534
);
535-
winuser::UpdateWindow(window.0);
535+
winuser::InvalidateRgn(window.0, ptr::null_mut(), 0);
536536
}
537537
}
538538
}

src/platform_impl/windows/window_state.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ impl WindowFlags {
266266
| winuser::SWP_NOSIZE
267267
| winuser::SWP_NOACTIVATE,
268268
);
269-
winuser::UpdateWindow(window);
269+
winuser::InvalidateRgn(window, ptr::null_mut(), 0);
270270
}
271271
}
272272

0 commit comments

Comments
 (0)