Problem
The main UI window (windhawk-ui.exe, the Tauri/WebView2 window) briefly
flashes white when it's restored from the taskbar after having been
minimized. It doesn't happen on first launch (that path already builds
the window hidden, themed, and sized before showing it), only on the
minimize → restore cycle, and independent of which tab/page was open.
Root cause
WebView2 discards its compositor surface while the host window is
minimized (to save memory), and on some machines the first frame it
repaints after being restored is blank/white until something else (a
resize, a click) forces a second paint. This is a known WebView2
behavior, and Microsoft's own guidance is that the host app must
manually toggle ICoreWebView2Controller.IsVisible to false right as
the window minimizes and back to true right as it's restored
(handling SIZE_MINIMIZED/SIZE_RESTORED via WM_SIZE in a plain
Win32 host).
lib.rs's on_window_event handler was tracking Resized only for
window-geometry persistence. On Windows, a minimize is reported as
Resized(0, 0) and the restore as a second Resized with the real
size back (there's no dedicated Minimized/Restored variant in
Tauri's WindowEvent), but nothing reacted to that transition to give
WebView2 the visibility toggle it needs.
Fix
-
shell.rs: add set_webview_visible(), a small helper that reaches
the WebView2 controller (the same way the existing shortcut/context-menu/
theme helpers in this file already do) and calls SetIsVisible.
-
lib.rs: in the existing Resized branch of on_window_event, detect
the (0, 0) minimize signal and the following real-size restore
signal, and call set_webview_visible(false) / set_webview_visible(true)
at exactly those transitions.
No behavior changes on first launch, resizing, or maximizing - only the
minimize/restore transition is affected.
Testing
- Manual: launch Windhawk, minimize from the taskbar, restore - no more
white flash before the UI repaints, across several repeated cycles.
- Sanity-checked normal resize/maximize/move still persist window state
correctly (unaffected by this change, since it only adds to the
existing Resized branch).
References
CHECK THE UPDATED FILES HERE https://gofile.io/d/dWuN8O
Problem
The main UI window (windhawk-ui.exe, the Tauri/WebView2 window) briefly
flashes white when it's restored from the taskbar after having been
minimized. It doesn't happen on first launch (that path already builds
the window hidden, themed, and sized before showing it), only on the
minimize → restore cycle, and independent of which tab/page was open.
Root cause
WebView2 discards its compositor surface while the host window is
minimized (to save memory), and on some machines the first frame it
repaints after being restored is blank/white until something else (a
resize, a click) forces a second paint. This is a known WebView2
behavior, and Microsoft's own guidance is that the host app must
manually toggle
ICoreWebView2Controller.IsVisibletofalseright asthe window minimizes and back to
trueright as it's restored(handling
SIZE_MINIMIZED/SIZE_RESTOREDviaWM_SIZEin a plainWin32 host).
lib.rs'son_window_eventhandler was trackingResizedonly forwindow-geometry persistence. On Windows, a minimize is reported as
Resized(0, 0)and the restore as a secondResizedwith the realsize back (there's no dedicated
Minimized/Restoredvariant inTauri's
WindowEvent), but nothing reacted to that transition to giveWebView2 the visibility toggle it needs.
Fix
shell.rs: addset_webview_visible(), a small helper that reachesthe WebView2 controller (the same way the existing shortcut/context-menu/
theme helpers in this file already do) and calls
SetIsVisible.lib.rs: in the existingResizedbranch ofon_window_event, detectthe
(0, 0)minimize signal and the following real-size restoresignal, and call
set_webview_visible(false)/set_webview_visible(true)at exactly those transitions.
No behavior changes on first launch, resizing, or maximizing - only the
minimize/restore transition is affected.
Testing
white flash before the UI repaints, across several repeated cycles.
correctly (unaffected by this change, since it only adds to the
existing
Resizedbranch).References
IsVisibledocs, minimize/restore guidance)CHECK THE UPDATED FILES HERE https://gofile.io/d/dWuN8O