feat: enable windows control overlay on Windows (#29600)
* rebase "feat: enable windows control overlay on Windows" * correct compilation error * fix linting errors * modify includes and build file * change `hidden` option to `overlay` * add patch to fix visual layout * add button background color parameter * add button text color parameter * modify `overlay` in docs and modify button hover/press transition color * change `text` to `symbol` * remove todo and fix `text` replacement * add new titleBarOverlay property and remove titleBarStyle `overlay` * update browser and frameless window docs * remove chromium patches * chore: update patches * change button hover color, update trailing `_`, update test file * add dchecks, update title bar drawing checks, update test file * modify for mac and linux builds * update docs with overlayColor and overlaySymbolColor * add corner and side hit test info * modify docs and copyright info * modify `titlebar_overlay_` as boolean or object * move `title_bar_style_ to `NativeWindow` * update docs with boolean and object titlebar_overlay_ * add `IsEmpty` checks * move get options for boolean and object checks * fix linting error * disable `use_lld` for macos * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Apply docs suggestions from code review Co-authored-by: Jeremy Rose <jeremya@chromium.org> * modify `true` option description `titleBarOverlay` * ci: cleanup keychain after tests on arm64 mac (#30472) Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org>
This commit is contained in:
parent
42936b07fe
commit
41646d1168
26 changed files with 974 additions and 72 deletions
|
@ -70,12 +70,14 @@
|
|||
|
||||
#elif defined(OS_WIN)
|
||||
#include "base/win/win_util.h"
|
||||
#include "extensions/common/image_util.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"
|
||||
#include "ui/base/win/shell.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/display/win/screen_win.h"
|
||||
#include "ui/gfx/color_utils.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
|
||||
#endif
|
||||
|
||||
|
@ -165,6 +167,37 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
|||
options.Get("thickFrame", &thick_frame_);
|
||||
if (transparent())
|
||||
thick_frame_ = false;
|
||||
|
||||
overlay_button_color_ = color_utils::GetSysSkColor(COLOR_BTNFACE);
|
||||
overlay_symbol_color_ = color_utils::GetSysSkColor(COLOR_BTNTEXT);
|
||||
|
||||
v8::Local<v8::Value> titlebar_overlay;
|
||||
if (options.Get(options::ktitleBarOverlay, &titlebar_overlay) &&
|
||||
titlebar_overlay->IsObject()) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary titlebar_overlay_obj =
|
||||
gin::Dictionary::CreateEmpty(isolate);
|
||||
options.Get(options::ktitleBarOverlay, &titlebar_overlay_obj);
|
||||
|
||||
std::string overlay_color_string;
|
||||
if (titlebar_overlay_obj.Get(options::kOverlayButtonColor,
|
||||
&overlay_color_string)) {
|
||||
bool success = extensions::image_util::ParseCssColorString(
|
||||
overlay_color_string, &overlay_button_color_);
|
||||
DCHECK(success);
|
||||
}
|
||||
|
||||
std::string overlay_symbol_color_string;
|
||||
if (titlebar_overlay_obj.Get(options::kOverlaySymbolColor,
|
||||
&overlay_symbol_color_string)) {
|
||||
bool success = extensions::image_util::ParseCssColorString(
|
||||
overlay_symbol_color_string, &overlay_symbol_color_);
|
||||
DCHECK(success);
|
||||
}
|
||||
}
|
||||
|
||||
if (title_bar_style_ != TitleBarStyle::kNormal)
|
||||
set_has_frame(false);
|
||||
#endif
|
||||
|
||||
if (enable_larger_than_screen())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue