From 7f8ccf083bb2f8534b1eb639fac085dffe313592 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Sat, 16 May 2026 11:58:41 +0700 Subject: [PATCH] fix(bubble): repaint on un-hide so cached data shows immediately MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the bubble is hidden (manually via "Show widget" menu or automatically by the fullscreen detector) and then re-shown, the layered window's composited surface had already been dropped — and ShowWindow(SW_SHOWNOACTIVATE) alone doesn't issue a new UpdateLayeredWindow. The bubble reappeared blank and stayed that way until the next poll cycle triggered a render. The BubbleState's session/weekly pcts + texts never went anywhere, so the fix is to call render() right after the show — both in set_user_visible (manual toggle) and in check_fullscreen (auto-show when leaving fullscreen). --- src/bubble.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/bubble.rs b/src/bubble.rs index 6a3179d..14d6fb7 100644 --- a/src/bubble.rs +++ b/src/bubble.rs @@ -309,6 +309,14 @@ pub fn set_user_visible(hwnd: HWND, visible: bool) { let cmd = if visible { SW_SHOWNOACTIVATE } else { SW_HIDE }; let _ = ShowWindow(hwnd, cmd); } + // A layered window's composited surface is dropped while hidden, so + // ShowWindow(SW_SHOWNOACTIVATE) on its own renders blank until the next + // UpdateLayeredWindow. The cached BubbleState (pcts + texts) hasn't gone + // anywhere, so just re-paint from it so the bubble pops back with the + // last good data instead of empty placeholders. + if visible { + render(hwnd); + } } pub fn position(hwnd: HWND) -> Option<(i32, i32)> { @@ -866,6 +874,9 @@ fn check_fullscreen(bubble_hwnd: HWND) { unsafe { let _ = ShowWindow(bubble_hwnd, SW_SHOWNOACTIVATE); } + // Re-paint so the layered surface has the cached data again + // (see comment in `set_user_visible`). + render(bubble_hwnd); } if let Some(b) = lock_bubbles().get_mut(&(bubble_hwnd.0 as isize)) { b.hidden_by_fullscreen = false;