mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
feat: enable window controls overlay on macOS (#29253)
* feat: enable windows control overlay on macOS
* address review feedback
* chore: address review feedback
* Address review feedback
* update doc per review
* only enable WCO when titleBarStyle is overlay
* Revert "only enable WCO when titleBarStyle is overlay"
This reverts commit 1b58b5b1fc.
* Add new titleBarOverlay property to manage feature
* spelling fix
* Update docs/api/frameless-window.md
Co-authored-by: Samuel Attard <sam@electronjs.org>
* Update shell/browser/api/electron_api_browser_window.cc
Co-authored-by: Samuel Attard <sam@electronjs.org>
* update per review feedback
Co-authored-by: Samuel Attard <sam@electronjs.org>
This commit is contained in:
committed by
GitHub
parent
0fe2836151
commit
1f8a46c9c6
@@ -57,6 +57,17 @@ BrowserWindow::BrowserWindow(gin::Arguments* args,
|
||||
web_preferences.Set(options::kShow, show);
|
||||
}
|
||||
|
||||
bool titleBarOverlay = false;
|
||||
options.Get(options::ktitleBarOverlay, &titleBarOverlay);
|
||||
if (titleBarOverlay) {
|
||||
std::string enabled_features = "";
|
||||
if (web_preferences.Get(options::kEnableBlinkFeatures, &enabled_features)) {
|
||||
enabled_features += ",";
|
||||
}
|
||||
enabled_features += features::kWebAppWindowControlsOverlay.name;
|
||||
web_preferences.Set(options::kEnableBlinkFeatures, enabled_features);
|
||||
}
|
||||
|
||||
// Copy the webContents option to webPreferences. This is only used internally
|
||||
// to implement nativeWindowOpen option.
|
||||
if (options.Get("webContents", &value)) {
|
||||
@@ -312,6 +323,11 @@ void BrowserWindow::OnWindowLeaveFullScreen() {
|
||||
BaseWindow::OnWindowLeaveFullScreen();
|
||||
}
|
||||
|
||||
void BrowserWindow::UpdateWindowControlsOverlay(
|
||||
const gfx::Rect& bounding_rect) {
|
||||
web_contents()->UpdateWindowControlsOverlay(bounding_rect);
|
||||
}
|
||||
|
||||
void BrowserWindow::CloseImmediately() {
|
||||
// Close all child windows before closing current window.
|
||||
v8::Locker locker(isolate());
|
||||
|
||||
Reference in New Issue
Block a user