Save the thumbar buttons when setting them
Then restore the buttons when restoring the taskbar icon
This commit is contained in:
parent
0b624315b2
commit
2fa7aa3c71
4 changed files with 17 additions and 3 deletions
|
@ -606,7 +606,7 @@ bool Window::SetThumbarButtons(mate::Arguments* args) {
|
||||||
}
|
}
|
||||||
auto window = static_cast<NativeWindowViews*>(window_.get());
|
auto window = static_cast<NativeWindowViews*>(window_.get());
|
||||||
return window->taskbar_host().SetThumbarButtons(
|
return window->taskbar_host().SetThumbarButtons(
|
||||||
window->GetAcceleratedWidget(), buttons);
|
window_->GetAcceleratedWidget(), buttons);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -726,10 +726,12 @@ void NativeWindowViews::SetSkipTaskbar(bool skip) {
|
||||||
CLSCTX_INPROC_SERVER)) ||
|
CLSCTX_INPROC_SERVER)) ||
|
||||||
FAILED(taskbar->HrInit()))
|
FAILED(taskbar->HrInit()))
|
||||||
return;
|
return;
|
||||||
if (skip)
|
if (skip) {
|
||||||
taskbar->DeleteTab(GetAcceleratedWidget());
|
taskbar->DeleteTab(GetAcceleratedWidget());
|
||||||
else
|
} else {
|
||||||
taskbar->AddTab(GetAcceleratedWidget());
|
taskbar->AddTab(GetAcceleratedWidget());
|
||||||
|
taskbar_host_.RestoreThumbarButtons(GetAcceleratedWidget());
|
||||||
|
}
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
SetWMSpecState(GetAcceleratedWidget(), skip,
|
SetWMSpecState(GetAcceleratedWidget(), skip,
|
||||||
GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
|
GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
|
||||||
|
|
|
@ -115,9 +115,17 @@ bool TaskbarHost::SetThumbarButtons(
|
||||||
r = taskbar_->ThumbBarAddButtons(window, kMaxButtonsCount, thumb_buttons);
|
r = taskbar_->ThumbBarAddButtons(window, kMaxButtonsCount, thumb_buttons);
|
||||||
|
|
||||||
thumbar_buttons_added_ = true;
|
thumbar_buttons_added_ = true;
|
||||||
|
last_buttons_ = buttons;
|
||||||
return SUCCEEDED(r);
|
return SUCCEEDED(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TaskbarHost::RestoreThumbarButtons(HWND window) {
|
||||||
|
if (thumbar_buttons_added_) {
|
||||||
|
thumbar_buttons_added_ = false;
|
||||||
|
SetThumbarButtons(window, last_buttons_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool TaskbarHost::SetProgressBar(
|
bool TaskbarHost::SetProgressBar(
|
||||||
HWND window, double value, const std::string& mode) {
|
HWND window, double value, const std::string& mode) {
|
||||||
if (!InitializeTaskbar())
|
if (!InitializeTaskbar())
|
||||||
|
|
|
@ -34,6 +34,8 @@ class TaskbarHost {
|
||||||
bool SetThumbarButtons(
|
bool SetThumbarButtons(
|
||||||
HWND window, const std::vector<ThumbarButton>& buttons);
|
HWND window, const std::vector<ThumbarButton>& buttons);
|
||||||
|
|
||||||
|
void RestoreThumbarButtons(HWND window);
|
||||||
|
|
||||||
// Set the progress state in taskbar.
|
// Set the progress state in taskbar.
|
||||||
bool SetProgressBar(HWND window, double value, const std::string& mode);
|
bool SetProgressBar(HWND window, double value, const std::string& mode);
|
||||||
|
|
||||||
|
@ -57,6 +59,8 @@ class TaskbarHost {
|
||||||
using CallbackMap = std::map<int, base::Closure>;
|
using CallbackMap = std::map<int, base::Closure>;
|
||||||
CallbackMap callback_map_;
|
CallbackMap callback_map_;
|
||||||
|
|
||||||
|
std::vector<ThumbarButton> last_buttons_;
|
||||||
|
|
||||||
// The COM object of taskbar.
|
// The COM object of taskbar.
|
||||||
base::win::ScopedComPtr<ITaskbarList3> taskbar_;
|
base::win::ScopedComPtr<ITaskbarList3> taskbar_;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue