From 71c8b4b2bb025ac5e171a8994575d6d17f4a9ac4 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 15 Feb 2024 14:17:59 -0500 Subject: [PATCH] chrome: win: Disable taskbar decoration for PiP and DevTools windows (fixes #3645) --- patch/patch.cfg | 5 +++ .../patches/win_taskbar_decorator_3645.patch | 41 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 patch/patches/win_taskbar_decorator_3645.patch diff --git a/patch/patch.cfg b/patch/patch.cfg index 925213d10..23a344827 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -717,4 +717,9 @@ patches = [ # https://github.com/chromiumembedded/cef/issues/3641 'name': 'win_taskbar_group_3641' }, + { + # chrome: win: Disable taskbar decoration for PiP and DevTools windows. + # https://github.com/chromiumembedded/cef/issues/3645 + 'name': 'win_taskbar_decorator_3645' + }, ] diff --git a/patch/patches/win_taskbar_decorator_3645.patch b/patch/patches/win_taskbar_decorator_3645.patch new file mode 100644 index 000000000..b8ba64c60 --- /dev/null +++ b/patch/patches/win_taskbar_decorator_3645.patch @@ -0,0 +1,41 @@ +diff --git chrome/browser/taskbar/taskbar_decorator_win.cc chrome/browser/taskbar/taskbar_decorator_win.cc +index 20f37cf8b31ee..85569f9a9694c 100644 +--- chrome/browser/taskbar/taskbar_decorator_win.cc ++++ chrome/browser/taskbar/taskbar_decorator_win.cc +@@ -18,12 +18,14 @@ + #include "base/strings/utf_string_conversions.h" + #include "base/task/thread_pool.h" + #include "base/win/scoped_gdi_object.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/browser_process.h" + #include "chrome/browser/profiles/avatar_menu.h" + #include "chrome/browser/profiles/profile.h" + #include "chrome/browser/profiles/profile_attributes_storage.h" + #include "chrome/browser/profiles/profile_avatar_icon_util.h" + #include "chrome/browser/profiles/profile_manager.h" ++#include "chrome/browser/ui/views/frame/browser_view.h" + #include "skia/ext/font_utils.h" + #include "skia/ext/image_operations.h" + #include "skia/ext/legacy_display_globals.h" +@@ -201,6 +203,21 @@ void UpdateTaskbarDecoration(Profile* profile, gfx::NativeWindow window) { + return; + } + ++#if BUILDFLAG(ENABLE_CEF) ++ if (auto browser_view = BrowserView::GetBrowserViewForNativeWindow(window)) { ++ if (auto browser = browser_view->browser()) { ++ if (browser->cef_delegate() && ++ (browser->is_type_picture_in_picture() || ++ browser->is_type_devtools()) && ++ browser->cef_delegate()->HasViewsHostedOpener()) { ++ // Don't add taskbar decoration. ++ taskbar::DrawTaskbarDecoration(window, nullptr); ++ return; ++ } ++ } ++ } ++#endif // BUILDFLAG(ENABLE_CEF) ++ + // We need to draw the taskbar decoration. Even though we have an icon on the + // window's relaunch details, we draw over it because the user may have + // pinned the badge-less Chrome shortcut which will cause Windows to ignore