Reapply 2 more fixes of window sizing which I deleted earlier

https://bugs.chromium.org/p/chromium/issues/detail?id=1260821#c80
https://bugs.chromium.org/p/chromium/issues/detail?id=1260821#c81
This commit is contained in:
Mikhail Novosyolov 2021-11-13 18:26:02 +03:00
parent 69ee7beee6
commit 3c52975086
3 changed files with 88 additions and 3 deletions

View file

@ -0,0 +1,40 @@
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

@ -0,0 +1,44 @@
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: 5 Release: 6
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,8 +126,9 @@ 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
# https://github.com/chromium/chromium/commit/245e71ae8de3f4b5f3478739be819981bb12dfab Patch651: 314a1e4d19141b60850fc542abab6251c4f119c9.patch
Patch651: 245e71ae8de3f4b5f3478739be819981bb12dfab.patch Patch652: 245e71ae8de3f4b5f3478739be819981bb12dfab.patch
Patch653: 24a90f9327ac1a4d2b6dbb410cd28f65e3e33839.patch
BuildRequires: bison BuildRequires: bison
BuildRequires: llvm12 BuildRequires: llvm12