| 35 | } |
| 36 | |
| 37 | HRESULT TaskbarAppearanceService::SetTaskbarAppearance(HWND taskbar, TaskbarBrush brush, UINT color) try |
| 38 | { |
| 39 | if (const auto info = GetTaskbarInfo(taskbar)) |
| 40 | { |
| 41 | if (info->background.control && info->background.originalFill) |
| 42 | { |
| 43 | const winrt::Windows::UI::Color tint = Util::Color::FromABGR(color); |
| 44 | wux::Media::Brush newBrush = nullptr; |
| 45 | if (brush == Acrylic) |
| 46 | { |
| 47 | wux::Media::AcrylicBrush acrylicBrush; |
| 48 | // on the taskbar, using Backdrop instead of HostBackdrop |
| 49 | // makes the effect still show what's behind, but also not disable itself |
| 50 | // when the window isn't active |
| 51 | // this is because it sources what's behind the XAML, and the taskbar window |
| 52 | // is transparent so what's behind is actually the content behind the window |
| 53 | // (it doesn't need to poke a hole like HostBackdrop) |
| 54 | acrylicBrush.BackgroundSource(wux::Media::AcrylicBackgroundSource::Backdrop); |
| 55 | acrylicBrush.TintColor(tint); |
| 56 | |
| 57 | newBrush = std::move(acrylicBrush); |
| 58 | } |
| 59 | else if (brush == SolidColor) |
| 60 | { |
| 61 | wux::Media::SolidColorBrush solidBrush; |
| 62 | solidBrush.Color(tint); |
| 63 | |
| 64 | newBrush = std::move(solidBrush); |
| 65 | } |
| 66 | |
| 67 | info->background.control.Fill(newBrush); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return S_OK; |
| 72 | } |
| 73 | catch (...) |
| 74 | { |
| 75 | return winrt::to_hresult(); |
| 76 | } |
| 77 | |
| 78 | HRESULT TaskbarAppearanceService::SetTaskbarBlur(HWND taskbar, UINT color, FLOAT blurAmount) try |
| 79 | { |