[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1032913: unblock: mutter/43.3-5



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: mutter@packages.debian.org
Control: affects -1 + src:mutter

Please unblock package mutter

[ Reason ]
Fix X11 focus regressions (#1031945, possibly others)

[ Impact ]
If not accepted, for users of "GNOME on Xorg", switching keyboard layout
or input method with Super+Space causes windows to lose focus (#1031945).
The default GNOME session (using Wayland) is unaffected.

There might be additional focus weirdness fixed by this. I had hoped that
this would fix the related bug #1032388, but in fact that doesn't seem
to have been the case (and I've opened a separate upstream bug for that).

Additionally, this version expands build-time test coverage, by fixing a
test script that failed on non-merged-/usr systems instead of disabling
it, and updates some patches that were applied upstream to incorporate
minor adjustments made by the upstream maintainer.

[ Tests ]
autopkgtests pass, and the proposed package has been in unstable for a week
without apparent regressions.

[ Risks ]
Highly visible package (part of our default desktop environment), but the
changes are isolated and have been taken from an upstream change in the
GNOME 44 branch, confirmed to resolve similar issues. There have been
no related fixes in the GNOME 44 branch (currently in upstream freeze)
since then; if there are, they'll be backported to the GNOME 43 branch,
either by upstream or in Debian.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

[ Other info ]
The current changelog claims to have fixed #1032388, which was subsequently
reopened. I can do a new upload with the changelog clarified if the release
team would prefer that, but it would need some more age-days.

unblock mutter/43.3-5
diffstat for mutter-43.3 mutter-43.3

 .gitlab-ci/checkout-gnome-shell.sh                                                    |    2 
 .gitlab-ci/download-coverity-tarball.sh                                               |    2 
 debian/changelog                                                                      |   19 ++
 debian/patches/Revert-x11-Do-not-move-X11-input-focus-during-grabs.patch              |   87 ++++++++++
 debian/patches/Revert-x11-events-Do-not-update-focus-XWindow-during-grab.patch        |   36 ++++
 debian/patches/color-device-Don-t-close-lcms-profile-on-error-from-cd_ic.patch        |   13 +
 debian/patches/color-device-Make-sure-lcms_context-is-not-NULL.patch                  |   15 +
 debian/patches/core-Avoid-focusing-windows-on-map-during-grabs.patch                  |   35 ++++
 debian/patches/debian/Mark-xwayland-test-case-as-known-to-be-flaky-on-32-bit-AR.patch |    2 
 debian/patches/debian/tests-Disable-restore-size-test.patch                           |    2 
 debian/patches/debian/tests-Tag-unstable-tests-as-flaky.patch                         |    2 
 debian/patches/series                                                                 |    8 
 debian/patches/tests-Disable-broken-test.patch                                        |   50 -----
 debian/patches/tests-Use-a-more-interoperable-path-to-bash.patch                      |   70 ++++++++
 debian/patches/x11-Ignore-_NET_ACTIVE_WINDOW-client-messages-while-grabb.patch        |   45 +++++
 src/backends/meta-color-device.c                                                      |    2 
 src/core/events.c                                                                     |    4 
 src/core/window.c                                                                     |    9 +
 src/tests/kvm/run-kvm-test.sh                                                         |    2 
 src/tests/kvm/virtme-run.sh                                                           |    2 
 src/tests/meson.build                                                                 |   28 +--
 src/tests/x11-test.sh                                                                 |    2 
 src/x11/events.c                                                                      |    6 
 src/x11/meta-x11-display-private.h                                                    |    2 
 src/x11/meta-x11-display.c                                                            |   20 --
 src/x11/window-x11.c                                                                  |    3 
 26 files changed, 351 insertions(+), 117 deletions(-)

diff -Nru mutter-43.3/debian/changelog mutter-43.3/debian/changelog
--- mutter-43.3/debian/changelog	2023-03-02 08:50:50.000000000 +0000
+++ mutter-43.3/debian/changelog	2023-03-06 11:35:23.000000000 +0000
@@ -1,3 +1,22 @@
+mutter (43.3-5) unstable; urgency=medium
+
+  * Team upload
+  * d/patches: Use the same order in which patches were applied upstream
+  * d/p/color-device-Make-sure-lcms_context-is-not-NULL.patch,
+    d/p/color-device-Don-t-close-lcms-profile-on-error-from-cd_ic.patch:
+    Use final version of these patches as applied upstream
+  * d/p/Revert-x11-Do-not-move-X11-input-focus-during-grabs.patch,
+    d/p/Revert-x11-events-Do-not-update-focus-XWindow-during-grab.patch,
+    d/p/x11-Ignore-_NET_ACTIVE_WINDOW-client-messages-while-grabb.patch,
+    d/p/core-Avoid-focusing-windows-on-map-during-grabs.patch:
+    Backport upstream merge request !2878, fixing X11 focus regressions
+    (Closes: #1032388, #1031945)
+  * d/p/tests-Use-a-more-interoperable-path-to-bash.patch:
+    Fix path to interpreter in x11-test.sh instead of disabling it
+    - d/p/tests-Disable-broken-test.patch: Drop patch, no longer needed
+
+ -- Simon McVittie <smcv@debian.org>  Mon, 06 Mar 2023 11:35:23 +0000
+
 mutter (43.3-4) unstable; urgency=medium
 
   * Team upload
diff -Nru mutter-43.3/debian/patches/color-device-Don-t-close-lcms-profile-on-error-from-cd_ic.patch mutter-43.3/debian/patches/color-device-Don-t-close-lcms-profile-on-error-from-cd_ic.patch
--- mutter-43.3/debian/patches/color-device-Don-t-close-lcms-profile-on-error-from-cd_ic.patch	2023-03-02 08:50:50.000000000 +0000
+++ mutter-43.3/debian/patches/color-device-Don-t-close-lcms-profile-on-error-from-cd_ic.patch	2023-03-06 11:35:23.000000000 +0000
@@ -18,23 +18,28 @@
 the CdIcc, and we must not free it again: that would be a double-free,
 potentially resulting in memory corruption.
 
+(cherry picked from commit ed12df1099d2c9b524c48d989f30c7ce1a8b1459)
+
 Bug: https://gitlab.gnome.org/GNOME/mutter/-/issues/2659
 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1031847
 Signed-off-by: Simon McVittie <smcv@debian.org>
 Forwarded: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2877
+Applied-upstream: 44.rc, commit:ed12df1099d2c9b524c48d989f30c7ce1a8b1459
+Applied-upstream: 43.4, commit:c1133d2f9d6a6a271b0790916470090fbd18f73c
 ---
- src/backends/meta-color-device.c | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
+ src/backends/meta-color-device.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
 
 diff --git a/src/backends/meta-color-device.c b/src/backends/meta-color-device.c
-index ea3b9de..bb87f48 100644
+index 5533a8e..3032d34 100644
 --- a/src/backends/meta-color-device.c
 +++ b/src/backends/meta-color-device.c
-@@ -890,12 +890,9 @@ create_icc_profile_from_edid (MetaColorDevice     *color_device,
+@@ -889,12 +889,10 @@ create_icc_profile_from_edid (MetaColorDevice     *color_device,
    cmsSetHeaderRenderingIntent (lcms_profile, INTENT_PERCEPTUAL);
    cmsSetDeviceClass (lcms_profile, cmsSigDisplayClass);
  
 -  if (!cd_icc_load_handle (cd_icc, lcms_profile,
++  g_warn_if_fail (cmsGetProfileContextID (lcms_profile));
 +  if (!cd_icc_load_handle (cd_icc, g_steal_pointer (&lcms_profile),
                             CD_ICC_LOAD_FLAGS_PRIMARIES, error))
 -    {
diff -Nru mutter-43.3/debian/patches/color-device-Make-sure-lcms_context-is-not-NULL.patch mutter-43.3/debian/patches/color-device-Make-sure-lcms_context-is-not-NULL.patch
--- mutter-43.3/debian/patches/color-device-Make-sure-lcms_context-is-not-NULL.patch	2023-03-02 08:50:50.000000000 +0000
+++ mutter-43.3/debian/patches/color-device-Make-sure-lcms_context-is-not-NULL.patch	2023-03-06 11:35:23.000000000 +0000
@@ -6,24 +6,27 @@
 context, which is unsuitable for mutter's use. Make sure we're always
 using a non-trivial context.
 
+(cherry picked from commit e2be2d271b9fe79e456628f58ef5d828a27edb0d)
+
 Bug: https://gitlab.gnome.org/GNOME/mutter/-/issues/2659
 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1031847
 Signed-off-by: Simon McVittie <smcv@debian.org>
 Forwarded: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2877
+Applied-upstream: 44.rc, commit:e2be2d271b9fe79e456628f58ef5d828a27edb0d
+Applied-upstream: 43.4, commit:c418c4497b2138fc893cfc729ac79fba55b0788b
 ---
- src/backends/meta-color-device.c | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
+ src/backends/meta-color-device.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
 
 diff --git a/src/backends/meta-color-device.c b/src/backends/meta-color-device.c
-index c0a98a4..ea3b9de 100644
+index c0a98a4..5533a8e 100644
 --- a/src/backends/meta-color-device.c
 +++ b/src/backends/meta-color-device.c
-@@ -846,6 +846,15 @@ create_icc_profile_from_edid (MetaColorDevice     *color_device,
+@@ -846,6 +846,14 @@ create_icc_profile_from_edid (MetaColorDevice     *color_device,
        return NULL;
      }
  
 +  lcms_context = meta_color_manager_get_lcms_context (color_manager);
-+
 +  if (!lcms_context)
 +    {
 +      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@@ -34,7 +37,7 @@
    cd_icc = cd_icc_new ();
  
    chroma.Red.x = edid_info->red_x;
-@@ -863,7 +872,6 @@ create_icc_profile_from_edid (MetaColorDevice     *color_device,
+@@ -863,7 +871,6 @@ create_icc_profile_from_edid (MetaColorDevice     *color_device,
    transfer_curve[1] = transfer_curve[0];
    transfer_curve[2] = transfer_curve[0];
  
diff -Nru mutter-43.3/debian/patches/core-Avoid-focusing-windows-on-map-during-grabs.patch mutter-43.3/debian/patches/core-Avoid-focusing-windows-on-map-during-grabs.patch
--- mutter-43.3/debian/patches/core-Avoid-focusing-windows-on-map-during-grabs.patch	1970-01-01 01:00:00.000000000 +0100
+++ mutter-43.3/debian/patches/core-Avoid-focusing-windows-on-map-during-grabs.patch	2023-03-06 11:35:23.000000000 +0000
@@ -0,0 +1,35 @@
+From: Carlos Garnacho <carlosg@gnome.org>
+Date: Wed, 1 Mar 2023 13:58:13 +0100
+Subject: core: Avoid focusing windows on map during grabs
+
+Normally, mutter implicitly allows a window being shown to take
+focus. This is normally desired, except it steals input from
+GNOME Shell self. Avoid focusing the just shown window in those
+situations.
+
+Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2878>
+Origin: upstream, 44.rc, commit:3ac82a58c51a5c8db6b49e89a1232f99c79644cc
+---
+ src/core/window.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/core/window.c b/src/core/window.c
+index f32a7e6..9ae2f78 100644
+--- a/src/core/window.c
++++ b/src/core/window.c
+@@ -1988,6 +1988,15 @@ window_state_on_map (MetaWindow *window,
+       return;
+     }
+ 
++  /* Do not focus window on map if input is already taken by the
++   * compositor.
++   */
++  if (!meta_display_windows_are_interactable (window->display))
++    {
++      *takes_focus = FALSE;
++      return;
++    }
++
+   /* Terminal usage may be different; some users intend to launch
+    * many apps in quick succession or to just view things in the new
+    * window while still interacting with the terminal.  In that case,
diff -Nru mutter-43.3/debian/patches/debian/Mark-xwayland-test-case-as-known-to-be-flaky-on-32-bit-AR.patch mutter-43.3/debian/patches/debian/Mark-xwayland-test-case-as-known-to-be-flaky-on-32-bit-AR.patch
--- mutter-43.3/debian/patches/debian/Mark-xwayland-test-case-as-known-to-be-flaky-on-32-bit-AR.patch	2023-03-02 08:50:50.000000000 +0000
+++ mutter-43.3/debian/patches/debian/Mark-xwayland-test-case-as-known-to-be-flaky-on-32-bit-AR.patch	2023-03-06 11:35:23.000000000 +0000
@@ -9,7 +9,7 @@
  1 file changed, 1 insertion(+)
 
 diff --git a/src/tests/meson.build b/src/tests/meson.build
-index 53401d4..5d7bfb5 100644
+index e082f5f..6fee5ea 100644
 --- a/src/tests/meson.build
 +++ b/src/tests/meson.build
 @@ -370,6 +370,7 @@ if have_native_tests
diff -Nru mutter-43.3/debian/patches/debian/tests-Disable-restore-size-test.patch mutter-43.3/debian/patches/debian/tests-Disable-restore-size-test.patch
--- mutter-43.3/debian/patches/debian/tests-Disable-restore-size-test.patch	2023-03-02 08:50:50.000000000 +0000
+++ mutter-43.3/debian/patches/debian/tests-Disable-restore-size-test.patch	2023-03-06 11:35:23.000000000 +0000
@@ -12,7 +12,7 @@
  1 file changed, 1 deletion(-)
 
 diff --git a/src/tests/meson.build b/src/tests/meson.build
-index 6978a02..53401d4 100644
+index 4c617cb..e082f5f 100644
 --- a/src/tests/meson.build
 +++ b/src/tests/meson.build
 @@ -427,7 +427,6 @@ stacking_tests = [
diff -Nru mutter-43.3/debian/patches/debian/tests-Tag-unstable-tests-as-flaky.patch mutter-43.3/debian/patches/debian/tests-Tag-unstable-tests-as-flaky.patch
--- mutter-43.3/debian/patches/debian/tests-Tag-unstable-tests-as-flaky.patch	2023-03-02 08:50:50.000000000 +0000
+++ mutter-43.3/debian/patches/debian/tests-Tag-unstable-tests-as-flaky.patch	2023-03-06 11:35:23.000000000 +0000
@@ -31,7 +31,7 @@
      is_parallel: false,
    )
 diff --git a/src/tests/meson.build b/src/tests/meson.build
-index 2516382..6978a02 100644
+index f9ec97a..4c617cb 100644
 --- a/src/tests/meson.build
 +++ b/src/tests/meson.build
 @@ -208,6 +208,7 @@ test_cases += [
diff -Nru mutter-43.3/debian/patches/Revert-x11-Do-not-move-X11-input-focus-during-grabs.patch mutter-43.3/debian/patches/Revert-x11-Do-not-move-X11-input-focus-during-grabs.patch
--- mutter-43.3/debian/patches/Revert-x11-Do-not-move-X11-input-focus-during-grabs.patch	1970-01-01 01:00:00.000000000 +0100
+++ mutter-43.3/debian/patches/Revert-x11-Do-not-move-X11-input-focus-during-grabs.patch	2023-03-06 11:35:23.000000000 +0000
@@ -0,0 +1,87 @@
+From: Carlos Garnacho <carlosg@gnome.org>
+Date: Tue, 28 Feb 2023 17:30:08 +0100
+Subject: Revert "x11: Do not move X11 input focus during grabs"
+
+This reverts commit a68b8e95954772cd6f5d676a803e01c13e48c83f.
+
+Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2878>
+Origin: upstream, 44.rc, commit:7de834b915a0361a298d790b8d337e170cb2b99d
+---
+ src/core/events.c                  |  4 ----
+ src/x11/meta-x11-display-private.h |  2 --
+ src/x11/meta-x11-display.c         | 20 --------------------
+ 3 files changed, 26 deletions(-)
+
+diff --git a/src/core/events.c b/src/core/events.c
+index f6477b7..aaf6f49 100644
+--- a/src/core/events.c
++++ b/src/core/events.c
+@@ -34,7 +34,6 @@
+ #include "core/display-private.h"
+ #include "core/window-private.h"
+ #include "meta/meta-backend.h"
+-#include "x11/meta-x11-display-private.h"
+ 
+ #ifdef HAVE_NATIVE_BACKEND
+ #include "backends/native/meta-backend-native.h"
+@@ -261,9 +260,6 @@ meta_display_handle_event (MetaDisplay        *display,
+           display->grabbed_in_clutter = FALSE;
+           meta_compositor_grab_end (compositor);
+         }
+-
+-      if (display->x11_display)
+-        meta_x11_display_sync_input_focus (display->x11_display);
+     }
+ 
+   device = clutter_event_get_device (event);
+diff --git a/src/x11/meta-x11-display-private.h b/src/x11/meta-x11-display-private.h
+index d8be49e..a811131 100644
+--- a/src/x11/meta-x11-display-private.h
++++ b/src/x11/meta-x11-display-private.h
+@@ -258,8 +258,6 @@ void meta_x11_display_set_input_focus (MetaX11Display *x11_display,
+                                        gboolean        focus_frame,
+                                        uint32_t        timestamp);
+ 
+-void meta_x11_display_sync_input_focus (MetaX11Display *x11_display);
+-
+ MetaDisplay * meta_x11_display_get_display (MetaX11Display *x11_display);
+ 
+ #endif /* META_X11_DISPLAY_PRIVATE_H */
+diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
+index 09cd332..729d8c0 100644
+--- a/src/x11/meta-x11-display.c
++++ b/src/x11/meta-x11-display.c
+@@ -1944,10 +1944,6 @@ meta_x11_display_set_input_focus_internal (MetaX11Display *x11_display,
+                                            Window          xwindow,
+                                            uint32_t        timestamp)
+ {
+-  if (xwindow != None &&
+-      !meta_display_windows_are_interactable (x11_display->display))
+-    return;
+-
+   meta_x11_error_trap_push (x11_display);
+ 
+   /* In order for mutter to know that the focus request succeeded, we track
+@@ -2020,22 +2016,6 @@ meta_x11_display_set_input_focus_xwindow (MetaX11Display *x11_display,
+   x11_display->display->last_focus_time = timestamp;
+ }
+ 
+-void
+-meta_x11_display_sync_input_focus (MetaX11Display *x11_display)
+-{
+-  guint timestamp;
+-
+-  if (!meta_display_windows_are_interactable (x11_display->display))
+-    return;
+-
+-  meta_x11_error_trap_push (x11_display);
+-  timestamp = meta_display_get_current_time (x11_display->display);
+-  meta_x11_display_set_input_focus_internal (x11_display,
+-                                             x11_display->focus_xwindow,
+-                                             timestamp);
+-  meta_x11_error_trap_pop (x11_display);
+-}
+-
+ static MetaX11DisplayLogicalMonitorData *
+ get_x11_display_logical_monitor_data (MetaLogicalMonitor *logical_monitor)
+ {
diff -Nru mutter-43.3/debian/patches/Revert-x11-events-Do-not-update-focus-XWindow-during-grab.patch mutter-43.3/debian/patches/Revert-x11-events-Do-not-update-focus-XWindow-during-grab.patch
--- mutter-43.3/debian/patches/Revert-x11-events-Do-not-update-focus-XWindow-during-grab.patch	1970-01-01 01:00:00.000000000 +0100
+++ mutter-43.3/debian/patches/Revert-x11-events-Do-not-update-focus-XWindow-during-grab.patch	2023-03-06 11:35:23.000000000 +0000
@@ -0,0 +1,36 @@
+From: Carlos Garnacho <carlosg@gnome.org>
+Date: Tue, 28 Feb 2023 17:58:39 +0100
+Subject: Revert "x11/events: Do not update focus XWindow during grabs"
+
+This reverts commit 0e6395d93284422848ca3a5ffb88d48fbce7d471.
+
+Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2878>
+Origin: upstream, 44.rc, commit:92792d6850aec1347152d1b0209a233d4af15252
+---
+ src/x11/events.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/src/x11/events.c b/src/x11/events.c
+index cc7f214..b806d54 100644
+--- a/src/x11/events.c
++++ b/src/x11/events.c
+@@ -1009,9 +1009,6 @@ handle_input_xevent (MetaX11Display *x11_display,
+       break;
+     case XI_FocusIn:
+     case XI_FocusOut:
+-      if (clutter_stage_get_grab_actor (stage) != NULL)
+-        break;
+-
+       if (handle_window_focus_event (x11_display, window, enter_event, serial) &&
+           enter_event->event == enter_event->root)
+         {
+@@ -1933,8 +1930,7 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
+       event->xany.serial > x11_display->focus_serial &&
+       display->focus_window &&
+       display->focus_window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
+-      !window_has_xwindow (display->focus_window, x11_display->server_focus_window) &&
+-      meta_display_windows_are_interactable (display))
++      !window_has_xwindow (display->focus_window, x11_display->server_focus_window))
+     {
+       meta_topic (META_DEBUG_FOCUS, "Earlier attempt to focus %s failed",
+                   display->focus_window->desc);
diff -Nru mutter-43.3/debian/patches/series mutter-43.3/debian/patches/series
--- mutter-43.3/debian/patches/series	2023-03-02 08:50:50.000000000 +0000
+++ mutter-43.3/debian/patches/series	2023-03-06 11:35:23.000000000 +0000
@@ -1,10 +1,14 @@
+wayland-Don-t-overwrite-surface-offsets.patch
 x11-Avoid-updating-focus-on-wayland-compositor.patch
 color-device-Make-sure-lcms_context-is-not-NULL.patch
 color-device-Don-t-close-lcms-profile-on-error-from-cd_ic.patch
-wayland-Don-t-overwrite-surface-offsets.patch
+Revert-x11-Do-not-move-X11-input-focus-during-grabs.patch
+Revert-x11-events-Do-not-update-focus-XWindow-during-grab.patch
+x11-Ignore-_NET_ACTIVE_WINDOW-client-messages-while-grabb.patch
+core-Avoid-focusing-windows-on-map-during-grabs.patch
 tests-Break-up-stacking-installed-tests-into-more-smaller.patch
+tests-Use-a-more-interoperable-path-to-bash.patch
 meson-add-back-default_driver-option.patch
-tests-Disable-broken-test.patch
 tests-Mark-view-verification-tests-as-incomplete-in-big-e.patch
 theme-load-icons-as-Gtk-does-with-fallback-and-RTL-suppor.patch
 theme-use-gtk_render_icon_suface-to-paint-button-icon.patch
diff -Nru mutter-43.3/debian/patches/tests-Disable-broken-test.patch mutter-43.3/debian/patches/tests-Disable-broken-test.patch
--- mutter-43.3/debian/patches/tests-Disable-broken-test.patch	2023-03-02 08:50:50.000000000 +0000
+++ mutter-43.3/debian/patches/tests-Disable-broken-test.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,50 +0,0 @@
-From: Jeremy Bicha <jeremy.bicha@canonical.com>
-Date: Tue, 16 Aug 2022 09:50:06 -0400
-Subject: tests: Disable broken test
-
-There is no x11-test.sh
-
-https://gitlab.gnome.org/GNOME/mutter/-/issues/2385
----
- src/tests/meson.build | 28 ++++++++++++++--------------
- 1 file changed, 14 insertions(+), 14 deletions(-)
-
-diff --git a/src/tests/meson.build b/src/tests/meson.build
-index f9ec97a..2516382 100644
---- a/src/tests/meson.build
-+++ b/src/tests/meson.build
-@@ -524,20 +524,20 @@ if have_kvm_tests or have_tty_tests
-   endif
- endif
- 
--if have_x11
--  test('x11', xvfb,
--    args: [
--      xvfb_args,
--      find_program('x11-test.sh').full_path(),
--      mutter.full_path(),
--    ],
--    depends: [mutter],
--    suite: ['core', 'mutter/x11'],
--    env: test_env,
--    is_parallel: false,
--    timeout: 60,
--  )
--endif
-+#if have_x11
-+#  test('x11', xvfb,
-+#    args: [
-+#      xvfb_args,
-+#      find_program('x11-test.sh').full_path(),
-+#      mutter.full_path(),
-+#    ],
-+#    depends: [mutter],
-+#    suite: ['core', 'mutter/x11'],
-+#    env: test_env,
-+#    is_parallel: false,
-+#    timeout: 60,
-+#  )
-+#endif
- 
- tools_test_env = test_env
- tools_test_env.set('G_DEBUG', 'fatal-warnings')
diff -Nru mutter-43.3/debian/patches/tests-Use-a-more-interoperable-path-to-bash.patch mutter-43.3/debian/patches/tests-Use-a-more-interoperable-path-to-bash.patch
--- mutter-43.3/debian/patches/tests-Use-a-more-interoperable-path-to-bash.patch	1970-01-01 01:00:00.000000000 +0100
+++ mutter-43.3/debian/patches/tests-Use-a-more-interoperable-path-to-bash.patch	2023-03-06 11:35:23.000000000 +0000
@@ -0,0 +1,70 @@
+From: Simon McVittie <smcv@debian.org>
+Date: Mon, 6 Mar 2023 10:32:55 +0000
+Subject: tests: Use a more interoperable path to bash
+
+On systems that have undergone the /usr merge, /bin/bash and
+/usr/bin/bash can be used interchangeably, but on systems where /bin and
+/usr/bin are separate (such as Debian 11 or older), bash was traditionally
+in /bin and there is no bash in /usr/bin.
+
+Bug: https://gitlab.gnome.org/GNOME/mutter/-/issues/2385
+Signed-off-by: Simon McVittie <smcv@debian.org>
+Forwarded: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2900
+---
+ .gitlab-ci/checkout-gnome-shell.sh      | 2 +-
+ .gitlab-ci/download-coverity-tarball.sh | 2 +-
+ src/tests/kvm/run-kvm-test.sh           | 2 +-
+ src/tests/kvm/virtme-run.sh             | 2 +-
+ src/tests/x11-test.sh                   | 2 +-
+ 5 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/.gitlab-ci/checkout-gnome-shell.sh b/.gitlab-ci/checkout-gnome-shell.sh
+index e4bb9c4..4e086da 100755
+--- a/.gitlab-ci/checkout-gnome-shell.sh
++++ b/.gitlab-ci/checkout-gnome-shell.sh
+@@ -1,4 +1,4 @@
+-#!/usr/bin/bash
++#!/bin/bash
+ 
+ fetch() {
+   local remote=$1
+diff --git a/.gitlab-ci/download-coverity-tarball.sh b/.gitlab-ci/download-coverity-tarball.sh
+index ca875c9..182363c 100755
+--- a/.gitlab-ci/download-coverity-tarball.sh
++++ b/.gitlab-ci/download-coverity-tarball.sh
+@@ -1,4 +1,4 @@
+-#!/usr/bin/bash
++#!/bin/bash
+ 
+ # We need a coverity token to fetch the tarball
+ if [ -x $COVERITY_TOKEN ]
+diff --git a/src/tests/kvm/run-kvm-test.sh b/src/tests/kvm/run-kvm-test.sh
+index 974ff75..5ad2c6b 100755
+--- a/src/tests/kvm/run-kvm-test.sh
++++ b/src/tests/kvm/run-kvm-test.sh
+@@ -1,4 +1,4 @@
+-#!/usr/bin/bash
++#!/bin/bash
+ 
+ set -e
+ 
+diff --git a/src/tests/kvm/virtme-run.sh b/src/tests/kvm/virtme-run.sh
+index 755f280..8c96c79 100755
+--- a/src/tests/kvm/virtme-run.sh
++++ b/src/tests/kvm/virtme-run.sh
+@@ -1,4 +1,4 @@
+-#!/usr/bin/bash
++#!/bin/bash
+ 
+ set -e
+ 
+diff --git a/src/tests/x11-test.sh b/src/tests/x11-test.sh
+index 376a019..59e460f 100755
+--- a/src/tests/x11-test.sh
++++ b/src/tests/x11-test.sh
+@@ -1,4 +1,4 @@
+-#!/usr/bin/bash
++#!/bin/bash
+ 
+ set -e
+ 
diff -Nru mutter-43.3/debian/patches/x11-Ignore-_NET_ACTIVE_WINDOW-client-messages-while-grabb.patch mutter-43.3/debian/patches/x11-Ignore-_NET_ACTIVE_WINDOW-client-messages-while-grabb.patch
--- mutter-43.3/debian/patches/x11-Ignore-_NET_ACTIVE_WINDOW-client-messages-while-grabb.patch	1970-01-01 01:00:00.000000000 +0100
+++ mutter-43.3/debian/patches/x11-Ignore-_NET_ACTIVE_WINDOW-client-messages-while-grabb.patch	2023-03-06 11:35:23.000000000 +0000
@@ -0,0 +1,45 @@
+From: Carlos Garnacho <carlosg@gnome.org>
+Date: Tue, 28 Feb 2023 22:02:05 +0100
+Subject: x11: Ignore _NET_ACTIVE_WINDOW client messages while grabbed
+
+When a X11 application is started, typically what happens is:
+
+- A startup notification token is created, with a _TIME%d suffix
+- The application being spawned receives it through the environment
+- (dbus piping, maybe)
+- The application replies the startup notification token, and
+  fetches the timestamp from it
+- The application makes a _NET_ACTIVE_WINDOW client message request
+  with this timestamp
+- Mutter handles this client request and activates/focuses the window
+
+Prevent this last step if windows are not interactable (e.g. there is
+a compositor grab) and ignore the focus request. This specifically
+applies to X11 clients requesting focus themselves, and unlike previous
+approaches, doesn't try to prevent focus changes that do come through
+interaction with Mutter/GNOME Shell.
+
+This should only break if applications do not observe _NET_ACTIVE_WINDOW
+and perform XSetInputFocus on themselves, but in that case the X11
+keyboard focus is stolen from our hands already.
+
+Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2878>
+Origin: upstream, 44.rc, commit:608d3019b6c8288fbfc7a916efcb8f55d5db040c
+---
+ src/x11/window-x11.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
+index 93511e9..167b1b5 100644
+--- a/src/x11/window-x11.c
++++ b/src/x11/window-x11.c
+@@ -3382,7 +3382,8 @@ meta_window_x11_client_message (MetaWindow *window,
+                                       event->xclient.data.l[4]); /* height */
+     }
+   else if (event->xclient.message_type ==
+-           x11_display->atom__NET_ACTIVE_WINDOW)
++           x11_display->atom__NET_ACTIVE_WINDOW &&
++           meta_display_windows_are_interactable (window->display))
+     {
+       MetaClientType source_indication;
+       guint32        timestamp;
diff -Nru mutter-43.3/.gitlab-ci/checkout-gnome-shell.sh mutter-43.3/.gitlab-ci/checkout-gnome-shell.sh
--- mutter-43.3/.gitlab-ci/checkout-gnome-shell.sh	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/.gitlab-ci/checkout-gnome-shell.sh	2023-03-13 22:25:39.000000000 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/bash
 
 fetch() {
   local remote=$1
diff -Nru mutter-43.3/.gitlab-ci/download-coverity-tarball.sh mutter-43.3/.gitlab-ci/download-coverity-tarball.sh
--- mutter-43.3/.gitlab-ci/download-coverity-tarball.sh	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/.gitlab-ci/download-coverity-tarball.sh	2023-03-13 22:25:39.000000000 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/bash
 
 # We need a coverity token to fetch the tarball
 if [ -x $COVERITY_TOKEN ]
diff -Nru mutter-43.3/src/backends/meta-color-device.c mutter-43.3/src/backends/meta-color-device.c
--- mutter-43.3/src/backends/meta-color-device.c	2023-03-13 22:25:38.000000000 +0000
+++ mutter-43.3/src/backends/meta-color-device.c	2023-03-13 22:25:39.000000000 +0000
@@ -847,7 +847,6 @@
     }
 
   lcms_context = meta_color_manager_get_lcms_context (color_manager);
-
   if (!lcms_context)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@@ -890,6 +889,7 @@
   cmsSetHeaderRenderingIntent (lcms_profile, INTENT_PERCEPTUAL);
   cmsSetDeviceClass (lcms_profile, cmsSigDisplayClass);
 
+  g_warn_if_fail (cmsGetProfileContextID (lcms_profile));
   if (!cd_icc_load_handle (cd_icc, g_steal_pointer (&lcms_profile),
                            CD_ICC_LOAD_FLAGS_PRIMARIES, error))
     return NULL;
diff -Nru mutter-43.3/src/core/events.c mutter-43.3/src/core/events.c
--- mutter-43.3/src/core/events.c	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/src/core/events.c	2023-03-13 22:25:39.000000000 +0000
@@ -34,7 +34,6 @@
 #include "core/display-private.h"
 #include "core/window-private.h"
 #include "meta/meta-backend.h"
-#include "x11/meta-x11-display-private.h"
 
 #ifdef HAVE_NATIVE_BACKEND
 #include "backends/native/meta-backend-native.h"
@@ -261,9 +260,6 @@
           display->grabbed_in_clutter = FALSE;
           meta_compositor_grab_end (compositor);
         }
-
-      if (display->x11_display)
-        meta_x11_display_sync_input_focus (display->x11_display);
     }
 
   device = clutter_event_get_device (event);
diff -Nru mutter-43.3/src/core/window.c mutter-43.3/src/core/window.c
--- mutter-43.3/src/core/window.c	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/src/core/window.c	2023-03-13 22:25:39.000000000 +0000
@@ -1988,6 +1988,15 @@
       return;
     }
 
+  /* Do not focus window on map if input is already taken by the
+   * compositor.
+   */
+  if (!meta_display_windows_are_interactable (window->display))
+    {
+      *takes_focus = FALSE;
+      return;
+    }
+
   /* Terminal usage may be different; some users intend to launch
    * many apps in quick succession or to just view things in the new
    * window while still interacting with the terminal.  In that case,
diff -Nru mutter-43.3/src/tests/kvm/run-kvm-test.sh mutter-43.3/src/tests/kvm/run-kvm-test.sh
--- mutter-43.3/src/tests/kvm/run-kvm-test.sh	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/src/tests/kvm/run-kvm-test.sh	2023-03-13 22:25:39.000000000 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/bash
 
 set -e
 
diff -Nru mutter-43.3/src/tests/kvm/virtme-run.sh mutter-43.3/src/tests/kvm/virtme-run.sh
--- mutter-43.3/src/tests/kvm/virtme-run.sh	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/src/tests/kvm/virtme-run.sh	2023-03-13 22:25:39.000000000 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/bash
 
 set -e
 
diff -Nru mutter-43.3/src/tests/meson.build mutter-43.3/src/tests/meson.build
--- mutter-43.3/src/tests/meson.build	2023-03-13 22:25:38.000000000 +0000
+++ mutter-43.3/src/tests/meson.build	2023-03-13 22:25:39.000000000 +0000
@@ -526,20 +526,20 @@
   endif
 endif
 
-#if have_x11
-#  test('x11', xvfb,
-#    args: [
-#      xvfb_args,
-#      find_program('x11-test.sh').full_path(),
-#      mutter.full_path(),
-#    ],
-#    depends: [mutter],
-#    suite: ['core', 'mutter/x11'],
-#    env: test_env,
-#    is_parallel: false,
-#    timeout: 60,
-#  )
-#endif
+if have_x11
+  test('x11', xvfb,
+    args: [
+      xvfb_args,
+      find_program('x11-test.sh').full_path(),
+      mutter.full_path(),
+    ],
+    depends: [mutter],
+    suite: ['core', 'mutter/x11'],
+    env: test_env,
+    is_parallel: false,
+    timeout: 60,
+  )
+endif
 
 tools_test_env = test_env
 tools_test_env.set('G_DEBUG', 'fatal-warnings')
diff -Nru mutter-43.3/src/tests/x11-test.sh mutter-43.3/src/tests/x11-test.sh
--- mutter-43.3/src/tests/x11-test.sh	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/src/tests/x11-test.sh	2023-03-13 22:25:39.000000000 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/bash
 
 set -e
 
diff -Nru mutter-43.3/src/x11/events.c mutter-43.3/src/x11/events.c
--- mutter-43.3/src/x11/events.c	2023-03-13 22:25:38.000000000 +0000
+++ mutter-43.3/src/x11/events.c	2023-03-13 22:25:39.000000000 +0000
@@ -1009,9 +1009,6 @@
       break;
     case XI_FocusIn:
     case XI_FocusOut:
-      if (clutter_stage_get_grab_actor (stage) != NULL)
-        break;
-
       if (handle_window_focus_event (x11_display, window, enter_event, serial) &&
           enter_event->event == enter_event->root)
         {
@@ -1933,8 +1930,7 @@
       event->xany.serial > x11_display->focus_serial &&
       display->focus_window &&
       display->focus_window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
-      !window_has_xwindow (display->focus_window, x11_display->server_focus_window) &&
-      meta_display_windows_are_interactable (display))
+      !window_has_xwindow (display->focus_window, x11_display->server_focus_window))
     {
       meta_topic (META_DEBUG_FOCUS, "Earlier attempt to focus %s failed",
                   display->focus_window->desc);
diff -Nru mutter-43.3/src/x11/meta-x11-display.c mutter-43.3/src/x11/meta-x11-display.c
--- mutter-43.3/src/x11/meta-x11-display.c	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/src/x11/meta-x11-display.c	2023-03-13 22:25:39.000000000 +0000
@@ -1944,10 +1944,6 @@
                                            Window          xwindow,
                                            uint32_t        timestamp)
 {
-  if (xwindow != None &&
-      !meta_display_windows_are_interactable (x11_display->display))
-    return;
-
   meta_x11_error_trap_push (x11_display);
 
   /* In order for mutter to know that the focus request succeeded, we track
@@ -2020,22 +2016,6 @@
   x11_display->display->last_focus_time = timestamp;
 }
 
-void
-meta_x11_display_sync_input_focus (MetaX11Display *x11_display)
-{
-  guint timestamp;
-
-  if (!meta_display_windows_are_interactable (x11_display->display))
-    return;
-
-  meta_x11_error_trap_push (x11_display);
-  timestamp = meta_display_get_current_time (x11_display->display);
-  meta_x11_display_set_input_focus_internal (x11_display,
-                                             x11_display->focus_xwindow,
-                                             timestamp);
-  meta_x11_error_trap_pop (x11_display);
-}
-
 static MetaX11DisplayLogicalMonitorData *
 get_x11_display_logical_monitor_data (MetaLogicalMonitor *logical_monitor)
 {
diff -Nru mutter-43.3/src/x11/meta-x11-display-private.h mutter-43.3/src/x11/meta-x11-display-private.h
--- mutter-43.3/src/x11/meta-x11-display-private.h	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/src/x11/meta-x11-display-private.h	2023-03-13 22:25:39.000000000 +0000
@@ -258,8 +258,6 @@
                                        gboolean        focus_frame,
                                        uint32_t        timestamp);
 
-void meta_x11_display_sync_input_focus (MetaX11Display *x11_display);
-
 MetaDisplay * meta_x11_display_get_display (MetaX11Display *x11_display);
 
 #endif /* META_X11_DISPLAY_PRIVATE_H */
diff -Nru mutter-43.3/src/x11/window-x11.c mutter-43.3/src/x11/window-x11.c
--- mutter-43.3/src/x11/window-x11.c	2023-02-13 18:12:26.000000000 +0000
+++ mutter-43.3/src/x11/window-x11.c	2023-03-13 22:25:39.000000000 +0000
@@ -3382,7 +3382,8 @@
                                       event->xclient.data.l[4]); /* height */
     }
   else if (event->xclient.message_type ==
-           x11_display->atom__NET_ACTIVE_WINDOW)
+           x11_display->atom__NET_ACTIVE_WINDOW &&
+           meta_display_windows_are_interactable (window->display))
     {
       MetaClientType source_indication;
       guint32        timestamp;

Reply to: