Compare commits

..

6 Commits

Author SHA1 Message Date
trop[bot]
93d70103aa docs: update build prerequisites (#47698)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-07-09 12:31:48 +02:00
trop[bot]
6e9a46042d fix: fullscreen for windows without rounded corners (#47682)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-07-08 15:22:52 +02:00
trop[bot]
f4e709c47e refactor: avoid a few unnecessary strings (#47654)
* perf: replace string temporary with string_view in GetXdgAppId()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* perf: replace string temporary with string_view in ToV8(WindowOpenDisposition)

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* perf: replace string temporary with string_view in ToV8(electron::api::WebContents::Type)

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-07-04 10:58:45 +02:00
trop[bot]
549c73a8b4 fix: accent color should reflect system settings without restart (#47656)
fix: accentColor should reflect system settings without restart

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-07-03 22:19:26 +02:00
trop[bot]
90a0f81302 fix: crash on source capture with empty thumbnail size (#47653)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-07-03 19:19:22 +02:00
trop[bot]
841a770c6c build: update yarn to 1.22.22 (#47638)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sattard@anthropic.com>
2025-07-03 14:41:59 +02:00
15 changed files with 110 additions and 40 deletions

2
DEPS
View File

@@ -31,7 +31,7 @@ vars = {
'sysroots_json_path': 'electron/script/sysroots.json',
# KEEP IN SYNC WITH utils.js FILE
'yarn_version': '1.15.2',
'yarn_version': '1.22.22',
# To be able to build clean Chromium from sources.
'apply_patches': True,

View File

@@ -7,11 +7,8 @@ Follow the guidelines below for building **Electron itself** on Linux, for the p
## Prerequisites
* At least 25GB disk space and 8GB RAM.
* Python >= 3.7.
* Node.js. There are various ways to install Node. You can download
source code from [nodejs.org](https://nodejs.org) and compile it.
Doing so permits installing Node on your own home directory as a standard user.
Or try repositories such as [NodeSource](https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories).
* Python >= 3.9.
* [Node.js](https://nodejs.org/download/) >= 22.12.0
* [clang](https://clang.llvm.org/get_started.html) 3.4 or later.
* Development headers of GTK 3 and libnotify.

View File

@@ -10,8 +10,8 @@ Follow the guidelines below for building **Electron itself** on macOS, for the p
* [Xcode](https://developer.apple.com/technologies/tools/). The exact version
needed depends on what branch you are building, but the latest version of
Xcode is generally a good bet for building `main`.
* [node.js](https://nodejs.org) (external)
* Python >= 3.7
* Python >= 3.9
* [Node.js](https://nodejs.org/download/) >= 22.12.0
### Arm64-specific prerequisites

View File

@@ -14,7 +14,7 @@ Follow the guidelines below for building **Electron itself** on Windows, for the
set a few environment variables to point the toolchains to your installation path.
* `vs2022_install = DRIVE:\path\to\Microsoft Visual Studio\2022\Community`, replacing `2022` and `Community` with your installed versions and replacing `DRIVE:` with the drive that Visual Studio is on. Often, this will be `C:`.
* `WINDOWSSDKDIR = DRIVE:\path\to\Windows Kits\10`, replacing `DRIVE:` with the drive that Windows Kits is on. Often, this will be `C:`.
* [Node.js](https://nodejs.org/download/)
* [Node.js](https://nodejs.org/download/) >= 22.12.0
* [Git](https://git-scm.com)
* Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on
creating a full distribution since `symstore.exe` is used for creating a symbol

View File

@@ -233,7 +233,8 @@ DesktopCapturer::DesktopListListener::~DesktopListListener() = default;
void DesktopCapturer::DesktopListListener::OnDelegatedSourceListSelection() {
if (have_thumbnail_) {
std::move(update_callback_).Run();
content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE,
std::move(update_callback_));
} else {
have_selection_ = true;
}
@@ -246,7 +247,8 @@ void DesktopCapturer::DesktopListListener::OnSourceThumbnailChanged(int index) {
have_selection_ = false;
// PipeWire returns a single source, so index is not relevant.
std::move(update_callback_).Run();
content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE,
std::move(update_callback_));
} else {
have_thumbnail_ = true;
}

View File

@@ -242,7 +242,7 @@ template <>
struct Converter<WindowOpenDisposition> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
WindowOpenDisposition val) {
std::string disposition = "other";
std::string_view disposition = "other";
switch (val) {
case WindowOpenDisposition::CURRENT_TAB:
disposition = "default";
@@ -303,7 +303,7 @@ struct Converter<electron::api::WebContents::Type> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
electron::api::WebContents::Type val) {
using Type = electron::api::WebContents::Type;
std::string type;
std::string_view type;
switch (val) {
case Type::kBackgroundPage:
type = "backgroundPage";

View File

@@ -175,6 +175,8 @@ class NativeWindowMac : public NativeWindow,
// cleanup in destructor.
void Cleanup();
void SetBorderless(bool borderless);
void UpdateVibrancyRadii(bool fullscreen);
void UpdateWindowOriginalFrame();

View File

@@ -158,13 +158,6 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
NSUInteger styleMask = NSWindowStyleMaskTitled;
// The NSWindowStyleMaskFullSizeContentView style removes rounded corners
// for frameless window.
const bool rounded_corner =
options.ValueOrDefault(options::kRoundedCorners, true);
if (!rounded_corner && !has_frame())
styleMask = NSWindowStyleMaskBorderless;
if (minimizable)
styleMask |= NSWindowStyleMaskMiniaturizable;
if (closable)
@@ -224,6 +217,11 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
SetParentWindow(parent);
}
const bool rounded_corner =
options.ValueOrDefault(options::kRoundedCorners, true);
if (!rounded_corner && !has_frame())
SetBorderless(!rounded_corner);
if (transparent()) {
// Setting the background color to clear will also hide the shadow.
[window_ setBackgroundColor:[NSColor clearColor]];
@@ -775,6 +773,11 @@ void NativeWindowMac::MoveTop() {
[window_ orderWindowByShuffling:NSWindowAbove relativeTo:0];
}
void NativeWindowMac::SetBorderless(bool borderless) {
SetStyleMask(!borderless, NSWindowStyleMaskTitled);
SetStyleMask(borderless, NSWindowStyleMaskBorderless);
}
void NativeWindowMac::SetResizable(bool resizable) {
ScopedDisableResize disable_resize;
SetStyleMask(resizable, NSWindowStyleMaskResizable);

View File

@@ -306,7 +306,7 @@ class NativeWindowViews : public NativeWindow,
// Whether the window is currently being moved.
bool is_moving_ = false;
std::variant<bool, SkColor> accent_color_ = true;
std::variant<std::monostate, bool, SkColor> accent_color_;
std::optional<gfx::Rect> pending_bounds_change_;

View File

@@ -574,28 +574,42 @@ void NativeWindowViews::UpdateWindowAccentColor() {
if (base::win::GetVersion() < base::win::Version::WIN11)
return;
if (!IsAccentColorOnTitleBarsEnabled())
return;
COLORREF border_color;
bool should_apply_accent = false;
if (std::holds_alternative<bool>(accent_color_)) {
// Don't set accent color if the user has disabled it.
if (!std::get<bool>(accent_color_))
return;
std::optional<DWORD> accent_color = GetAccentColor();
if (!accent_color.has_value())
return;
border_color =
RGB(GetRValue(accent_color.value()), GetGValue(accent_color.value()),
GetBValue(accent_color.value()));
} else {
bool force_accent = std::get<bool>(accent_color_);
if (!force_accent) {
should_apply_accent = false;
} else {
std::optional<DWORD> accent_color = GetAccentColor();
if (accent_color.has_value()) {
border_color = RGB(GetRValue(accent_color.value()),
GetGValue(accent_color.value()),
GetBValue(accent_color.value()));
should_apply_accent = true;
}
}
} else if (std::holds_alternative<SkColor>(accent_color_)) {
SkColor color = std::get<SkColor>(accent_color_);
border_color =
RGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color));
should_apply_accent = true;
} else if (std::holds_alternative<std::monostate>(accent_color_)) {
if (IsAccentColorOnTitleBarsEnabled()) {
std::optional<DWORD> accent_color = GetAccentColor();
if (accent_color.has_value()) {
border_color = RGB(GetRValue(accent_color.value()),
GetGValue(accent_color.value()),
GetBValue(accent_color.value()));
should_apply_accent = true;
}
}
}
// Reset to default system colors when accent color should not be applied.
if (!should_apply_accent)
border_color = DWMWA_COLOR_DEFAULT;
SetWindowBorderAndCaptionColor(GetAcceleratedWidget(), border_color);
}

View File

@@ -375,9 +375,6 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
}
- (BOOL)toggleFullScreenMode:(id)sender {
if (!shell_->has_frame() && !shell_->HasStyleMask(NSWindowStyleMaskTitled))
return NO;
bool is_simple_fs = shell_->IsSimpleFullScreen();
bool always_simple_fs = shell_->always_simple_fullscreen();

View File

@@ -24,6 +24,8 @@ class NativeWindowMac;
int level_;
bool is_resizable_;
bool is_borderless_;
// Whether the window is currently minimized. Used to work
// around a macOS bug with child window minimization.
bool is_minimized_;

View File

@@ -299,6 +299,8 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
- (void)windowWillEnterFullScreen:(NSNotification*)notification {
// Store resizable mask so it can be restored after exiting fullscreen.
is_resizable_ = shell_->HasStyleMask(NSWindowStyleMaskResizable);
// Store borderless mask so it can be restored after exiting fullscreen.
is_borderless_ = !shell_->HasStyleMask(NSWindowStyleMaskTitled);
shell_->set_is_transitioning_fullscreen(true);
@@ -306,6 +308,8 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
// Set resizable to true before entering fullscreen.
shell_->SetResizable(true);
// Set borderless to false before entering fullscreen.
shell_->SetBorderless(false);
}
- (void)windowDidEnterFullScreen:(NSNotification*)notification {
@@ -341,6 +345,7 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
shell_->set_is_transitioning_fullscreen(false);
shell_->SetResizable(is_resizable_);
shell_->SetBorderless(is_borderless_);
shell_->NotifyWindowLeaveFullScreen();
if (shell_->HandleDeferredClose())

View File

@@ -430,7 +430,7 @@ std::optional<std::string> GetDesktopName() {
std::string GetXdgAppId() {
if (std::optional<std::string> desktop_file_name = GetDesktopName()) {
const std::string kDesktopExtension{".desktop"};
constexpr std::string_view kDesktopExtension = ".desktop";
if (base::EndsWith(*desktop_file_name, kDesktopExtension,
base::CompareCase::INSENSITIVE_ASCII)) {
desktop_file_name->resize(desktop_file_name->size() -

View File

@@ -5993,6 +5993,54 @@ describe('BrowserWindow module', () => {
await leaveFullScreen;
});
it('should not crash if rounded corners are disabled', async () => {
const w = new BrowserWindow({
frame: false,
roundedCorners: false
});
const enterFullScreen = once(w, 'enter-full-screen');
w.setFullScreen(true);
await enterFullScreen;
await setTimeout();
const leaveFullScreen = once(w, 'leave-full-screen');
w.setFullScreen(false);
await leaveFullScreen;
});
it('should not crash if opening a borderless child window from fullscreen parent', async () => {
const parent = new BrowserWindow();
const parentFS = once(parent, 'enter-full-screen');
parent.setFullScreen(true);
await parentFS;
await setTimeout();
const child = new BrowserWindow({
width: 400,
height: 300,
show: false,
parent,
frame: false,
roundedCorners: false
});
await setTimeout();
const childFS = once(child, 'enter-full-screen');
child.show();
await childFS;
await setTimeout();
const leaveFullScreen = once(child, 'leave-full-screen');
child.setFullScreen(false);
await leaveFullScreen;
});
it('should be able to load a URL while transitioning to fullscreen', async () => {
const w = new BrowserWindow({ fullscreen: true });
w.loadFile(path.join(fixtures, 'pages', 'c.html'));