-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to remove the flickering of WinUI3 Window on resizing #5148
Comments
We're currently working on fixing this. The plan is that instead of having that background color always be white it will instead be white or black depending on the value of Window.Content.RequestedTheme. |
The How can i get access to the WndProc, will sub classing work ? |
@codendone So instead of properly synchronizing the rendering with window sizing events you simply want to hide the issue by coloring? How will it help to eliminate the obvious title bar buttons flicker? |
Agree with @Torquerrr - and what if there's a custom image / gradient background set? This doesn't sound like an actual solution to the problem.. |
When i checked the window with Spy++ i found that the child window hosted inside the parent is uses class Here the Child window uses WS_EX_NOREDIRECTIONBITMAP Which means the Child window draws a background using Direct Composition and the Window actually doesn't have a background. |
Thats a hack but it's not a solution, why is it rendered when not ready? The window resize is already delayed from the mouse dragging, so why not just syncing it. Windows is the only OS where this still happens. A simple color theme will not help if a sidebar is jumping around like a cat in heat. |
I have used Windows.UI.Composition wpf samples, those windows were also having the flickering but i was able to fix it by setting the window style to none and allow transparency to true. i think it won't work here. |
@selastingeorge Seems to be the same issue as #2506. |
Actually i fixed the flickering issue in WPF by overriding the WndProc. Responding to WM_NCCALCSIZE with any RECT smaller than the window solves the problem. But i don't know it will work on child windows |
Lots of good discussion on this thread. I agree with comments that setting a better background color is an incomplete solution, but as @Torquerrr said, handling resize well in Windows is difficult. Windows has code to attempt to synchronize window frame redraw with when the app content has finished drawing, but that synchronization code requires Windows to know when the app is finished drawing. WinUI3 draws all app content into a swapchain, which Windows intentionally never synchronizes to favor performance of the swapchain. Window resize is a case where synchronization might be desirable. I think this needs to be investigated, but supporting synchronized resize would be significant work and likely requires an OS update. Because of all that, a better background color will at least reduce the visible flicker for dark theme apps without waiting for a full synchronized resize solution. |
I Know this is not the question i should ask in this thread, but it's just a small doubt ,I was also trying to implement transparent background and acrylic effect also in win ui3, i was able to implement both in Win32 using the DWMThumbnail API, but the DWM Thumbnail Api Outputs the Content Behind Window on to IDCompositionVisual2 , is there any way to convert it to Microsoft.UI.Composition.Visual Here is the demo screen shot: Here the Position i marked using Red Rectangle is not caused by WS_EX_NOREDIRECTIONBITMAP, its dwm thumbnail based, If I could get these visual to Microsoft.UI.Composition.Visual, I might be able to bring back Transparency+ Acrylic to win UI 3, I believe So. |
@codendone As far as I know default Windows 10 apps (News, Maps, Photos) use |
@Torquerrr WinUI 3 uses Microsoft.UI.Composition, which is part of Project Reunion, rather than Windows.UI.Composition. Using Microsoft.UI.Composition means we can update it when desired, just like we can with the XAML code of WinUI 3, and that those updates are available on all OS versions supported by Project Reunion, rather than only being on the latest OS version. |
@codendone So, do we need to add "feature-request" label or close it and all relevant stories? |
We should keep this active, and I think just an issue is fine here. This is being tracked internally as a feature due to its cost and complexity. |
Definitely with everyone else in this thread, syncing the clear color with the Windows theme is not a solution. The proposed hack would look just as bad as it does now if the page: a. Uses a background color that doesn't perfectly match the windows theme |
I agree with the others that this seems a poor workaround at best. Still, a workaround that makes these artifacts less noticeable is better than no fix at all, at least until a proper fix is available. It would be good, however, to be able to set a custom color for this instead of having white/black hardcoded. My app, for example, uses an orange background, so neither white nor black looks good. |
Is there an update on this? This is turning me away from wanting to use WinUI 3. |
@codendone May I ask the current status of this internal ticket? Is it ever been worked on since it's created? |
@castorix That looks a lot better, but can you verify whether the content still flickers or not if you remove the whole window frame (by not modifying the non-client area and returning 0 directly in |
If I remove the frame by subclassing it, the result is the same (I can only resize once as there is no more sizing border...) |
So I ended up retesting, and there is a chance of a flicker still, but it is rare and I have to move my mouse really fast when resizing the window: flicker.mp4The jittery movement of the content when resizing from the left side, in addition to the content popping in and out occasionally is definitely more jarring. jitter.mp4 |
I can't believe that this issue still exists. I consider it a major regression from UWP apps which handle resizing without a problem. |
Workarounds not doing well when using the 1.1 MicaBackdrop/SystemBackdrop feature. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
The issue isn't stale. |
Windows is stale at the moment, at least it taste like this. |
The "partial" fix has been completed and a more comprehensive fix has been added to the backlog so changing this to a feature proposal. |
@JJBrychell any update on when this might be fixed in WinUI3? |
WPF will also encounter the same problem in custom windows,However, setting NonClientFrameEdges="Bottom" in Windows Chrome eliminates flickering issues: |
@farran 100%. Windows is the cripple handicapped kid from the block. It's terrible. MS, but in particular Windows, is a complete joke compared to any other OS nowadays. How did Satya Nadella ever think this (and related stuff, like W11 in general) was ready to ship considering the horrible UX/UI experience? No wonder Panos Panay left the building. Remember the time where Vista was able to render Aero blur effect real time without any lag or crazy stuff whatsoever. This was almost 20(!!) years ago. Now, on high end hardware, you can literally see the Acrylic effect being drawn over the window background when resizing, has Explorer.exe trouble to load up the UI instantly, renewed Task Manager which feels like a slow responsive pile of garbage, etc. etc... It's a total utter mess. Not surprising as senior and experienced devs move up the ladder (and bail) and most of the dev is supposedly done by junior (medior at most) devs in India. And I hear India is known for high quality software development. But yeah, MS is only a startup right. Yes I'm frustrated, because all MS does is near to nothing to improve the overall performance. From time to time they seem to check out the feedback hub to see which unneeded bloated feature they should add in the next "major update". Awesome idea to let the gamer kids tell MS what should be important. Just my 2ct. |
This issue doesn't happen for built-in apps on Windows 11 like File Explorer or Notepad, even though they seem like they're in WinUI by the style. Also, they open much quicker than a WinUI app. Maybe they're actually written in something completely different? That would support #9417 EDIT: Oh, actually they do, I can see that when resizing via the top or left sides rather than the bottom or right sides, where I don't notice it.
Wow, this looks out of this world to me, since I'm used to Windows. This certainly doesn't happen for any app on Windows. I think I'll switch OS 😄 |
File Explorer do have flickers, since it's HWND + Xaml island |
This issue has been open since 2021 and is still one of the most noticeable visual bugs in WinUI3. |
@codendone has this issue been fixed at the OS level yet? what's the latest update on this? |
@mominshaikhdevs There has been a little progress, but no ETA currently. See http://aka.ms/winappsdk/plans for the overall roadmap. |
The same issue is also in .NET MAUI (based on WinUI3). Old Xamarin.Forms (UWP) did not have this issue and resizing is smoother there. |
I am new to WinUI3, I have created a sample app and when I resize it, there is a flickering in window, In WPF it was able to fix this flickering issue. but on winUI3 it is not working, is there any way to fix it.
I know that The Content Rendered in the window is created by Direct Composition and all the contents are hosted as a child window in a parent window, and i usually adjust WndProc to adjust the flickering some how I was not even able to override the wndPoc like i did for wpf, is there any way to fix this flickering.
Here is the screenshot of the issue:
The text was updated successfully, but these errors were encountered: