From 51c53b19be3259f6d51e34058b1503c5fe113bdc Mon Sep 17 00:00:00 2001 From: zhangxingrong Date: Wed, 31 Jul 2024 17:51:10 +0800 Subject: [PATCH] add some upstream patchs --- backport-Add-IS_ALIVE-to-get_property.patch | 29 ++++++++++++ ...cation-check-to-calculate_clear_area.patch | 45 ++++++++++++++++++ ...lized-out-values-on-failed-transform.patch | 44 ++++++++++++++++++ ...as-not-alive-when-pings-are-disabled.patch | 44 ++++++++++++++++++ ...te-focus-appearance-to-all-ancestors.patch | 46 +++++++++++++++++++ mutter.spec | 14 +++++- 6 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 backport-Add-IS_ALIVE-to-get_property.patch create mode 100644 backport-Add-an-allocation-check-to-calculate_clear_area.patch create mode 100644 backport-Do-not-write-uninitialized-out-values-on-failed-transform.patch create mode 100644 backport-Do-not-wrongly-set-window-as-not-alive-when-pings-are-disabled.patch create mode 100644 backport-Propagate-focus-appearance-to-all-ancestors.patch diff --git a/backport-Add-IS_ALIVE-to-get_property.patch b/backport-Add-IS_ALIVE-to-get_property.patch new file mode 100644 index 0000000..2773fa7 --- /dev/null +++ b/backport-Add-IS_ALIVE-to-get_property.patch @@ -0,0 +1,29 @@ +From 558b799998957a31a7c364e1bf0c30903f68c44a Mon Sep 17 00:00:00 2001 +From: Sebastian Keller +Date: Tue, 7 Nov 2023 01:02:55 +0100 +Subject: [PATCH] window: Add IS_ALIVE to get_property + +This was causing looking glass to wrongly claim that is_alive = false +for all windows. + +Part-of: + +(cherry picked from commit 0807579cdd06186c119603836c828e93778e3009) +--- + src/core/window.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/core/window.c b/src/core/window.c +index 09e911ae53..91adc03e98 100644 +--- a/src/core/window.c ++++ b/src/core/window.c +@@ -426,6 +426,9 @@ meta_window_get_property(GObject *object, + case PROP_ON_ALL_WORKSPACES: + g_value_set_boolean (value, win->on_all_workspaces); + break; ++ case PROP_IS_ALIVE: ++ g_value_set_boolean (value, win->is_alive); ++ break; + case PROP_DISPLAY: + g_value_set_object (value, win->display); + break; diff --git a/backport-Add-an-allocation-check-to-calculate_clear_area.patch b/backport-Add-an-allocation-check-to-calculate_clear_area.patch new file mode 100644 index 0000000..c322f6d --- /dev/null +++ b/backport-Add-an-allocation-check-to-calculate_clear_area.patch @@ -0,0 +1,45 @@ +From 140471fd9ca2bff588ba0d5f89ce34857e934c0a Mon Sep 17 00:00:00 2001 +From: Ivan Molodetskikh +Date: Tue, 28 Nov 2023 08:35:50 +0400 +Subject: [PATCH] clutter/pick-stack: Add an allocation check to + calculate_clear_area () + +We might pick an actor that needs relayout. I've seen this happen inside +hiding / unmapping in particular. In this case, calculate_clear_area () +will call clutter_actor_get_abs_allocation_vertices () which in turn +will force a relayout. However, this is not what we want, because: + +1. We don't want to run layout during picking. +2. If the actor needs an allocation, then the pick stack could not have + used an up-to-date allocation, because it is not computed. Therefore + this clear area would use a potentially completely different + allocation than the one stored in the pick stack. + +Thankfully, clear area seems to be used as a cache/optimization, so +let's just avoid computing it if the actor is not allocated. + +Part-of: + +(cherry picked from commit edbc9a20863fd226e377787f4e75c32d2e359399) +--- + clutter/clutter/clutter-pick-stack.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/clutter/clutter/clutter-pick-stack.c b/clutter/clutter/clutter-pick-stack.c +index e11d2489c0..704b8c4058 100644 +--- a/clutter/clutter/clutter-pick-stack.c ++++ b/clutter/clutter/clutter-pick-stack.c +@@ -462,6 +462,13 @@ calculate_clear_area (ClutterPickStack *pick_stack, + cairo_rectangle_int_t rect; + int i; + ++ if (!clutter_actor_has_allocation (pick_rec->actor)) ++ { ++ if (clear_area) ++ *clear_area = NULL; ++ return; ++ } ++ + clutter_actor_get_abs_allocation_vertices (pick_rec->actor, + (graphene_point3d_t *) &verts); + if (!get_verts_rectangle (verts, &rect)) diff --git a/backport-Do-not-write-uninitialized-out-values-on-failed-transform.patch b/backport-Do-not-write-uninitialized-out-values-on-failed-transform.patch new file mode 100644 index 0000000..cea0719 --- /dev/null +++ b/backport-Do-not-write-uninitialized-out-values-on-failed-transform.patch @@ -0,0 +1,44 @@ +From fa10ce76db0da6ba812badcbfefc007fb08c400c Mon Sep 17 00:00:00 2001 +From: Sebastian Keller +Date: Fri, 15 Dec 2023 00:47:34 +0100 +Subject: [PATCH] clutter/actor: Don't write uninitialized out values on failed + transform + +clutter_actor_get_transformed_position() would write the uninitialized +values of v2 when clutter_actor_apply_transform_to_point() fails in +_clutter_actor_fully_transform_vertices() because the actor has not been +added to the stage yet. + +When called from JS this would overwrite the zero initialized values +passed in from gjs. If the uninitialized values now happen to correspond +to one of the NaN float values used by mozjs to represent a pointer +type, this would lead to seemingly random crashes in mozjs code later +on. + +Avoid this by using _clutter_actor_fully_transform_vertices() directly, +which allows us to check if it failed. + +Related: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/469 +Related: https://gitlab.gnome.org/GNOME/gjs/-/issues/591 +Part-of: + +(cherry picked from commit c86d8a23c3464f75b976af915f0926b5dfc10241) +--- + clutter/clutter/clutter-actor.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c +index cac1da4dee..0e87cc8734 100644 +--- a/clutter/clutter/clutter-actor.c ++++ b/clutter/clutter/clutter-actor.c +@@ -9668,7 +9668,9 @@ clutter_actor_get_transformed_position (ClutterActor *self, + graphene_point3d_t v2; + + v1.x = v1.y = v1.z = 0; +- clutter_actor_apply_transform_to_point (self, &v1, &v2); ++ ++ if (!_clutter_actor_fully_transform_vertices (self, &v1, &v2, 1)) ++ return; + + if (x) + *x = v2.x; diff --git a/backport-Do-not-wrongly-set-window-as-not-alive-when-pings-are-disabled.patch b/backport-Do-not-wrongly-set-window-as-not-alive-when-pings-are-disabled.patch new file mode 100644 index 0000000..804d60f --- /dev/null +++ b/backport-Do-not-wrongly-set-window-as-not-alive-when-pings-are-disabled.patch @@ -0,0 +1,44 @@ +From eee5eab85b54c5337dc7a2940fdda922655c49a7 Mon Sep 17 00:00:00 2001 +From: Sebastian Keller +Date: Tue, 7 Nov 2023 00:23:19 +0100 +Subject: [PATCH] delete: Don't wrongly set window as not alive when pings are + disabled + +meta_display_ping_window() does nothing when check-alive-timeout is set +to 0, but meta_window_check_alive_on_event() was relying on it to reset +the events_during_ping. Without this events_during_ping was just +counting up until the threshold was reached and the window was marked as +not alive, preventing further pointer events from being sent to the +window. + +Fix this by not doing anything in meta_window_check_alive_on_event() if +check-alive-timeout is 0, similar to meta_display_ping_window(). + +Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3142 +Part-of: + +(cherry picked from commit d978ab189012317f64dbc8f519393bb1456d9ba5) +--- + src/core/delete.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/core/delete.c b/src/core/delete.c +index 1270ea0899..888bf18620 100644 +--- a/src/core/delete.c ++++ b/src/core/delete.c +@@ -96,9 +96,15 @@ void + meta_window_check_alive_on_event (MetaWindow *window, + uint32_t timestamp) + { ++ unsigned int check_alive_timeout; ++ + if (!meta_window_can_ping (window)) + return; + ++ check_alive_timeout = meta_prefs_get_check_alive_timeout (); ++ if (check_alive_timeout == 0) ++ return; ++ + meta_display_ping_window (window, timestamp); + + window->events_during_ping++; diff --git a/backport-Propagate-focus-appearance-to-all-ancestors.patch b/backport-Propagate-focus-appearance-to-all-ancestors.patch new file mode 100644 index 0000000..eb79bc3 --- /dev/null +++ b/backport-Propagate-focus-appearance-to-all-ancestors.patch @@ -0,0 +1,46 @@ +From 18640069a418377a420f752b17e4883cb2cca22c Mon Sep 17 00:00:00 2001 +From: Sebastian Wick +Date: Mon, 30 Oct 2023 13:57:17 +0100 +Subject: [PATCH] core/window: Propagate focus appearance to all ancestors + +The loop in meta_window_propagate_focus_appearance breaks if any +ancestor has attached_focus_window == focus_window but further ancestors +might still have a different attached_focus_window. + +Continue the loop until the root ancestor instead. + +Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2913 +Part-of: + +(cherry picked from commit 4e088cac0e64f58967cca2365287f1edf2680128) +--- + src/core/window.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/src/core/window.c b/src/core/window.c +index 91adc03e98..80b47fe754 100644 +--- a/src/core/window.c ++++ b/src/core/window.c +@@ -5178,19 +5178,15 @@ meta_window_propagate_focus_appearance (MetaWindow *window, + parent = meta_window_get_transient_for (child); + while (parent && (!focused || should_propagate_focus_appearance (child))) + { +- gboolean child_focus_state_changed; ++ gboolean child_focus_state_changed = FALSE; + +- if (focused) ++ if (focused && parent->attached_focus_window != focus_window) + { +- if (parent->attached_focus_window == focus_window) +- break; + child_focus_state_changed = (parent->attached_focus_window == NULL); + parent->attached_focus_window = focus_window; + } +- else ++ else if (parent->attached_focus_window == focus_window) + { +- if (parent->attached_focus_window != focus_window) +- break; + child_focus_state_changed = (parent->attached_focus_window != NULL); + parent->attached_focus_window = NULL; + } diff --git a/mutter.spec b/mutter.spec index c7449fb..83900c2 100644 --- a/mutter.spec +++ b/mutter.spec @@ -10,7 +10,7 @@ Name: mutter Version: 44.6 -Release: 3 +Release: 4 Summary: Window and compositing manager based on Clutter License: GPLv2+ URL: https://www.gnome.org @@ -18,6 +18,11 @@ Source0: https://download.gnome.org/sources/%{name}/44/%{name}-%{version}. Patch0: 0001-window-actor-Special-case-shaped-Java-windows.patch Patch1: mutter-42.alpha-disable-tegra.patch +Patch2: backport-Do-not-wrongly-set-window-as-not-alive-when-pings-are-disabled.patch +Patch3: backport-Add-IS_ALIVE-to-get_property.patch +Patch4: backport-Propagate-focus-appearance-to-all-ancestors.patch +Patch5: backport-Do-not-write-uninitialized-out-values-on-failed-transform.patch +Patch6: backport-Add-an-allocation-check-to-calculate_clear_area.patch BuildRequires: meson pam-devel zenity sysprof-devel gtk-doc gettext-devel git-core BuildRequires: xorg-x11-server-Xorg xorg-x11-server-Xvfb desktop-file-utils @@ -151,6 +156,13 @@ echo "/usr/lib64/mutter-12" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.con %{_mandir}/man1/*.1.gz %changelog +* Wed Jul 31 2024 zhangxingrong - 44.6-4 +- delete: Don't wrongly set window as not alive when pings are disabled +- window: Add IS_ALIVE to get_property +- core/window: Propagate focus appearance to all ancestors +- clutter/actor: Don't write uninitialized out values on failed transform +- clutter/pick-stack: Add an allocation check to calculate_clear_area () + * Fri Apr 19 2024 liyanan - 44.6-3 - Fix libmutter-clutter-12.so.0 cannot be loaded -- Gitee