mirror of
https://github.com/tiennm99/claude-code-usage-bubble.git
synced 2026-06-06 14:12:14 +00:00
fix(bubble): repaint on un-hide so cached data shows immediately
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).
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user