feat: enable Windows Control Overlay on Linux (#42681)
* feat: enable Windows Control Overlay on Linux Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * docs: update documentation for Linux WCO Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: initial symbol painting Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * test: enable WCO tests for Linux Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: add missing Layer include Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: fix gn-check failure Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: enable BrowserWindow.setTitleBarOverlay on Linux Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * test: fix test for maximize event on Linux Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: geometry updating on BrowserWindow.setTitleBarOverlay Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: crash when invalid titleBarStyle set Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: clean up ordering and comments Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * Update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * feat: enable customizing symbolColor Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * docs: correct symbolColor reference Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> * chore: remove Chrome-specific padding Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fixup .patches after rebase --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
parent
287119d447
commit
0a73b80127
24 changed files with 1026 additions and 107 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/desktop_media_id.h"
|
||||
#include "content/public/common/color_parser.h"
|
||||
#include "shell/browser/api/electron_api_web_contents.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||
|
@ -59,6 +60,7 @@
|
|||
#include "shell/browser/ui/views/client_frame_view_linux.h"
|
||||
#include "shell/browser/ui/views/frameless_view.h"
|
||||
#include "shell/browser/ui/views/native_frame_view.h"
|
||||
#include "shell/browser/ui/views/opaque_frame_view.h"
|
||||
#include "shell/common/platform_util.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
|
||||
#include "ui/views/window/native_frame_view.h"
|
||||
|
@ -76,7 +78,6 @@
|
|||
#elif BUILDFLAG(IS_WIN)
|
||||
#include "base/win/win_util.h"
|
||||
#include "base/win/windows_version.h"
|
||||
#include "content/public/common/color_parser.h"
|
||||
#include "shell/browser/ui/views/win_frame_view.h"
|
||||
#include "shell/browser/ui/win/electron_desktop_native_widget_aura.h"
|
||||
#include "skia/ext/skia_utils_win.h"
|
||||
|
@ -219,6 +220,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
|||
|
||||
overlay_button_color_ = color_utils::GetSysSkColor(COLOR_BTNFACE);
|
||||
overlay_symbol_color_ = color_utils::GetSysSkColor(COLOR_BTNTEXT);
|
||||
#endif
|
||||
|
||||
v8::Local<v8::Value> titlebar_overlay;
|
||||
if (options.Get(options::ktitleBarOverlay, &titlebar_overlay) &&
|
||||
|
@ -244,9 +246,11 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
|||
}
|
||||
}
|
||||
|
||||
if (title_bar_style_ != TitleBarStyle::kNormal)
|
||||
// |hidden| is the only non-default titleBarStyle valid on Windows and Linux.
|
||||
if (title_bar_style_ == TitleBarStyle::kHidden)
|
||||
set_has_frame(false);
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// If the taskbar is re-created after we start up, we have to rebuild all of
|
||||
// our buttons.
|
||||
taskbar_created_message_ = RegisterWindowMessage(TEXT("TaskbarCreated"));
|
||||
|
@ -1703,11 +1707,15 @@ NativeWindowViews::CreateNonClientFrameView(views::Widget* widget) {
|
|||
if (has_frame() && !has_client_frame()) {
|
||||
return std::make_unique<NativeFrameView>(this, widget);
|
||||
} else {
|
||||
auto frame_view = has_frame() && has_client_frame()
|
||||
? std::make_unique<ClientFrameViewLinux>()
|
||||
: std::make_unique<FramelessView>();
|
||||
frame_view->Init(this, widget);
|
||||
return frame_view;
|
||||
if (has_frame() && has_client_frame()) {
|
||||
auto frame_view = std::make_unique<ClientFrameViewLinux>();
|
||||
frame_view->Init(this, widget);
|
||||
return frame_view;
|
||||
} else {
|
||||
auto frame_view = std::make_unique<OpaqueFrameView>();
|
||||
frame_view->Init(this, widget);
|
||||
return frame_view;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue