Conversation
Add platform-specific dependencies for Windows and Unix-like OS.
Added refresh_windows_non_client_activation function to update window title bar state on theme change in Windows.
|
Preview available at https://egui-pr-preview.github.io/pr/8402-p114 View snapshot changes at kitdiff |
Add handling for SetTheme command in web backend.
|
Hi! I gave this a try on my windows 10 laptop and there window decoration is the same while the window is focused and light/dark only looks different when the window is in the background. So I wonder if this is needed at all? Or is it different in win 11 and focused light/dark looks different? |
|
On Windows 10, the window decoration fails to redraw immediately upon a theme change; it requires losing and regaining window focus to trigger a redraw (which is why it might have appeared to only change when in the background). Fixing this ensures consistent, immediate title bar updates, which improves the overall polish and user experience in egui. Regarding child viewports, they don't update immediately yet, but I plan to address that in a follow-up PR once this one is merged. |
|
But I don't see any change at all between light and dark theme when the window is focused. Not without or with your fix. |
|
Screen recording tools do not capture the native OS title bar, so I'm explaining the issue with screenshots instead. Before this PR (Current behavior / Bug):The title bar does not update immediately when changing the theme:
With this PR (Fixed):
|
lucasmerlin
left a comment
There was a problem hiding this comment.
Sounds good to me then. I guess ideally this should be fixed in winit, but I have no idea when that will happen, so lets fix it here.
|
I have a bug related to #8299 so I'll mention it here:, in egui 0.36.1 and windows 11 I have two screens: After I turn off my screen 2 and every app moves to Screen 1, so now in Screen 1:
|










Fix: Refresh Windows title bar after theme changes
Description
On Windows, changing the window theme updates egui immediately, but the native title bar may keep its previous colors until the window activation state changes.
This sends WM_NCACTIVATE after applying ViewportCommand::SetTheme, forcing Windows to refresh the non-client title bar state without changing the real focus.