Revert change that broke window sizing on XFCE

https://bugs.chromium.org/p/chromium/issues/detail?id=1260821
This commit is contained in:
Mikhail Novosyolov 2021-11-09 18:22:37 +03:00
parent 59a4d58594
commit 6dfdffc81d
4 changed files with 429 additions and 88 deletions

View file

@ -0,0 +1,422 @@
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(&region);
+ 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_
- : &region);
+ 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(&region);
+ 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(&region);
+ 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

View file

@ -1,40 +0,0 @@
From 24a90f9327ac1a4d2b6dbb410cd28f65e3e33839 Mon Sep 17 00:00:00 2001
From: Alexander Dunaev <adunaev@igalia.com>
Date: Mon, 1 Nov 2021 19:29:27 +0000
Subject: [PATCH] [linux/xfce] Set zero insets on maximising the window.
It turned out that Xfwm handles the frame insets not the way KWin and
Mutter do, which causes wrong window size when it is maximised (see the
linked crbug).
This patch resets the frame insets to zero when the window is maximised,
which fixes the behaviour on Xfwm.
Bug: 1260821
Change-Id: I69e71049157c03b74d78bc5edb7a60bf39cdda8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3250747
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#936990}
---
ui/platform_window/x11/x11_window.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc
index 017ff15a0af1b..dd416c031e7c1 100644
--- a/ui/platform_window/x11/x11_window.cc
+++ b/ui/platform_window/x11/x11_window.cc
@@ -675,6 +675,13 @@ void X11Window::Maximize() {
// save this one for later too.
should_maximize_after_map_ = !window_mapped_in_client_;
+ // Some WMs keep respecting the frame extents even if the window is maximised.
+ // Remove the insets when maximising. The extents will be set again when the
+ // window is restored to normal state.
+ // See https://crbug.com/1260821
+ if (CanSetDecorationInsets())
+ SetDecorationInsets(nullptr);
+
SetWMSpecState(true, x11::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
x11::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
}

View file

@ -1,44 +0,0 @@
From 314a1e4d19141b60850fc542abab6251c4f119c9 Mon Sep 17 00:00:00 2001
From: Alexander Dunaev <adunaev@igalia.com>
Date: Wed, 27 Oct 2021 03:27:25 +0000
Subject: [PATCH] [linux/x11] Made the hidden window ignoring new properties.
It turned out that the window manager can withdraw certain window
properties when the client unmaps the window (e. g., KWin resets the
maximised state), which in certain scenarios (see the linked crbug) may
cause the window to get incorrect state after restart.
At the same time, changing the properties when the window is hidden does
not seem to make a lot of sense. If the window is hidden before being
destroyed, accepting new properties makes no sense at all, and if it is
going to be shown again later, it may/should be configured upon showing.
This patch adds a condition that ignores new properties for hidden
windows.
Bug: 1260832
Change-Id: I46cf7b8b26f166591081410a462fc31c758c0529
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3245090
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Alexander Dunaev <adunaev@igalia.com>
Cr-Commit-Position: refs/heads/main@{#935285}
---
ui/platform_window/x11/x11_window.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc
index dd38174733676..570621a1c6caa 100644
--- a/ui/platform_window/x11/x11_window.cc
+++ b/ui/platform_window/x11/x11_window.cc
@@ -2241,6 +2241,11 @@ void X11Window::OnWMStateUpdated() {
void X11Window::UpdateWindowProperties(
const base::flat_set<x11::Atom>& new_window_properties) {
+ // If the window is hidden, ignore new properties.
+ // See https://crbug.com/1260832
+ if (!window_mapped_in_client_)
+ return;
+
window_properties_ = new_window_properties;
// Ignore requests by the window manager to enter or exit fullscreen (e.g. as

View file

@ -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: 2 Release: 3
License: BSD, LGPL License: BSD, LGPL
Group: Networking/WWW Group: Networking/WWW
Url: https://www.chromium.org/Home Url: https://www.chromium.org/Home
@ -126,9 +126,12 @@ Patch647: ALT-allow-to-override-clang-through-env-variables.patch
Patch648: fix-debugsource.patch Patch648: fix-debugsource.patch
Patch649: off-java-check.patch 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
Patch650: 314a1e4d19141b60850fc542abab6251c4f119c9.patch # https://bugs.chromium.org/p/chromium/issues/detail?id=1260821
# https://bugs.chromium.org/p/chromium/issues/detail?id=1260821 (already backported to 96) # https://gitlab.xfce.org/xfce/xfwm4/-/issues/603
Patch651: 24a90f9327ac1a4d2b6dbb410cd28f65e3e33839.patch # This reverts commit https://github.com/chromium/chromium/commit/d6849977d8eb0310ff6e04cece7de5fa250b3a15
# (backport of https://github.com/chromium/chromium/commit/d45b5992f2a1ce193ee188239a5b723a046ab9e0 to M95)
# 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