fix: disappearing thumbar after win.hide() (#28366)
* fix: disappearing thumbar after win.hide() * Add descriptive comment
This commit is contained in:
parent
b9b734c9c4
commit
1453a8e743
3 changed files with 13 additions and 2 deletions
|
@ -442,6 +442,14 @@ void NativeWindowViews::Hide() {
|
|||
if (!features::IsUsingOzonePlatform() && global_menu_bar_)
|
||||
global_menu_bar_->OnWindowUnmapped();
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// When the window is removed from the taskbar via win.hide(),
|
||||
// the thumbnail buttons need to be set up again.
|
||||
// Ensure that when the window is hidden,
|
||||
// the taskbar host is notified that it should re-add them.
|
||||
taskbar_host_.SetThumbarButtonsAdded(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NativeWindowViews::IsVisible() {
|
||||
|
|
|
@ -114,11 +114,12 @@ bool TaskbarHost::SetThumbarButtons(HWND window,
|
|||
|
||||
// Finally add them to taskbar.
|
||||
HRESULT r;
|
||||
if (thumbar_buttons_added_)
|
||||
if (thumbar_buttons_added_) {
|
||||
r = taskbar_->ThumbBarUpdateButtons(window, kMaxButtonsCount,
|
||||
thumb_buttons);
|
||||
else
|
||||
} else {
|
||||
r = taskbar_->ThumbBarAddButtons(window, kMaxButtonsCount, thumb_buttons);
|
||||
}
|
||||
|
||||
thumbar_buttons_added_ = true;
|
||||
last_buttons_ = buttons;
|
||||
|
|
|
@ -60,6 +60,8 @@ class TaskbarHost {
|
|||
// Called by the window that there is a button in thumbar clicked.
|
||||
bool HandleThumbarButtonEvent(int button_id);
|
||||
|
||||
void SetThumbarButtonsAdded(bool added) { thumbar_buttons_added_ = added; }
|
||||
|
||||
private:
|
||||
// Initialize the taskbar object.
|
||||
bool InitializeTaskbar();
|
||||
|
|
Loading…
Reference in a new issue