mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: bump chromium to 112.0.5615.10 * 4240798: Get rid of ShowInvalidPrinterSettingsError() in PrintManagerHost. https://chromium-review.googlesource.com/c/chromium/src/+/4240798 * chore: fixup patch * 4173660: Remove unused argument in BeforeUnloadCompleted Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4173660 (cherry picked from commit6d3934f743) * refactor: base value type DICTIONARY replaced with DICT Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4198081 (cherry picked from commitb7acb5c9a4) * 4251237: [StorageKey Cleanup] (2) Rename CreateFirstParty constructors Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4251237 (cherry picked from commit31bdd549d0) * refactor: rename latency metrics Refs: https://chromium-review.googlesource.com/c/chromium/src/+/4048262 (cherry picked from commit1e1b97d387) * refactor: base::span explicit conversion checks Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4219636 (cherry picked from commit020e8c6aae) * chore: iwyu net/cert/cert_verify_result.h (cherry picked from commit24583f5583) * 4258446: Move network::mojom::ClearDataFilter to its own mojom file https://chromium-review.googlesource.com/c/chromium/src/+/4258446 (cherry picked from commit5ff47109cd) * refactor: refactoring geolocation manager Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4161603 (cherry picked from commit1eeaafb45c) * refactor: use modern base values in tracing Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4210912 (cherry picked from commit192c988c1e) * refactor: add sanitized context to clipboard write Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4178264 (cherry picked from commit3ef020b5e5) * 4256866: [Extensions] Replace GetHooksForAPI with a RegisterHooksDelegate Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4256866 (cherry picked from commitb9d905216a) * refactor: s/Rect/WindowFeatures Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4167001 (cherry picked from commit12d121265b) * 4226656: Add response url to SimpleURLLoader::OnRedirectCallback Ref: https://chromium-review.googlesource.com/c/chromium/src/+/4226656 (cherry picked from commit9f66c47930) * Better approach for ShowInvalidPrinterSettingsError() removal * build: use xcode 14 (cherry picked from commit06bd2c0442) * build: update appveyor image 4072083: New toolchain for Windows 11 10.0.22621.755 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/4072083 (cherry picked from commit437c49898f) * 4261434: Remove browser_watcher (1/3): Move ExitCodeWatcher to chrome/app https://chromium-review.googlesource.com/c/chromium/src/+/4261434 (cherry picked from commitedc90d9488) * 4128591: Enable large pdbs by default https://chromium-review.googlesource.com/c/chromium/src/+/4128591 (cherry picked from commite76f2c3f16) * move dbgcore/dbghelp to extensions_to_skip (cherry picked from commit8eeb555145) * 4273450: dpwas: Send announcement when live regions changed https://chromium-review.googlesource.com/c/chromium/src/+/4273450 * 4277708: win7dep: Remove ResolveCoreWinRTStringDelayload https://chromium-review.googlesource.com/c/chromium/src/+/4277708 * Roll clang+rust llvmorg-17-init-3170-g6e30dffe-1 : llvmorg-17-init-3874-g93a2fecc-1 / [skipping Rust] https://chromium-review.googlesource.com/c/chromium/src/+/4308214 * 4285717: Copy d3dcompiler_47.dll on ARM64 Windows builds https://chromium-review.googlesource.com/c/angle/angle/+/4285717 * Revert "Roll clang+rust llvmorg-17-init-3170-g6e30dffe-1 : llvmorg-17-init-3874-g93a2fecc-1 / [skipping Rust]" This reverts commit71080f4f2d. * Revert Roll clang+rust llvmorg-16-init-17653-g39da55e8-3 This clang roll breaks Linux arm 32-bit --------- Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
189 lines
8.9 KiB
Diff
189 lines
8.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: msizanoen1 <msizanoen@qtmlabs.xyz>
|
|
Date: Tue, 19 Jul 2022 05:11:06 +0200
|
|
Subject: Add maximized parameter to LinuxUI::GetWindowFrameProvider
|
|
|
|
This allows ClientFrameViewLinux to instruct the toolkit to draw the window
|
|
decorations in maximized mode where needed, preventing empty space caused
|
|
by decoration shadows and rounded titlebars around the window while maximized.
|
|
|
|
diff --git a/ui/gtk/gtk_ui.cc b/ui/gtk/gtk_ui.cc
|
|
index 31917ffefc42e5073c12ff153ec1db9bf0876ff6..fedccd7966fe6de7bfe8b0e5664f47c484798652 100644
|
|
--- a/ui/gtk/gtk_ui.cc
|
|
+++ b/ui/gtk/gtk_ui.cc
|
|
@@ -480,11 +480,13 @@ std::unique_ptr<ui::NavButtonProvider> GtkUi::CreateNavButtonProvider() {
|
|
return std::make_unique<gtk::NavButtonProviderGtk>();
|
|
}
|
|
|
|
-ui::WindowFrameProvider* GtkUi::GetWindowFrameProvider(bool solid_frame) {
|
|
+ui::WindowFrameProvider* GtkUi::GetWindowFrameProvider(bool solid_frame, bool maximized) {
|
|
auto& provider =
|
|
- solid_frame ? solid_frame_provider_ : transparent_frame_provider_;
|
|
+ maximized
|
|
+ ? (solid_frame ? solid_maximized_frame_provider_ : transparent_maximized_frame_provider_)
|
|
+ : (solid_frame ? solid_frame_provider_ : transparent_frame_provider_);
|
|
if (!provider) {
|
|
- provider = std::make_unique<gtk::WindowFrameProviderGtk>(solid_frame);
|
|
+ provider = std::make_unique<gtk::WindowFrameProviderGtk>(solid_frame, maximized);
|
|
}
|
|
return provider.get();
|
|
}
|
|
diff --git a/ui/gtk/gtk_ui.h b/ui/gtk/gtk_ui.h
|
|
index ebc31db3dad9ba7904fbd345c6a1ba31ed6fd813..1d2ffc82bb67ed80f508631c8c7d045be76f6761 100644
|
|
--- a/ui/gtk/gtk_ui.h
|
|
+++ b/ui/gtk/gtk_ui.h
|
|
@@ -106,7 +106,7 @@ class GtkUi : public ui::LinuxUiAndTheme {
|
|
SkColor GetInactiveSelectionFgColor() const override;
|
|
bool PreferDarkTheme() const override;
|
|
std::unique_ptr<ui::NavButtonProvider> CreateNavButtonProvider() override;
|
|
- ui::WindowFrameProvider* GetWindowFrameProvider(bool solid_frame) override;
|
|
+ ui::WindowFrameProvider* GetWindowFrameProvider(bool solid_frame, bool maximized) override;
|
|
|
|
private:
|
|
using TintMap = std::map<int, color_utils::HSL>;
|
|
@@ -195,10 +195,13 @@ class GtkUi : public ui::LinuxUiAndTheme {
|
|
// while Chrome is running.
|
|
std::unique_ptr<ui::WindowFrameProvider> solid_frame_provider_;
|
|
std::unique_ptr<ui::WindowFrameProvider> transparent_frame_provider_;
|
|
+ std::unique_ptr<ui::WindowFrameProvider> solid_maximized_frame_provider_;
|
|
+ std::unique_ptr<ui::WindowFrameProvider> transparent_maximized_frame_provider_;
|
|
|
|
// Objects to notify when the window frame button order changes.
|
|
base::ObserverList<ui::WindowButtonOrderObserver>::Unchecked
|
|
window_button_order_observer_list_;
|
|
+
|
|
};
|
|
|
|
} // namespace gtk
|
|
diff --git a/ui/gtk/window_frame_provider_gtk.cc b/ui/gtk/window_frame_provider_gtk.cc
|
|
index e866f32a06abd8b9ee70f2972822b37756878259..d55229238fed1fedba65a969495c9b5c9f1b94fa 100644
|
|
--- a/ui/gtk/window_frame_provider_gtk.cc
|
|
+++ b/ui/gtk/window_frame_provider_gtk.cc
|
|
@@ -39,16 +39,18 @@ std::string GetThemeName() {
|
|
return theme_string;
|
|
}
|
|
|
|
-GtkCssContext WindowContext(bool solid_frame, bool focused) {
|
|
+GtkCssContext WindowContext(bool solid_frame, bool maximized, bool focused) {
|
|
std::string selector = "#window.background.";
|
|
selector += solid_frame ? "solid-csd" : "csd";
|
|
+ if (maximized)
|
|
+ selector += ".maximized";
|
|
if (!focused)
|
|
selector += ":inactive";
|
|
return AppendCssNodeToStyleContext({}, selector);
|
|
}
|
|
|
|
-GtkCssContext DecorationContext(bool solid_frame, bool focused) {
|
|
- auto context = WindowContext(solid_frame, focused);
|
|
+GtkCssContext DecorationContext(bool solid_frame, bool maximized, bool focused) {
|
|
+ auto context = WindowContext(solid_frame, maximized, focused);
|
|
// GTK4 renders the decoration directly on the window.
|
|
if (!GtkCheckVersion(4))
|
|
context = AppendCssNodeToStyleContext(context, "#decoration");
|
|
@@ -65,8 +67,8 @@ GtkCssContext DecorationContext(bool solid_frame, bool focused) {
|
|
return context;
|
|
}
|
|
|
|
-GtkCssContext HeaderContext(bool solid_frame, bool focused) {
|
|
- auto context = WindowContext(solid_frame, focused);
|
|
+GtkCssContext HeaderContext(bool solid_frame, bool maximized, bool focused) {
|
|
+ auto context = WindowContext(solid_frame, maximized, focused);
|
|
context =
|
|
AppendCssNodeToStyleContext(context, "#headerbar.header-bar.titlebar");
|
|
if (!focused)
|
|
@@ -111,8 +113,8 @@ int ComputeTopCornerRadius() {
|
|
// need to experimentally determine the corner radius by rendering a sample.
|
|
// Additionally, in GTK4, the headerbar corners get clipped by the window
|
|
// rather than the headerbar having its own rounded corners.
|
|
- auto context = GtkCheckVersion(4) ? DecorationContext(false, false)
|
|
- : HeaderContext(false, false);
|
|
+ auto context = GtkCheckVersion(4) ? DecorationContext(false, false, false)
|
|
+ : HeaderContext(false, false, false);
|
|
ApplyCssToContext(context, R"(window, headerbar {
|
|
background-image: none;
|
|
background-color: black;
|
|
@@ -145,7 +147,7 @@ int ComputeTopCornerRadius() {
|
|
bool HeaderIsTranslucent() {
|
|
// The arbitrary square size to render a sample header.
|
|
constexpr int kHeaderSize = 32;
|
|
- auto context = HeaderContext(false, false);
|
|
+ auto context = HeaderContext(false, false, false);
|
|
ApplyCssToContext(context, R"(window, headerbar {
|
|
box-shadow: none;
|
|
border: none;
|
|
@@ -197,8 +199,8 @@ void WindowFrameProviderGtk::Asset::CloneFrom(
|
|
unfocused_bitmap = src.unfocused_bitmap;
|
|
}
|
|
|
|
-WindowFrameProviderGtk::WindowFrameProviderGtk(bool solid_frame)
|
|
- : solid_frame_(solid_frame) {}
|
|
+WindowFrameProviderGtk::WindowFrameProviderGtk(bool solid_frame, bool maximized)
|
|
+ : solid_frame_(solid_frame), maximized_(maximized) {}
|
|
|
|
WindowFrameProviderGtk::~WindowFrameProviderGtk() = default;
|
|
|
|
@@ -305,7 +307,7 @@ void WindowFrameProviderGtk::PaintWindowFrame(
|
|
top_area_height_dip * scale - effective_frame_thickness_px.top();
|
|
|
|
auto header = PaintHeaderbar({client_bounds_px.width(), top_area_height_px},
|
|
- HeaderContext(solid_frame_, focused), scale);
|
|
+ HeaderContext(solid_frame_, maximized_, focused), scale);
|
|
image = gfx::ImageSkia::CreateFrom1xBitmap(header);
|
|
// In GTK4, the headerbar gets clipped by the window.
|
|
if (GtkCheckVersion(4)) {
|
|
@@ -337,7 +339,7 @@ void WindowFrameProviderGtk::MaybeUpdateBitmaps(float scale) {
|
|
|
|
gfx::Rect frame_bounds_dip(kMaxFrameSizeDip, kMaxFrameSizeDip,
|
|
2 * kMaxFrameSizeDip, 2 * kMaxFrameSizeDip);
|
|
- auto focused_context = DecorationContext(solid_frame_, true);
|
|
+ auto focused_context = DecorationContext(solid_frame_, maximized_, true);
|
|
frame_bounds_dip.Inset(-GtkStyleContextGetPadding(focused_context));
|
|
frame_bounds_dip.Inset(-GtkStyleContextGetBorder(focused_context));
|
|
gfx::Size bitmap_size(BitmapSizePx(asset), BitmapSizePx(asset));
|
|
@@ -345,7 +347,7 @@ void WindowFrameProviderGtk::MaybeUpdateBitmaps(float scale) {
|
|
PaintBitmap(bitmap_size, frame_bounds_dip, focused_context, scale);
|
|
asset.unfocused_bitmap =
|
|
PaintBitmap(bitmap_size, frame_bounds_dip,
|
|
- DecorationContext(solid_frame_, false), scale);
|
|
+ DecorationContext(solid_frame_, maximized_, false), scale);
|
|
|
|
// In GTK4, there's no way to obtain the frame thickness from CSS values
|
|
// directly, so we must determine it experimentally based on the drawn
|
|
diff --git a/ui/gtk/window_frame_provider_gtk.h b/ui/gtk/window_frame_provider_gtk.h
|
|
index 32c3d63ae4598339965c58443a8c2d12b99fb89a..91496d957b8291cd37948e237a1cc4bf605848b0 100644
|
|
--- a/ui/gtk/window_frame_provider_gtk.h
|
|
+++ b/ui/gtk/window_frame_provider_gtk.h
|
|
@@ -14,7 +14,7 @@ namespace gtk {
|
|
|
|
class WindowFrameProviderGtk : public ui::WindowFrameProvider {
|
|
public:
|
|
- explicit WindowFrameProviderGtk(bool solid_frame);
|
|
+ explicit WindowFrameProviderGtk(bool solid_frame, bool maximized);
|
|
|
|
WindowFrameProviderGtk(const WindowFrameProviderGtk&) = delete;
|
|
WindowFrameProviderGtk& operator=(const WindowFrameProviderGtk&) = delete;
|
|
@@ -72,6 +72,9 @@ class WindowFrameProviderGtk : public ui::WindowFrameProvider {
|
|
|
|
// Cached bitmaps and metrics. The scale is rounded to percent.
|
|
base::flat_map<int, Asset> assets_;
|
|
+
|
|
+ // Whether to draw the window decorations as maximized.
|
|
+ bool maximized_;
|
|
};
|
|
|
|
} // namespace gtk
|
|
diff --git a/ui/linux/linux_ui.h b/ui/linux/linux_ui.h
|
|
index b5fd57741d2f47bda9499cf10e73cc9b3dd1b4dc..35e5bedb719af699485b575ece4bdb4f90df07df 100644
|
|
--- a/ui/linux/linux_ui.h
|
|
+++ b/ui/linux/linux_ui.h
|
|
@@ -273,7 +273,7 @@ class COMPONENT_EXPORT(LINUX_UI) LinuxUiTheme {
|
|
// if transparency is unsupported and the frame should be rendered opaque.
|
|
// The returned object is not owned by the caller and will remain alive until
|
|
// the process ends.
|
|
- virtual WindowFrameProvider* GetWindowFrameProvider(bool solid_frame) = 0;
|
|
+ virtual WindowFrameProvider* GetWindowFrameProvider(bool solid_frame, bool maximized) = 0;
|
|
|
|
protected:
|
|
LinuxUiTheme();
|