| 543 | } |
| 544 | |
| 545 | void TaskbarAttributeWorker::SetAttribute(taskbar_iterator taskbar, TaskbarAppearance config) |
| 546 | { |
| 547 | if (m_TaskbarService) |
| 548 | { |
| 549 | if (config.Accent == ACCENT_NORMAL) |
| 550 | { |
| 551 | HresultVerify(m_TaskbarService->ReturnTaskbarToDefaultAppearance(taskbar->second.Taskbar.TaskbarWindow), spdlog::level::info, L"Failed to restore taskbar to normal"); |
| 552 | } |
| 553 | else if (config.Accent == ACCENT_ENABLE_BLURBEHIND) |
| 554 | { |
| 555 | HresultVerify(m_TaskbarService->SetTaskbarBlur(taskbar->second.Taskbar.TaskbarWindow, config.Color.ToABGR(), config.BlurRadius / 3), spdlog::level::info, L"Failed to set taskbar brush"); |
| 556 | } |
| 557 | else |
| 558 | { |
| 559 | auto color = config.Color; |
| 560 | TaskbarBrush brush = SolidColor; |
| 561 | |
| 562 | if (config.Accent == ACCENT_ENABLE_ACRYLICBLURBEHIND) |
| 563 | { |
| 564 | brush = Acrylic; |
| 565 | } |
| 566 | else if (config.Accent == ACCENT_ENABLE_GRADIENT) |
| 567 | { |
| 568 | color.A = 0xFF; |
| 569 | } |
| 570 | |
| 571 | HresultVerify(m_TaskbarService->SetTaskbarAppearance(taskbar->second.Taskbar.TaskbarWindow, brush, color.ToABGR()), spdlog::level::info, L"Failed to set taskbar brush"); |
| 572 | } |
| 573 | } |
| 574 | else |
| 575 | { |
| 576 | const auto window = taskbar->second.Taskbar.TaskbarWindow; |
| 577 | |
| 578 | if (config.Accent != ACCENT_NORMAL) |
| 579 | { |
| 580 | m_NormalTaskbars.erase(window); |
| 581 | |
| 582 | const bool isAcrylic = config.Accent == ACCENT_ENABLE_ACRYLICBLURBEHIND; |
| 583 | if (isAcrylic && config.Color.A == 0) |
| 584 | { |
| 585 | // Acrylic mode doesn't likes a completely 0 opacity |
| 586 | config.Color.A = 1; |
| 587 | } |
| 588 | |
| 589 | ACCENT_POLICY policy = { |
| 590 | config.Accent, |
| 591 | static_cast<UINT>(isAcrylic ? 0 : 2), |
| 592 | config.Color.ToABGR(), |
| 593 | 0 |
| 594 | }; |
| 595 | |
| 596 | const WINDOWCOMPOSITIONATTRIBDATA data = { |
| 597 | WCA_ACCENT_POLICY, |
| 598 | &policy, |
| 599 | sizeof(policy) |
| 600 | }; |
| 601 | |
| 602 | if (!SetWindowCompositionAttribute(window, &data)) [[unlikely]] |
nothing calls this directly
no test coverage detected