You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there folks, hope you're doing well. I noticed a little burst of white every time I change display scaling on Windows and I'm painting a dark background.
Here's a sample application below (adapted from the egui glow example):
When running the application, attempt to change the display scaling while viewing the window and you'll see a small burst of white each time you change scaling.
I've traced this back to the PR #2419 and more specifically the choice to set hbrBackground to COLOR_WINDOWFRAME when setting up the window using WNDCLASSEXW.
Reverting this to an empty HBRUSH of 0 as was the case prior to the PR resolves this for me:
diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs
index 63e41dff..ed6cda59 100644
--- a/src/platform_impl/windows/window.rs+++ b/src/platform_impl/windows/window.rs@@ -1026,7 +1026,6 @@ unsafe fn register_window_class<T: 'static>(
.map(|icon| icon.inner.as_raw_handle())
.unwrap_or(0);
- use windows_sys::Win32::UI::WindowsAndMessaging::COLOR_WINDOWFRAME;
let class = WNDCLASSEXW {
cbSize: mem::size_of::<WNDCLASSEXW>() as u32,
style: CS_HREDRAW | CS_VREDRAW,
@@ -1036,7 +1035,7 @@ unsafe fn register_window_class<T: 'static>(
hInstance: util::get_instance_handle(),
hIcon: h_icon,
hCursor: 0, // must be null in order for cursor state to work properly
- hbrBackground: COLOR_WINDOWFRAME as _,+ hbrBackground: 0,
lpszMenuName: ptr::null(),
lpszClassName: class_name.as_ptr(),
hIconSm: h_icon_small,
I'd be more than happy to submit a PR to revert this but just wanted to open it up for discussion as there may have been some rationale in setting this background which should be evaluated.
Just a little further note that hbrBackground should be set to the required color + 1 as per the docs:
A color value must be one of the following standard system colors (the value 1 must be added to the chosen color).
So the effective color being used here is actually COLOR_WINDOW (pub const COLOR_WINDOW: SYS_COLOR_INDEX = 5u32;) since COLOR_WINDOW + 1 is 6 which is equivalent to the costant used pub const COLOR_WINDOWFRAME: SYS_COLOR_INDEX = 6u32;.
Hello, thanks for reporting and investigating!
I could reproduce it with your OpenGL application but not with my own Vulkan GUI app interestingly.
Removing the hbrBackground is fine for me, doesn't really seem to do much - iirc I set it somewhere when testing different approaches and just kept it due to having a default was nice to have,
Hello, thanks for reporting and investigating! I could reproduce it with your OpenGL application but not with my own Vulkan GUI app interestingly. Removing the hbrBackground is fine for me, doesn't really seem to do much - iirc I set it somewhere when testing different approaches and just kept it due to having a default was nice to have,
Thanks so much for the reply and help. I've just submitted PR #2571 to revert this behaviour. 😄
Hey there folks, hope you're doing well. I noticed a little burst of white every time I change display scaling on Windows and I'm painting a dark background.
Here's a sample application below (adapted from the egui glow example):
I've intentionally added a small sleep during the redraws so it's more obvious.
And here's my Cargo.toml with a local copy of winit which is checked out on the v0.27.5 tag:
When running the application, attempt to change the display scaling while viewing the window and you'll see a small burst of white each time you change scaling.
I've traced this back to the PR #2419 and more specifically the choice to set
hbrBackground
toCOLOR_WINDOWFRAME
when setting up the window usingWNDCLASSEXW
.Reverting this to an empty HBRUSH of 0 as was the case prior to the PR resolves this for me:
I'd be more than happy to submit a PR to revert this but just wanted to open it up for discussion as there may have been some rationale in setting this background which should be evaluated.
ccing @msiglreith 😄
Thanks heaps in advance!
Fotis
The text was updated successfully, but these errors were encountered: