mirror of
https://abf.rosa.ru/djam/chromium-browser-stable-test.git
synced 2025-02-24 01:52:45 +00:00
Use upstream workaround for XFCE
Previous revert of an upstream commit had 2 problems: 1) https://bugs.chromium.org/p/chromium/issues/detail?id=1260821#c77 2) window was oversized with system titlebar enabled
This commit is contained in:
parent
2e25c2f983
commit
cdd2c949a7
3 changed files with 56 additions and 427 deletions
|
@ -1,422 +0,0 @@
|
||||||
From 679f2ab42503f27239a69c2ffd0605e8365e0b6a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
|
||||||
Date: Tue, 9 Nov 2021 18:14:17 +0300
|
|
||||||
Subject: [PATCH] Revert "[Merge to M95] Reland "Reland "[X11] Reset frame
|
|
||||||
hints when using server side decorations"""
|
|
||||||
|
|
||||||
This reverts commit d6849977d8eb0310ff6e04cece7de5fa250b3a15
|
|
||||||
https://github.com/chromium/chromium/commit/d6849977d8eb0310ff6e04cece7de5fa250b3a15
|
|
||||||
|
|
||||||
It introduces a regression in XFCE: https://bugs.chromium.org/p/chromium/issues/detail?id=1260821
|
|
||||||
It tried to fix Enlightment, may be it fixed it, but it itroduced a regression in XFCE.
|
|
||||||
XFCE has more users.
|
|
||||||
|
|
||||||
See: https://bugs.chromium.org/p/chromium/issues/detail?id=1260821
|
|
||||||
---
|
|
||||||
.../browser_desktop_window_tree_host_linux.cc | 17 ++++---
|
|
||||||
.../wayland/host/wayland_subsurface.cc | 3 +-
|
|
||||||
.../platform/wayland/host/wayland_surface.cc | 14 +++---
|
|
||||||
.../platform/wayland/host/wayland_surface.h | 9 ++--
|
|
||||||
.../wayland/host/wayland_toplevel_window.cc | 15 ++----
|
|
||||||
.../wayland/host/wayland_toplevel_window.h | 4 +-
|
|
||||||
.../platform/wayland/host/wayland_window.cc | 17 ++-----
|
|
||||||
.../platform/wayland/host/wayland_window.h | 2 +-
|
|
||||||
.../wayland/host/wayland_window_unittest.cc | 4 +-
|
|
||||||
ui/platform_window/platform_window.cc | 6 +--
|
|
||||||
ui/platform_window/platform_window.h | 15 +++---
|
|
||||||
ui/platform_window/x11/x11_window.cc | 49 ++++++-------------
|
|
||||||
ui/platform_window/x11/x11_window.h | 6 +--
|
|
||||||
13 files changed, 64 insertions(+), 97 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc
|
|
||||||
index 6682ccc67a..9d832d6e16 100644
|
|
||||||
--- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc
|
|
||||||
+++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc
|
|
||||||
@@ -170,14 +170,15 @@ void BrowserDesktopWindowTreeHostLinux::UpdateFrameHints() {
|
|
||||||
if (SupportsClientFrameShadow()) {
|
|
||||||
// Set the frame decoration insets.
|
|
||||||
auto insets = layout->MirroredFrameBorderInsets();
|
|
||||||
- auto insets_px = gfx::ScaleToCeiledInsets(insets, scale);
|
|
||||||
- window->SetDecorationInsets(showing_frame ? &insets_px : nullptr);
|
|
||||||
+ window->SetDecorationInsets(showing_frame
|
|
||||||
+ ? gfx::ScaleToCeiledInsets(insets, scale)
|
|
||||||
+ : gfx::Insets());
|
|
||||||
|
|
||||||
// Set the input region.
|
|
||||||
gfx::Rect input_bounds(widget_size);
|
|
||||||
- input_bounds.Inset(insets + layout->GetInputInsets());
|
|
||||||
- input_bounds = gfx::ScaleToEnclosingRect(input_bounds, scale);
|
|
||||||
- window->SetInputRegion(showing_frame ? &input_bounds : nullptr);
|
|
||||||
+ if (showing_frame)
|
|
||||||
+ input_bounds.Inset(insets + layout->GetInputInsets());
|
|
||||||
+ window->SetInputRegion(gfx::ScaleToEnclosingRect(input_bounds, scale));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->IsTranslucentWindowOpacitySupported()) {
|
|
||||||
@@ -223,9 +224,11 @@ void BrowserDesktopWindowTreeHostLinux::UpdateFrameHints() {
|
|
||||||
std::vector<gfx::Rect> opaque_region;
|
|
||||||
for (SkRegion::Iterator i(region); !i.done(); i.next())
|
|
||||||
opaque_region.push_back(gfx::SkIRectToRect(i.rect()));
|
|
||||||
- window->SetOpaqueRegion(&opaque_region);
|
|
||||||
+ window->SetOpaqueRegion(opaque_region);
|
|
||||||
} else {
|
|
||||||
- window->SetOpaqueRegion(nullptr);
|
|
||||||
+ gfx::RectF opaque_bounds((gfx::Rect(widget_size)));
|
|
||||||
+ opaque_bounds.Scale(scale);
|
|
||||||
+ window->SetOpaqueRegion({gfx::ToEnclosedRect(opaque_bounds)});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/ui/ozone/platform/wayland/host/wayland_subsurface.cc b/ui/ozone/platform/wayland/host/wayland_subsurface.cc
|
|
||||||
index ffe92a91ce..257a348d54 100644
|
|
||||||
--- a/ui/ozone/platform/wayland/host/wayland_subsurface.cc
|
|
||||||
+++ b/ui/ozone/platform/wayland/host/wayland_subsurface.cc
|
|
||||||
@@ -70,8 +70,7 @@ bool WaylandSubsurface::IsVisible() const {
|
|
||||||
void WaylandSubsurface::UpdateOpaqueRegion() {
|
|
||||||
gfx::Rect region_px =
|
|
||||||
enable_blend_ ? gfx::Rect() : gfx::Rect(bounds_px_.size());
|
|
||||||
- std::vector<gfx::Rect> region{region_px};
|
|
||||||
- wayland_surface()->SetOpaqueRegion(®ion);
|
|
||||||
+ wayland_surface()->SetOpaqueRegion({region_px});
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaylandSubsurface::SetBounds(const gfx::Rect& bounds) {
|
|
||||||
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.cc b/ui/ozone/platform/wayland/host/wayland_surface.cc
|
|
||||||
index 89668e1c1d..a056214dfd 100644
|
|
||||||
--- a/ui/ozone/platform/wayland/host/wayland_surface.cc
|
|
||||||
+++ b/ui/ozone/platform/wayland/host/wayland_surface.cc
|
|
||||||
@@ -217,20 +217,19 @@ void WaylandSurface::SetSurfaceBufferScale(int32_t scale) {
|
|
||||||
connection_->ScheduleFlush();
|
|
||||||
}
|
|
||||||
|
|
||||||
-void WaylandSurface::SetOpaqueRegion(const std::vector<gfx::Rect>* region_px) {
|
|
||||||
+void WaylandSurface::SetOpaqueRegion(const std::vector<gfx::Rect>& region_px) {
|
|
||||||
// It's important to set opaque region for opaque windows (provides
|
|
||||||
// optimization hint for the Wayland compositor).
|
|
||||||
if (!root_window_ || !root_window_->IsOpaqueWindow())
|
|
||||||
return;
|
|
||||||
|
|
||||||
- wl_surface_set_opaque_region(
|
|
||||||
- surface_.get(),
|
|
||||||
- region_px ? CreateAndAddRegion(*region_px).get() : nullptr);
|
|
||||||
+ wl_surface_set_opaque_region(surface_.get(),
|
|
||||||
+ CreateAndAddRegion(region_px).get());
|
|
||||||
|
|
||||||
connection_->ScheduleFlush();
|
|
||||||
}
|
|
||||||
|
|
||||||
-void WaylandSurface::SetInputRegion(const gfx::Rect* region_px) {
|
|
||||||
+void WaylandSurface::SetInputRegion(const gfx::Rect& region_px) {
|
|
||||||
// Don't set input region when use_native_frame is enabled.
|
|
||||||
if (!root_window_ || root_window_->ShouldUseNativeFrame())
|
|
||||||
return;
|
|
||||||
@@ -238,9 +237,8 @@ void WaylandSurface::SetInputRegion(const gfx::Rect* region_px) {
|
|
||||||
// Sets input region for input events to allow go through and
|
|
||||||
// for the compositor to ignore the parts of the input region that fall
|
|
||||||
// outside of the surface.
|
|
||||||
- wl_surface_set_input_region(
|
|
||||||
- surface_.get(),
|
|
||||||
- region_px ? CreateAndAddRegion({*region_px}).get() : nullptr);
|
|
||||||
+ wl_surface_set_input_region(surface_.get(),
|
|
||||||
+ CreateAndAddRegion({region_px}).get());
|
|
||||||
|
|
||||||
connection_->ScheduleFlush();
|
|
||||||
}
|
|
||||||
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.h b/ui/ozone/platform/wayland/host/wayland_surface.h
|
|
||||||
index b6aad67b46..41957a7959 100644
|
|
||||||
--- a/ui/ozone/platform/wayland/host/wayland_surface.h
|
|
||||||
+++ b/ui/ozone/platform/wayland/host/wayland_surface.h
|
|
||||||
@@ -94,16 +94,15 @@ class WaylandSurface {
|
|
||||||
// Sets the region that is opaque on this surface in physical pixels. This is
|
|
||||||
// expected to be called whenever the region that the surface span changes or
|
|
||||||
// the opacity changes. Rects in |region_px| are specified surface-local, in
|
|
||||||
- // physical pixels. If |region_px| is nullptr, the opaque region is reset.
|
|
||||||
- void SetOpaqueRegion(const std::vector<gfx::Rect>* region_px);
|
|
||||||
+ // physical pixels.
|
|
||||||
+ void SetOpaqueRegion(const std::vector<gfx::Rect>& region_px);
|
|
||||||
|
|
||||||
// Sets the input region on this surface in physical pixels.
|
|
||||||
// The input region indicates which parts of the surface accept pointer and
|
|
||||||
// touch input events. This is expected to be called from ToplevelWindow
|
|
||||||
// whenever the region that the surface span changes or window state changes
|
|
||||||
- // when custom frame is used. If |region_px| is nullptr, the input region is
|
|
||||||
- // reset.
|
|
||||||
- void SetInputRegion(const gfx::Rect* region_px);
|
|
||||||
+ // when custom frame is used.
|
|
||||||
+ void SetInputRegion(const gfx::Rect& region_px);
|
|
||||||
|
|
||||||
// Set the source rectangle of the associated wl_surface.
|
|
||||||
// See:
|
|
||||||
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
|
|
||||||
index 1bb816c359..4b930d4105 100644
|
|
||||||
--- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
|
|
||||||
+++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
|
|
||||||
@@ -263,16 +263,12 @@ bool WaylandToplevelWindow::CanSetDecorationInsets() const {
|
|
||||||
->SupportsSetWindowGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
-void WaylandToplevelWindow::SetOpaqueRegion(
|
|
||||||
- const std::vector<gfx::Rect>* region_px) {
|
|
||||||
+void WaylandToplevelWindow::SetOpaqueRegion(std::vector<gfx::Rect> region_px) {
|
|
||||||
root_surface()->SetOpaqueRegion(region_px);
|
|
||||||
}
|
|
||||||
|
|
||||||
-void WaylandToplevelWindow::SetInputRegion(const gfx::Rect* region_px) {
|
|
||||||
- if (region_px)
|
|
||||||
- input_region_px_ = *region_px;
|
|
||||||
- else
|
|
||||||
- input_region_px_ = absl::nullopt;
|
|
||||||
+void WaylandToplevelWindow::SetInputRegion(gfx::Rect region_px) {
|
|
||||||
+ input_region_px_ = region_px;
|
|
||||||
root_surface()->SetInputRegion(region_px);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -849,9 +845,8 @@ void WaylandToplevelWindow::UpdateWindowMask() {
|
|
||||||
// TODO(http://crbug.com/1158733): When supporting PlatformWindow::SetShape,
|
|
||||||
// update window region with the given |shape|.
|
|
||||||
WaylandWindow::UpdateWindowMask();
|
|
||||||
- gfx::Rect region(visual_size_px());
|
|
||||||
- root_surface()->SetInputRegion(input_region_px_ ? &*input_region_px_
|
|
||||||
- : ®ion);
|
|
||||||
+ root_surface()->SetInputRegion(
|
|
||||||
+ input_region_px_ ? *input_region_px_ : gfx::Rect(visual_size_px()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaylandToplevelWindow::UpdateWindowShape() {
|
|
||||||
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
|
|
||||||
index 83c1e15278..d745e99c4a 100644
|
|
||||||
--- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
|
|
||||||
+++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
|
|
||||||
@@ -65,8 +65,8 @@ class WaylandToplevelWindow : public WaylandWindow,
|
|
||||||
bool ShouldUseNativeFrame() const override;
|
|
||||||
bool ShouldUpdateWindowShape() const override;
|
|
||||||
bool CanSetDecorationInsets() const override;
|
|
||||||
- void SetOpaqueRegion(const std::vector<gfx::Rect>* region_px) override;
|
|
||||||
- void SetInputRegion(const gfx::Rect* region_px) override;
|
|
||||||
+ void SetOpaqueRegion(std::vector<gfx::Rect> region_px) override;
|
|
||||||
+ void SetInputRegion(gfx::Rect region_px) override;
|
|
||||||
void SetAspectRatio(const gfx::SizeF& aspect_ratio) override;
|
|
||||||
|
|
||||||
// WaylandWindow overrides:
|
|
||||||
diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc
|
|
||||||
index ccc3138d34..7e0dabf9c7 100644
|
|
||||||
--- a/ui/ozone/platform/wayland/host/wayland_window.cc
|
|
||||||
+++ b/ui/ozone/platform/wayland/host/wayland_window.cc
|
|
||||||
@@ -375,15 +375,10 @@ bool WaylandWindow::IsTranslucentWindowOpacitySupported() const {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
-void WaylandWindow::SetDecorationInsets(const gfx::Insets* insets_px) {
|
|
||||||
- if ((!frame_insets_px_ && !insets_px) ||
|
|
||||||
- (frame_insets_px_ && insets_px && *frame_insets_px_ == *insets_px)) {
|
|
||||||
+void WaylandWindow::SetDecorationInsets(gfx::Insets insets_px) {
|
|
||||||
+ if (frame_insets_px_ == insets_px)
|
|
||||||
return;
|
|
||||||
- }
|
|
||||||
- if (insets_px)
|
|
||||||
- frame_insets_px_ = *insets_px;
|
|
||||||
- else
|
|
||||||
- frame_insets_px_ = absl::nullopt;
|
|
||||||
+ frame_insets_px_ = insets_px;
|
|
||||||
SetWindowGeometry(gfx::ScaleToRoundedRect(GetBounds(), 1.f / window_scale()));
|
|
||||||
connection()->ScheduleFlush();
|
|
||||||
}
|
|
||||||
@@ -486,8 +481,7 @@ absl::optional<std::vector<gfx::Rect>> WaylandWindow::GetWindowShape() const {
|
|
||||||
|
|
||||||
void WaylandWindow::UpdateWindowMask() {
|
|
||||||
UpdateWindowShape();
|
|
||||||
- std::vector<gfx::Rect> region{gfx::Rect{visual_size_px()}};
|
|
||||||
- root_surface_->SetOpaqueRegion(®ion);
|
|
||||||
+ root_surface_->SetOpaqueRegion({gfx::Rect(visual_size_px())});
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaylandWindow::UpdateWindowShape() {}
|
|
||||||
@@ -588,8 +582,7 @@ bool WaylandWindow::Initialize(PlatformWindowInitProperties properties) {
|
|
||||||
PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
|
||||||
delegate_->OnAcceleratedWidgetAvailable(GetWidget());
|
|
||||||
|
|
||||||
- std::vector<gfx::Rect> region{gfx::Rect{bounds_px_.size()}};
|
|
||||||
- root_surface_->SetOpaqueRegion(®ion);
|
|
||||||
+ root_surface_->SetOpaqueRegion({gfx::Rect(bounds_px_.size())});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
diff --git a/ui/ozone/platform/wayland/host/wayland_window.h b/ui/ozone/platform/wayland/host/wayland_window.h
|
|
||||||
index 9b5caa4f58..c43759ac93 100644
|
|
||||||
--- a/ui/ozone/platform/wayland/host/wayland_window.h
|
|
||||||
+++ b/ui/ozone/platform/wayland/host/wayland_window.h
|
|
||||||
@@ -175,7 +175,7 @@ class WaylandWindow : public PlatformWindow,
|
|
||||||
bool ShouldWindowContentsBeTransparent() const override;
|
|
||||||
void SetAspectRatio(const gfx::SizeF& aspect_ratio) override;
|
|
||||||
bool IsTranslucentWindowOpacitySupported() const override;
|
|
||||||
- void SetDecorationInsets(const gfx::Insets* insets_px) override;
|
|
||||||
+ void SetDecorationInsets(gfx::Insets insets_px) override;
|
|
||||||
void SetWindowIcons(const gfx::ImageSkia& window_icon,
|
|
||||||
const gfx::ImageSkia& app_icon) override;
|
|
||||||
void SizeConstraintsChanged() override;
|
|
||||||
diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
|
|
||||||
index 9d0740967f..a2441b035f 100644
|
|
||||||
--- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
|
|
||||||
+++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
|
|
||||||
@@ -347,7 +347,7 @@ TEST_P(WaylandWindowTest, SetDecorationInsets) {
|
|
||||||
SetWindowGeometry(bounds_with_insets.x(), bounds_with_insets.y(),
|
|
||||||
bounds_with_insets.width(),
|
|
||||||
bounds_with_insets.height()));
|
|
||||||
- window_->SetDecorationInsets(&kDecorationInsets);
|
|
||||||
+ window_->SetDecorationInsets(kDecorationInsets);
|
|
||||||
|
|
||||||
Sync();
|
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ TEST_P(WaylandWindowTest, SetDecorationInsets) {
|
|
||||||
SetWindowGeometry(bounds_with_insets.x(), bounds_with_insets.y(),
|
|
||||||
bounds_with_insets.width(),
|
|
||||||
bounds_with_insets.height()));
|
|
||||||
- window_->SetDecorationInsets(&kDecorationInsets_2x);
|
|
||||||
+ window_->SetDecorationInsets(kDecorationInsets_2x);
|
|
||||||
|
|
||||||
Sync();
|
|
||||||
|
|
||||||
diff --git a/ui/platform_window/platform_window.cc b/ui/platform_window/platform_window.cc
|
|
||||||
index 4aaf6e4737..804b191e72 100644
|
|
||||||
--- a/ui/platform_window/platform_window.cc
|
|
||||||
+++ b/ui/platform_window/platform_window.cc
|
|
||||||
@@ -63,10 +63,10 @@ bool PlatformWindow::CanSetDecorationInsets() const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
-void PlatformWindow::SetDecorationInsets(const gfx::Insets* insets_px) {}
|
|
||||||
+void PlatformWindow::SetDecorationInsets(gfx::Insets insets_px) {}
|
|
||||||
|
|
||||||
-void PlatformWindow::SetOpaqueRegion(const std::vector<gfx::Rect>* region_px) {}
|
|
||||||
+void PlatformWindow::SetOpaqueRegion(std::vector<gfx::Rect> region_px) {}
|
|
||||||
|
|
||||||
-void PlatformWindow::SetInputRegion(const gfx::Rect* region_px) {}
|
|
||||||
+void PlatformWindow::SetInputRegion(gfx::Rect region_px) {}
|
|
||||||
|
|
||||||
} // namespace ui
|
|
||||||
diff --git a/ui/platform_window/platform_window.h b/ui/platform_window/platform_window.h
|
|
||||||
index ffd9c68bc3..cc15ca7e19 100644
|
|
||||||
--- a/ui/platform_window/platform_window.h
|
|
||||||
+++ b/ui/platform_window/platform_window.h
|
|
||||||
@@ -167,20 +167,17 @@ class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindow
|
|
||||||
|
|
||||||
// Lets the WM know which portion of the window is the frame decoration. The
|
|
||||||
// WM may use this to eg. snap windows to each other starting where the window
|
|
||||||
- // begins rather than starting where the shadow begins. If |insets_px| is
|
|
||||||
- // nullptr, then any existing insets will be reset.
|
|
||||||
- virtual void SetDecorationInsets(const gfx::Insets* insets_px);
|
|
||||||
+ // begins rather than starting where the shadow begins.
|
|
||||||
+ virtual void SetDecorationInsets(gfx::Insets insets_px);
|
|
||||||
|
|
||||||
// Sets a hint for the compositor so it can avoid unnecessarily redrawing
|
|
||||||
- // occluded portions of windows. If |region_px| is nullptr, then any existing
|
|
||||||
- // region will be reset.
|
|
||||||
- virtual void SetOpaqueRegion(const std::vector<gfx::Rect>* region_px);
|
|
||||||
+ // occluded portions of windows.
|
|
||||||
+ virtual void SetOpaqueRegion(std::vector<gfx::Rect> region_px);
|
|
||||||
|
|
||||||
// Sets the clickable region of a window. This is useful for trimming down a
|
|
||||||
// potentially large (24px) hit area for window resizing on the window shadow
|
|
||||||
- // to a more reasonable (10px) area. If |region_px| is nullptr, then any
|
|
||||||
- // existing region will be reset.
|
|
||||||
- virtual void SetInputRegion(const gfx::Rect* region_px);
|
|
||||||
+ // to a more reasonable (10px) area.
|
|
||||||
+ virtual void SetInputRegion(gfx::Rect region_px);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ui
|
|
||||||
diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc
|
|
||||||
index 30a1e53896..030c1e3c4a 100644
|
|
||||||
--- a/ui/platform_window/x11/x11_window.cc
|
|
||||||
+++ b/ui/platform_window/x11/x11_window.cc
|
|
||||||
@@ -1010,54 +1010,37 @@ bool X11Window::CanSetDecorationInsets() const {
|
|
||||||
return ui::WmSupportsHint(x11::GetAtom("_GTK_FRAME_EXTENTS"));
|
|
||||||
}
|
|
||||||
|
|
||||||
-void X11Window::SetDecorationInsets(const gfx::Insets* insets_px) {
|
|
||||||
- auto atom = x11::GetAtom("_GTK_FRAME_EXTENTS");
|
|
||||||
- if (!insets_px) {
|
|
||||||
- x11::DeleteProperty(xwindow_, atom);
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
- std::vector<uint32_t> extents{static_cast<uint32_t>(insets_px->left()),
|
|
||||||
- static_cast<uint32_t>(insets_px->right()),
|
|
||||||
- static_cast<uint32_t>(insets_px->top()),
|
|
||||||
- static_cast<uint32_t>(insets_px->bottom())};
|
|
||||||
- x11::SetArrayProperty(xwindow_, atom, x11::Atom::CARDINAL, extents);
|
|
||||||
+void X11Window::SetDecorationInsets(gfx::Insets insets_px) {
|
|
||||||
+ std::vector<uint32_t> extents{static_cast<uint32_t>(insets_px.left()),
|
|
||||||
+ static_cast<uint32_t>(insets_px.right()),
|
|
||||||
+ static_cast<uint32_t>(insets_px.top()),
|
|
||||||
+ static_cast<uint32_t>(insets_px.bottom())};
|
|
||||||
+ x11::SetArrayProperty(xwindow_, x11::GetAtom("_GTK_FRAME_EXTENTS"),
|
|
||||||
+ x11::Atom::CARDINAL, extents);
|
|
||||||
}
|
|
||||||
|
|
||||||
-void X11Window::SetOpaqueRegion(const std::vector<gfx::Rect>* region_px) {
|
|
||||||
- auto atom = x11::GetAtom("_NET_WM_OPAQUE_REGION");
|
|
||||||
- if (!region_px) {
|
|
||||||
- x11::DeleteProperty(xwindow_, atom);
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
+void X11Window::SetOpaqueRegion(std::vector<gfx::Rect> region_px) {
|
|
||||||
std::vector<uint32_t> value;
|
|
||||||
- for (const auto& rect : *region_px) {
|
|
||||||
+ for (const auto& rect : region_px) {
|
|
||||||
value.push_back(rect.x());
|
|
||||||
value.push_back(rect.y());
|
|
||||||
value.push_back(rect.width());
|
|
||||||
value.push_back(rect.height());
|
|
||||||
}
|
|
||||||
- x11::SetArrayProperty(xwindow_, atom, x11::Atom::CARDINAL, value);
|
|
||||||
+ x11::SetArrayProperty(xwindow_, x11::GetAtom("_NET_WM_OPAQUE_REGION"),
|
|
||||||
+ x11::Atom::CARDINAL, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
-void X11Window::SetInputRegion(const gfx::Rect* region_px) {
|
|
||||||
- if (!region_px) {
|
|
||||||
- // Reset the input region.
|
|
||||||
- connection_->shape().Mask({
|
|
||||||
- .operation = x11::Shape::So::Set,
|
|
||||||
- .destination_kind = x11::Shape::Sk::Input,
|
|
||||||
- .destination_window = xwindow_,
|
|
||||||
- });
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
+void X11Window::SetInputRegion(gfx::Rect region_px) {
|
|
||||||
connection_->shape().Rectangles(x11::Shape::RectanglesRequest{
|
|
||||||
.operation = x11::Shape::So::Set,
|
|
||||||
.destination_kind = x11::Shape::Sk::Input,
|
|
||||||
.ordering = x11::ClipOrdering::YXBanded,
|
|
||||||
.destination_window = xwindow_,
|
|
||||||
- .rectangles = {{static_cast<int16_t>(region_px->x()),
|
|
||||||
- static_cast<int16_t>(region_px->y()),
|
|
||||||
- static_cast<uint16_t>(region_px->width()),
|
|
||||||
- static_cast<uint16_t>(region_px->height())}},
|
|
||||||
+ .rectangles = {{static_cast<int16_t>(region_px.x()),
|
|
||||||
+ static_cast<int16_t>(region_px.y()),
|
|
||||||
+ static_cast<uint16_t>(region_px.width()),
|
|
||||||
+ static_cast<uint16_t>(region_px.height())}},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/ui/platform_window/x11/x11_window.h b/ui/platform_window/x11/x11_window.h
|
|
||||||
index a7aa79335f..20ad58712e 100644
|
|
||||||
--- a/ui/platform_window/x11/x11_window.h
|
|
||||||
+++ b/ui/platform_window/x11/x11_window.h
|
|
||||||
@@ -110,9 +110,9 @@ class X11_WINDOW_EXPORT X11Window : public PlatformWindow,
|
|
||||||
bool IsTranslucentWindowOpacitySupported() const override;
|
|
||||||
void SetOpacity(float opacity) override;
|
|
||||||
bool CanSetDecorationInsets() const override;
|
|
||||||
- void SetDecorationInsets(const gfx::Insets* insets_px) override;
|
|
||||||
- void SetOpaqueRegion(const std::vector<gfx::Rect>* region_px) override;
|
|
||||||
- void SetInputRegion(const gfx::Rect* region_px) override;
|
|
||||||
+ void SetDecorationInsets(gfx::Insets insets_px) override;
|
|
||||||
+ void SetOpaqueRegion(std::vector<gfx::Rect> region_px) override;
|
|
||||||
+ void SetInputRegion(gfx::Rect region_px) override;
|
|
||||||
|
|
||||||
// WorkspaceExtension:
|
|
||||||
std::string GetWorkspace() const override;
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
53
245e71ae8de3f4b5f3478739be819981bb12dfab.patch
Normal file
53
245e71ae8de3f4b5f3478739be819981bb12dfab.patch
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
From 245e71ae8de3f4b5f3478739be819981bb12dfab Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexander Dunaev <adunaev@igalia.com>
|
||||||
|
Date: Sat, 13 Nov 2021 06:35:35 +0000
|
||||||
|
Subject: [PATCH] [linux/xfce] Introduced a hack for Xfwm.
|
||||||
|
|
||||||
|
This proposes an alternative to [1]. Either this patch or that one
|
||||||
|
should be landed, but not both. See the linked crbug for the details.
|
||||||
|
|
||||||
|
Setting the frame extents via the _GTK_FRAME_EXTENTS property turned out
|
||||||
|
to be problematic at Xfwm. While the issue is agreed to be a bug in the
|
||||||
|
window manager, for now we disable setting the frame extents on that WM.
|
||||||
|
|
||||||
|
This patch introduces a logic that disables setting the window property
|
||||||
|
on Xfwm.
|
||||||
|
|
||||||
|
[1] https://chromium-review.googlesource.com/c/chromium/src/+/3275653
|
||||||
|
|
||||||
|
Bug: 1260821
|
||||||
|
Change-Id: I4b734ac0dc2b97d7ed6b1842564a33ec6e4b4035
|
||||||
|
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3275272
|
||||||
|
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
|
||||||
|
Commit-Queue: Alexander Dunaev <adunaev@igalia.com>
|
||||||
|
Cr-Commit-Position: refs/heads/main@{#941444}
|
||||||
|
---
|
||||||
|
ui/platform_window/x11/x11_window.cc | 15 +++++++++++++++
|
||||||
|
1 file changed, 15 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc
|
||||||
|
index 2b2083553c59c..4fa2992394329 100644
|
||||||
|
--- a/ui/platform_window/x11/x11_window.cc
|
||||||
|
+++ b/ui/platform_window/x11/x11_window.cc
|
||||||
|
@@ -1016,6 +1016,21 @@ void X11Window::SetOpacity(float opacity) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool X11Window::CanSetDecorationInsets() const {
|
||||||
|
+ // Xfwm handles _GTK_FRAME_EXTENTS a bit unexpected way. That is a known bug
|
||||||
|
+ // that will be eventually fixed, but for now we have to disable the function
|
||||||
|
+ // for Xfce. The block below should be removed when Xfwm is updated with the
|
||||||
|
+ // fix and is known to work properly.
|
||||||
|
+ // See https://crbug.com/1260821.
|
||||||
|
+ {
|
||||||
|
+ static WindowManagerName wm_name = WM_OTHER;
|
||||||
|
+ static bool checked_for_wm = false;
|
||||||
|
+ if (!checked_for_wm) {
|
||||||
|
+ wm_name = GuessWindowManager();
|
||||||
|
+ checked_for_wm = true;
|
||||||
|
+ }
|
||||||
|
+ if (wm_name == WM_XFWM4)
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
return ui::WmSupportsHint(x11::GetAtom("_GTK_FRAME_EXTENTS"));
|
||||||
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
Summary: A fast web browser based on the Blink engine
|
Summary: A fast web browser based on the Blink engine
|
||||||
Name: chromium-browser-stable
|
Name: chromium-browser-stable
|
||||||
Version: 95.0.4638.69
|
Version: 95.0.4638.69
|
||||||
Release: 4
|
Release: 5
|
||||||
License: BSD, LGPL
|
License: BSD, LGPL
|
||||||
Group: Networking/WWW
|
Group: Networking/WWW
|
||||||
Url: https://www.chromium.org/Home
|
Url: https://www.chromium.org/Home
|
||||||
|
@ -128,10 +128,8 @@ Patch649: off-java-check.patch
|
||||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=1260832
|
# https://bugs.chromium.org/p/chromium/issues/detail?id=1260832
|
||||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=1260821
|
# https://bugs.chromium.org/p/chromium/issues/detail?id=1260821
|
||||||
# https://gitlab.xfce.org/xfce/xfwm4/-/issues/603
|
# https://gitlab.xfce.org/xfce/xfwm4/-/issues/603
|
||||||
# This reverts commit https://github.com/chromium/chromium/commit/d6849977d8eb0310ff6e04cece7de5fa250b3a15
|
# https://github.com/chromium/chromium/commit/245e71ae8de3f4b5f3478739be819981bb12dfab
|
||||||
# (backport of https://github.com/chromium/chromium/commit/d45b5992f2a1ce193ee188239a5b723a046ab9e0 to M95)
|
Patch651: 245e71ae8de3f4b5f3478739be819981bb12dfab.patch
|
||||||
# to fix maximizing windows on XFCE and probably break it on Enlightment, but it was broken and is not a regression.
|
|
||||||
Patch651: 0001-Revert-Merge-to-M95-Reland-Reland-X11-Reset-frame-hi.patch
|
|
||||||
|
|
||||||
BuildRequires: bison
|
BuildRequires: bison
|
||||||
BuildRequires: llvm12
|
BuildRequires: llvm12
|
||||||
|
|
Loading…
Add table
Reference in a new issue