diff --git a/staging/gnome-settings-daemon/gnome-settings-daemon.spec b/staging/gnome-settings-daemon/gnome-settings-daemon.spec index 316fa7f..311f6e9 100644 --- a/staging/gnome-settings-daemon/gnome-settings-daemon.spec +++ b/staging/gnome-settings-daemon/gnome-settings-daemon.spec @@ -20,7 +20,7 @@ %global major_version %%(echo %{gnome_version} | cut -f 1 -d '~' | cut -f 1 -d '.') Name: gnome-settings-daemon -Version: %{gnome_version}.xscaling.{{{ git_dir_version }}} +Version: %{gnome_version}.ublue.{{{ git_dir_version }}} Release: 1%{?dist} Summary: The daemon sharing settings from GNOME to GTK+/KDE applications diff --git a/staging/mutter/0001-Revert-x11-Use-input-region-from-frame-window-for-de.patch b/staging/mutter/0001-Revert-x11-Use-input-region-from-frame-window-for-de.patch deleted file mode 100644 index 4124b53..0000000 --- a/staging/mutter/0001-Revert-x11-Use-input-region-from-frame-window-for-de.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 21680b2f4edb064ff524cb91e9e20ace91deda6d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Florian=20M=C3=BCllner?= -Date: Sun, 21 Apr 2024 16:54:52 +0200 -Subject: [PATCH 1/2] Revert "x11/window: Update comment and variable name to - reflect current behavior" - -This reverts commit e4763d00e8512aeb408ae118597d753f12217487. ---- - src/x11/window-x11.c | 15 ++++++++------- - 1 file changed, 8 insertions(+), 7 deletions(-) - -diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c -index 6d2016e3ec..f6f7d87dfe 100644 ---- a/src/x11/window-x11.c -+++ b/src/x11/window-x11.c -@@ -2476,20 +2476,21 @@ meta_window_x11_update_input_region (MetaWindow *window) - - if (region != NULL) - { -- MtkRectangle bounding_rect; -+ MtkRectangle client_area; - -- bounding_rect.x = 0; -- bounding_rect.y = 0; -- bounding_rect.width = window->buffer_rect.width; -- bounding_rect.height = window->buffer_rect.height; -+ client_area.x = 0; -+ client_area.y = 0; -+ client_area.width = window->buffer_rect.width; -+ client_area.height = window->buffer_rect.height; - - /* The shape we get back from the client may have coordinates - * outside of the frame. The X SHAPE Extension requires that - * the overall shape the client provides never exceeds the - * "bounding rectangle" of the window -- the shape that the -- * window would have gotten if it was unshaped. -+ * window would have gotten if it was unshaped. In our case, -+ * this is simply the client area. - */ -- mtk_region_intersect_rectangle (region, &bounding_rect); -+ mtk_region_intersect_rectangle (region, &client_area); - } - - meta_window_set_input_region (window, region); --- -2.44.0 - - -From f1996e67ad8a5a0009e90c38767c8906e015ba70 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Thu, 5 Oct 2023 13:09:46 -0700 -Subject: [PATCH 2/2] Revert "x11: Use input region from frame window for - decorated windows" - -This reverts commit d991961ae2a5c8cf2e58ff1072239f4902b0f767. It -seems to cause the broken mouse interaction bug reported in -https://bugzilla.redhat.com/show_bug.cgi?id=2239128 . - -Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3068 ---- - src/core/frame.c | 7 ------- - src/x11/window-x11.c | 29 ++++++++++------------------- - 2 files changed, 10 insertions(+), 26 deletions(-) - -diff --git a/src/core/frame.c b/src/core/frame.c -index c74a2e04ec..5feb854805 100644 ---- a/src/core/frame.c -+++ b/src/core/frame.c -@@ -35,7 +35,6 @@ - #include "x11/window-props.h" - - #include --#include - - #define EVENT_MASK (SubstructureRedirectMask | \ - StructureNotifyMask | SubstructureNotifyMask | \ -@@ -109,9 +108,6 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window, - XChangeWindowAttributes (x11_display->xdisplay, - frame->xwindow, CWEventMask, &attrs); - -- if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) -- XShapeSelectInput (x11_display->xdisplay, frame->xwindow, ShapeNotifyMask); -- - meta_x11_display_register_x_window (x11_display, &frame->xwindow, window); - - if (window->mapped) -@@ -220,9 +216,6 @@ meta_window_destroy_frame (MetaWindow *window) - window->reparents_pending += 1; - } - -- if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) -- XShapeSelectInput (x11_display->xdisplay, frame->xwindow, NoEventMask); -- - XDeleteProperty (x11_display->xdisplay, - meta_window_x11_get_xwindow (window), - x11_display->atom__MUTTER_NEEDS_FRAME); -diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c -index f6f7d87dfe..1bc5c57a1a 100644 ---- a/src/x11/window-x11.c -+++ b/src/x11/window-x11.c -@@ -2082,10 +2082,6 @@ meta_window_x11_constructed (GObject *object) - priv->keys_grabbed = FALSE; - priv->grab_on_frame = FALSE; - -- g_signal_connect (window, "notify::decorated", -- G_CALLBACK (meta_window_x11_update_input_region), -- window); -- - G_OBJECT_CLASS (meta_window_x11_parent_class)->constructed (object); - } - -@@ -2400,21 +2396,16 @@ meta_window_x11_update_input_region (MetaWindow *window) - g_autoptr (MtkRegion) region = NULL; - MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); - MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); -- Window xwindow; - -+ /* Decorated windows don't have an input region, because -+ we don't shape the frame to match the client windows -+ (so the events are blocked by the frame anyway) -+ */ - if (window->decorated) - { -- if (!window->frame) -- { -- if (priv->input_region) -- meta_window_set_input_region (window, NULL); -- return; -- } -- xwindow = window->frame->xwindow; -- } -- else -- { -- xwindow = priv->xwindow; -+ if (priv->input_region) -+ meta_window_set_input_region (window, NULL); -+ return; - } - - if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) -@@ -2426,7 +2417,7 @@ meta_window_x11_update_input_region (MetaWindow *window) - - mtk_x11_error_trap_push (x11_display->xdisplay); - rects = XShapeGetRectangles (x11_display->xdisplay, -- xwindow, -+ priv->xwindow, - ShapeInput, - &n_rects, - &ordering); -@@ -2480,8 +2471,8 @@ meta_window_x11_update_input_region (MetaWindow *window) - - client_area.x = 0; - client_area.y = 0; -- client_area.width = window->buffer_rect.width; -- client_area.height = window->buffer_rect.height; -+ client_area.width = priv->client_rect.width; -+ client_area.height = priv->client_rect.height; - - /* The shape we get back from the client may have coordinates - * outside of the frame. The X SHAPE Extension requires that --- -2.44.0 - diff --git a/staging/mutter/0001-modified-3329.patch b/staging/mutter/0001-modified-3329.patch deleted file mode 100644 index 54f0ed4..0000000 --- a/staging/mutter/0001-modified-3329.patch +++ /dev/null @@ -1,145 +0,0 @@ -From e20ebeefa42997fe65008b11ef771c71b697273c Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Fri, 20 Oct 2023 22:12:23 -0700 -Subject: [PATCH] modified 3329 - -Signed-off-by: Adam Williamson ---- - src/compositor/meta-compositor-x11.c | 2 ++ - src/core/display.c | 34 ---------------------------- - src/tests/x11-test.sh | 3 +++ - src/x11/meta-x11-display.c | 30 +++++++++++++++++++++++- - 4 files changed, 34 insertions(+), 35 deletions(-) - -diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c -index 1ad3327dd..ce7bc1945 100644 ---- a/src/compositor/meta-compositor-x11.c -+++ b/src/compositor/meta-compositor-x11.c -@@ -188,6 +188,8 @@ meta_compositor_x11_manage (MetaCompositor *compositor, - - compositor_x11->have_x11_sync_object = meta_sync_ring_init (xdisplay); - -+ meta_x11_display_redirect_windows (x11_display, display); -+ - return TRUE; - } - -diff --git a/src/core/display.c b/src/core/display.c -index 0a191c0fb..b16e50e21 100644 ---- a/src/core/display.c -+++ b/src/core/display.c -@@ -930,9 +930,6 @@ meta_display_new (MetaContext *context, - MetaDisplay *display; - MetaDisplayPrivate *priv; - guint32 timestamp; --#ifdef HAVE_X11_CLIENT -- Window old_active_xwindow = None; --#endif - MetaMonitorManager *monitor_manager; - MetaSettings *settings; - MetaInputCapture *input_capture; -@@ -1048,14 +1045,6 @@ meta_display_new (MetaContext *context, - display->last_focus_time = timestamp; - display->last_user_time = timestamp; - --#ifdef HAVE_X11 -- if (!meta_is_wayland_compositor ()) -- meta_prop_get_window (display->x11_display, -- display->x11_display->xroot, -- display->x11_display->atom__NET_ACTIVE_WINDOW, -- &old_active_xwindow); --#endif -- - if (!meta_compositor_manage (display->compositor, error)) - { - g_object_unref (display); -@@ -1076,30 +1065,7 @@ meta_display_new (MetaContext *context, - g_signal_connect (display->gesture_tracker, "state-changed", - G_CALLBACK (gesture_tracker_state_changed), display); - -- /* We know that if mutter is running as a Wayland compositor, -- * we start out with no windows. -- */ --#ifdef HAVE_X11_CLIENT -- if (!meta_is_wayland_compositor ()) -- meta_display_manage_all_xwindows (display); -- -- if (old_active_xwindow != None) -- { -- MetaWindow *old_active_window; -- old_active_window = meta_x11_display_lookup_x_window (display->x11_display, -- old_active_xwindow); -- if (old_active_window) -- meta_window_focus (old_active_window, timestamp); -- else -- meta_display_unset_input_focus (display, timestamp); -- } -- else -- { -- meta_display_unset_input_focus (display, timestamp); -- } --#else - meta_display_unset_input_focus (display, timestamp); --#endif - - g_signal_connect (stage, "notify::is-grabbed", - G_CALLBACK (on_is_grabbed_changed), display); -diff --git a/src/tests/x11-test.sh b/src/tests/x11-test.sh -index 59e460fc3..d95b2460f 100755 ---- a/src/tests/x11-test.sh -+++ b/src/tests/x11-test.sh -@@ -34,6 +34,9 @@ echo \# Launched with pid $MUTTER2_PID - MUTTER2_PID=$! - wait $MUTTER1_PID - -+echo \# Waiting for the second mutter to finish loading -+gdbus wait --session org.gnome.Mutter.IdleMonitor -+ - sleep 2 - - echo \# Terminating clients > /dev/stderr -diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c -index 4e98203dd..4ca620410 100644 ---- a/src/x11/meta-x11-display.c -+++ b/src/x11/meta-x11-display.c -@@ -300,8 +300,36 @@ static void - on_x11_display_opened (MetaX11Display *x11_display, - MetaDisplay *display) - { -+ Window old_active_xwindow = None; -+ -+ if (!meta_is_wayland_compositor ()) -+ { -+ meta_prop_get_window (display->x11_display, -+ display->x11_display->xroot, -+ display->x11_display->atom__NET_ACTIVE_WINDOW, -+ &old_active_xwindow); -+ } -+ -+ if (meta_is_wayland_compositor ()) -+ meta_x11_display_redirect_windows (x11_display, display); -+ -+ - meta_display_manage_all_xwindows (display); -- meta_x11_display_redirect_windows (x11_display, display); -+ -+ if (old_active_xwindow != None) -+ { -+ MetaWindow *old_active_window; -+ -+ old_active_window = meta_x11_display_lookup_x_window (x11_display, -+ old_active_xwindow); -+ if (old_active_window) -+ { -+ uint32_t timestamp; -+ -+ timestamp = display->x11_display->timestamp; -+ meta_window_focus (old_active_window, timestamp); -+ } -+ } - } - - static void --- -2.41.0 - diff --git a/staging/mutter/3567.patch b/staging/mutter/3567.patch index 110a9f5..e37c798 100644 --- a/staging/mutter/3567.patch +++ b/staging/mutter/3567.patch @@ -1,20 +1,3 @@ -From 77f2b82c4afe0c22249436e3ddabc2f4d2161b4f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Tue, 12 Dec 2023 22:41:20 +0100 -Subject: [PATCH 1/4] x11-display: Expose UI scaling factor via D-Bus - -This replaces the `legacy-ui-scaling-factor` entry in -`org.gnome.Mutter.DisplayConfig`, with the motivation being to no longer -expose X11 specific state via the monitor configuration API. ---- - .../org.gnome.Mutter.DisplayConfig.xml | 4 -- - data/dbus-interfaces/org.gnome.Mutter.X11.xml | 8 +++ - src/backends/meta-monitor-manager.c | 7 -- - src/meson.build | 5 ++ - src/x11/meta-x11-display.c | 64 ++++++++++++++++++- - 5 files changed, 76 insertions(+), 12 deletions(-) - create mode 100644 data/dbus-interfaces/org.gnome.Mutter.X11.xml - diff --git a/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml b/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml index b05337d74..7294c57a8 100644 --- a/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml @@ -44,8 +27,43 @@ index 000000000..3d3c8a42f + + + +diff --git a/data/org.gnome.mutter.gschema.xml.in b/data/org.gnome.mutter.gschema.xml.in +index 92c97b12e..6751a8d7a 100644 +--- a/data/org.gnome.mutter.gschema.xml.in ++++ b/data/org.gnome.mutter.gschema.xml.in +@@ -5,6 +5,7 @@ + + + ++ + + + + + +diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h +index 0760a341a..6ed3fc2c3 100644 +--- a/src/backends/meta-monitor-manager-private.h ++++ b/src/backends/meta-monitor-manager-private.h +@@ -436,3 +436,5 @@ gboolean meta_monitor_manager_apply_monitors_config (MetaMonitorManager * + MetaMonitorsConfig *config, + MetaMonitorsConfigMethod method, + GError **error); ++ ++MetaLogicalMonitorLayoutMode meta_monitor_manager_get_layout_mode (MetaMonitorManager *manager); diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c -index 77743bc72..7f98c2d98 100644 +index 77743bc72..45033d966 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -2051,14 +2051,12 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton, @@ -75,184 +93,16 @@ index 77743bc72..7f98c2d98 100644 if (meta_monitor_manager_get_max_screen_size (manager, &max_screen_width, &max_screen_height)) -diff --git a/src/meson.build b/src/meson.build -index 05df3bfd2..e658f98ca 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -949,6 +949,11 @@ dbus_interfaces = [ - 'interface': 'org.gnome.Mutter.DebugControl.xml', - 'prefix': 'org.gnome.Mutter', - }, -+ { -+ 'name': 'meta-dbus-x11', -+ 'interface': 'org.gnome.Mutter.X11.xml', -+ 'prefix': 'org.gnome.Mutter', -+ }, - ] - - if have_profiler -diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c -index 5c0760daa..55f062714 100644 ---- a/src/x11/meta-x11-display.c -+++ b/src/x11/meta-x11-display.c -@@ -70,7 +70,7 @@ - #include "wayland/meta-xwayland-private.h" - #endif +@@ -4123,3 +4116,9 @@ meta_monitor_manager_get_virtual_monitors (MetaMonitorManager *manager) --G_DEFINE_TYPE (MetaX11Display, meta_x11_display, G_TYPE_OBJECT) -+#include "meta-dbus-x11.h" - - static GQuark quark_x11_display_logical_monitor_data = 0; - -@@ -89,6 +89,14 @@ typedef struct _MetaX11DisplayLogicalMonitorData - int xinerama_index; - } MetaX11DisplayLogicalMonitorData; - -+typedef struct _MetaX11DisplayPrivate -+{ -+ MetaDBusX11 *dbus_api; -+ guint dbus_name_id; -+} MetaX11DisplayPrivate; -+ -+G_DEFINE_TYPE_WITH_PRIVATE (MetaX11Display, meta_x11_display, G_TYPE_OBJECT) -+ - static char *get_screen_name (Display *xdisplay, - int number); - -@@ -151,13 +159,46 @@ meta_x11_event_filter_free (MetaX11EventFilter *filter) - g_free (filter); + return priv->virtual_monitors; } - -+static void -+on_bus_acquired (GDBusConnection *connection, -+ const char *name, -+ gpointer user_data) -+{ -+ MetaX11Display *x11_display = user_data; -+ MetaX11DisplayPrivate *priv = -+ meta_x11_display_get_instance_private (x11_display); -+ -+ g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (priv->dbus_api), -+ connection, -+ "/org/gnome/Mutter/X11", -+ NULL); -+} -+ -+static void -+update_ui_scaling_factor (MetaX11Display *x11_display) -+{ -+ MetaX11DisplayPrivate *priv = -+ meta_x11_display_get_instance_private (x11_display); -+ MetaBackend *backend = backend_from_x11_display (x11_display); -+ MetaSettings *settings = meta_backend_get_settings (backend); -+ int ui_scaling_factor; -+ -+ ui_scaling_factor = meta_settings_get_ui_scaling_factor (settings); -+ meta_dbus_x11_set_ui_scaling_factor (priv->dbus_api, ui_scaling_factor); -+} + - static void - meta_x11_display_dispose (GObject *object) - { - MetaX11Display *x11_display = META_X11_DISPLAY (object); -+ MetaX11DisplayPrivate *priv = -+ meta_x11_display_get_instance_private (x11_display); - - x11_display->closing = TRUE; - -+ g_clear_handle_id (&priv->dbus_name_id, g_bus_unown_name); -+ g_clear_object (&priv->dbus_api); -+ - g_clear_pointer (&x11_display->alarm_filters, g_ptr_array_unref); - - g_clear_list (&x11_display->event_funcs, -@@ -1224,6 +1265,23 @@ meta_x11_display_init_frames_client (MetaX11Display *x11_display) - on_frames_client_died, x11_display); - } - -+static void -+initialize_dbus_interface (MetaX11Display *x11_display) ++MetaLogicalMonitorLayoutMode ++meta_monitor_manager_get_layout_mode (MetaMonitorManager *manager) +{ -+ MetaX11DisplayPrivate *priv = -+ meta_x11_display_get_instance_private (x11_display); -+ -+ priv->dbus_api = meta_dbus_x11_skeleton_new (); -+ priv->dbus_name_id = -+ g_bus_own_name (G_BUS_TYPE_SESSION, -+ "org.gnome.Mutter.X11", -+ G_BUS_NAME_OWNER_FLAGS_NONE, -+ on_bus_acquired, -+ NULL, NULL, -+ x11_display, NULL); -+ update_ui_scaling_factor (x11_display); ++ return manager->layout_mode; +} -+ - /** - * meta_x11_display_new: - * -@@ -1318,6 +1376,8 @@ meta_x11_display_new (MetaDisplay *display, - x11_display = g_object_new (META_TYPE_X11_DISPLAY, NULL); - x11_display->display = display; - -+ initialize_dbus_interface (x11_display); -+ - /* here we use XDisplayName which is what the user - * probably put in, vs. DisplayString(display) which is - * canonicalized by XOpenDisplay() -@@ -1974,6 +2034,8 @@ on_monitors_changed_internal (MetaMonitorManager *monitor_manager, - } - - x11_display->has_xinerama_indices = FALSE; -+ -+ update_ui_scaling_factor (x11_display); - } - - static Bool --- -2.44.0 - - -From d90ede978c07b8baf4186f5f77bd165e35d60941 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= -Date: Tue, 20 Feb 2024 23:51:48 +0100 -Subject: [PATCH 2/4] Add an experimental feature for letting Xwayland clients - scale natively - -With the next commits we'll introduce a new mode for scaling of Xwayland apps, -we'll want to put this mode behind an experimental setting though, so add -that setting. ---- - data/org.gnome.mutter.gschema.xml.in | 8 ++++++++ - src/backends/meta-settings-private.h | 1 + - src/backends/meta-settings.c | 2 ++ - 3 files changed, 11 insertions(+) - -diff --git a/data/org.gnome.mutter.gschema.xml.in b/data/org.gnome.mutter.gschema.xml.in -index 92c97b12e..5c3948555 100644 ---- a/data/org.gnome.mutter.gschema.xml.in -+++ b/data/org.gnome.mutter.gschema.xml.in -@@ -5,6 +5,7 @@ - - - -+ - - - - - diff --git a/src/backends/meta-settings-private.h b/src/backends/meta-settings-private.h index afbba054a..2081a81b1 100644 --- a/src/backends/meta-settings-private.h @@ -278,132 +128,6 @@ index 3703b23b0..1ae59d636 100644 if (feature) g_message ("Enabling experimental feature '%s'", feature_str); --- -2.44.0 - - -From 1ac35ab1fcc1dd3416c0d0ec6bdeb739bd79e5a2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Tue, 12 Dec 2023 22:42:46 +0100 -Subject: [PATCH 3/4] context: Put Wayland compositor getter in the context - header - ---- - src/meta/meta-context.h | 5 +++++ - src/meta/meta-wayland-compositor.h | 3 --- - src/meta/types.h | 4 ++++ - 3 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/src/meta/meta-context.h b/src/meta/meta-context.h -index ef36bd2c3..2adb9b07e 100644 ---- a/src/meta/meta-context.h -+++ b/src/meta/meta-context.h -@@ -101,3 +101,8 @@ gboolean meta_context_raise_rlimit_nofile (MetaContext *context, - META_EXPORT - gboolean meta_context_restore_rlimit_nofile (MetaContext *context, - GError **error); -+ -+#ifdef HAVE_WAYLAND -+META_EXPORT -+MetaWaylandCompositor * meta_context_get_wayland_compositor (MetaContext *context); -+#endif -diff --git a/src/meta/meta-wayland-compositor.h b/src/meta/meta-wayland-compositor.h -index 7f4a50705..3df92fda5 100644 ---- a/src/meta/meta-wayland-compositor.h -+++ b/src/meta/meta-wayland-compositor.h -@@ -31,9 +31,6 @@ G_DECLARE_FINAL_TYPE (MetaWaylandCompositor, - META, WAYLAND_COMPOSITOR, - GObject) - --META_EXPORT --MetaWaylandCompositor *meta_context_get_wayland_compositor (MetaContext *context); -- - META_EXPORT - struct wl_display *meta_wayland_compositor_get_wayland_display (MetaWaylandCompositor *compositor); - -diff --git a/src/meta/types.h b/src/meta/types.h -index cbe2a9a3d..8fba4a839 100644 ---- a/src/meta/types.h -+++ b/src/meta/types.h -@@ -38,3 +38,7 @@ typedef struct _MetaSettings MetaSettings; - - typedef struct _MetaWorkspaceManager MetaWorkspaceManager; - typedef struct _MetaSelection MetaSelection; -+ -+#ifdef HAVE_WAYLAND -+typedef struct _MetaWaylandCompositor MetaWaylandCompositor; -+#endif --- -2.44.0 - - -From eec800b7e0d5c6111bfd27e81f6b14f1612c6659 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Tue, 12 Dec 2023 22:52:44 +0100 -Subject: [PATCH 4/4] Add experimental mode to use native scaling of Xwayland - clients - -Allow scale-aware Xwayland clients to scale by an integer scale -themselves, instead of letting them render them at 1x scale and then -scaling up the texture, making it look blurry. - -When monitor framebuffers are scaled, this special cases Xwayland and -sends output regions in a way that Xwayland think everything is N times -as large as the logical region, where N is the ceil of the max monitor -scale. - -This is done by introducing a "stage" vs "protocol" coordinate space for -X11, where the "protocol" coordinate space is "stage" multiplied by a -scaling factor. - -We're guarding this behind a new experimental feature -"xwayland-native-scaling", which can only come into effect when enabled -together with "scale-monitor-framebuffer". ---- - src/backends/meta-monitor-manager-private.h | 2 + - src/backends/meta-monitor-manager.c | 6 + - src/compositor/meta-window-actor-x11.c | 22 +- - src/core/frame.c | 106 +++++-- - src/wayland/meta-wayland-cursor-surface.c | 52 ++-- - src/wayland/meta-wayland-outputs.c | 73 ++++- - src/wayland/meta-wayland-pointer.c | 14 + - src/wayland/meta-wayland-private.h | 2 + - src/wayland/meta-wayland-surface.c | 30 +- - src/wayland/meta-window-xwayland.c | 71 ++++- - src/wayland/meta-xwayland-private.h | 1 + - src/wayland/meta-xwayland-surface.c | 10 +- - src/wayland/meta-xwayland.c | 56 ++++ - src/wayland/meta-xwayland.h | 2 + - src/x11/meta-x11-display.c | 196 +++++++++++-- - src/x11/window-props.c | 104 ++++++- - src/x11/window-x11.c | 305 ++++++++++++++++---- - src/x11/window-x11.h | 38 +++ - 18 files changed, 916 insertions(+), 174 deletions(-) - -diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h -index 0760a341a..6ed3fc2c3 100644 ---- a/src/backends/meta-monitor-manager-private.h -+++ b/src/backends/meta-monitor-manager-private.h -@@ -436,3 +436,5 @@ gboolean meta_monitor_manager_apply_monitors_config (MetaMonitorManager * - MetaMonitorsConfig *config, - MetaMonitorsConfigMethod method, - GError **error); -+ -+MetaLogicalMonitorLayoutMode meta_monitor_manager_get_layout_mode (MetaMonitorManager *manager); -diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c -index 7f98c2d98..45033d966 100644 ---- a/src/backends/meta-monitor-manager.c -+++ b/src/backends/meta-monitor-manager.c -@@ -4116,3 +4116,9 @@ meta_monitor_manager_get_virtual_monitors (MetaMonitorManager *manager) - - return priv->virtual_monitors; - } -+ -+MetaLogicalMonitorLayoutMode -+meta_monitor_manager_get_layout_mode (MetaMonitorManager *manager) -+{ -+ return manager->layout_mode; -+} diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c index 7d5e46ac7..577ed2760 100644 --- a/src/compositor/meta-window-actor-x11.c @@ -438,7 +162,7 @@ index 7d5e46ac7..577ed2760 100644 meta_window_actor_notify_damaged (META_WINDOW_ACTOR (actor_x11)); } diff --git a/src/core/frame.c b/src/core/frame.c -index 5feb85480..6f0f3ab83 100644 +index c74a2e04e..d45a8759b 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -33,6 +33,7 @@ @@ -448,8 +172,8 @@ index 5feb85480..6f0f3ab83 100644 +#include "x11/window-x11.h" #include - -@@ -65,6 +66,7 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window, + #include +@@ -66,6 +67,7 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window, XSetWindowAttributes attrs; gulong create_serial = 0; MetaFrame *frame; @@ -457,7 +181,7 @@ index 5feb85480..6f0f3ab83 100644 if (window->frame) return; -@@ -123,11 +125,19 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window, +@@ -127,11 +129,19 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window, meta_stack_tracker_record_remove (window->display->stack_tracker, meta_window_x11_get_xwindow (window), XNextRequest (x11_display->xdisplay)); @@ -479,7 +203,7 @@ index 5feb85480..6f0f3ab83 100644 window->reparents_pending += 1; /* FIXME handle this error */ mtk_x11_error_trap_pop (x11_display->xdisplay); -@@ -197,6 +207,8 @@ meta_window_destroy_frame (MetaWindow *window) +@@ -201,6 +211,8 @@ meta_window_destroy_frame (MetaWindow *window) if (!x11_display->closing) { @@ -488,7 +212,7 @@ index 5feb85480..6f0f3ab83 100644 if (!window->unmanaging) { meta_stack_tracker_record_add (window->display->stack_tracker, -@@ -204,6 +216,14 @@ meta_window_destroy_frame (MetaWindow *window) +@@ -208,6 +220,14 @@ meta_window_destroy_frame (MetaWindow *window) XNextRequest (x11_display->xdisplay)); } @@ -503,7 +227,7 @@ index 5feb85480..6f0f3ab83 100644 XReparentWindow (x11_display->xdisplay, meta_window_x11_get_xwindow (window), x11_display->xroot, -@@ -211,8 +231,7 @@ meta_window_destroy_frame (MetaWindow *window) +@@ -215,8 +235,7 @@ meta_window_destroy_frame (MetaWindow *window) * coordinates here means we'll need to ensure a configure * notify event is sent; see bug 399552. */ @@ -513,7 +237,7 @@ index 5feb85480..6f0f3ab83 100644 window->reparents_pending += 1; } -@@ -263,6 +282,7 @@ meta_frame_query_borders (MetaFrame *frame, +@@ -270,6 +289,7 @@ meta_frame_query_borders (MetaFrame *frame, MetaFrameBorders *borders) { MetaWindow *window = frame->window; @@ -521,7 +245,7 @@ index 5feb85480..6f0f3ab83 100644 MetaX11Display *x11_display = window->display->x11_display; int format, res; Atom type; -@@ -286,12 +306,22 @@ meta_frame_query_borders (MetaFrame *frame, +@@ -293,12 +313,22 @@ meta_frame_query_borders (MetaFrame *frame, if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) == Success && res == Success && nitems == 4) { @@ -550,7 +274,7 @@ index 5feb85480..6f0f3ab83 100644 } else { -@@ -314,12 +344,21 @@ meta_frame_query_borders (MetaFrame *frame, +@@ -321,12 +351,21 @@ meta_frame_query_borders (MetaFrame *frame, if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) == Success && res == Success && nitems == 4) { @@ -578,7 +302,7 @@ index 5feb85480..6f0f3ab83 100644 } else { -@@ -367,7 +406,9 @@ meta_frame_sync_to_window (MetaFrame *frame, +@@ -374,7 +413,9 @@ meta_frame_sync_to_window (MetaFrame *frame, gboolean need_resize) { MetaWindow *window = frame->window; @@ -588,7 +312,7 @@ index 5feb85480..6f0f3ab83 100644 meta_topic (META_DEBUG_GEOMETRY, "Syncing frame geometry %d,%d %dx%d (SE: %d,%d)", -@@ -378,12 +419,22 @@ meta_frame_sync_to_window (MetaFrame *frame, +@@ -385,12 +426,22 @@ meta_frame_sync_to_window (MetaFrame *frame, mtk_x11_error_trap_push (x11_display->xdisplay); @@ -615,7 +339,7 @@ index 5feb85480..6f0f3ab83 100644 mtk_x11_error_trap_pop (x11_display->xdisplay); -@@ -420,6 +471,7 @@ static void +@@ -427,6 +478,7 @@ static void send_configure_notify (MetaFrame *frame) { MetaX11Display *x11_display = frame->window->display->x11_display; @@ -623,7 +347,7 @@ index 5feb85480..6f0f3ab83 100644 XEvent event = { 0 }; /* We never get told by the frames client, just reassert the -@@ -429,10 +481,16 @@ send_configure_notify (MetaFrame *frame) +@@ -436,10 +488,16 @@ send_configure_notify (MetaFrame *frame) event.xconfigure.display = x11_display->xdisplay; event.xconfigure.event = frame->xwindow; event.xconfigure.window = frame->xwindow; @@ -644,6 +368,61 @@ index 5feb85480..6f0f3ab83 100644 event.xconfigure.border_width = 0; event.xconfigure.above = None; event.xconfigure.override_redirect = False; +diff --git a/src/meson.build b/src/meson.build +index 05df3bfd2..e658f98ca 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -949,6 +949,11 @@ dbus_interfaces = [ + 'interface': 'org.gnome.Mutter.DebugControl.xml', + 'prefix': 'org.gnome.Mutter', + }, ++ { ++ 'name': 'meta-dbus-x11', ++ 'interface': 'org.gnome.Mutter.X11.xml', ++ 'prefix': 'org.gnome.Mutter', ++ }, + ] + + if have_profiler +diff --git a/src/meta/meta-context.h b/src/meta/meta-context.h +index ef36bd2c3..2adb9b07e 100644 +--- a/src/meta/meta-context.h ++++ b/src/meta/meta-context.h +@@ -101,3 +101,8 @@ gboolean meta_context_raise_rlimit_nofile (MetaContext *context, + META_EXPORT + gboolean meta_context_restore_rlimit_nofile (MetaContext *context, + GError **error); ++ ++#ifdef HAVE_WAYLAND ++META_EXPORT ++MetaWaylandCompositor * meta_context_get_wayland_compositor (MetaContext *context); ++#endif +diff --git a/src/meta/meta-wayland-compositor.h b/src/meta/meta-wayland-compositor.h +index 7f4a50705..3df92fda5 100644 +--- a/src/meta/meta-wayland-compositor.h ++++ b/src/meta/meta-wayland-compositor.h +@@ -31,9 +31,6 @@ G_DECLARE_FINAL_TYPE (MetaWaylandCompositor, + META, WAYLAND_COMPOSITOR, + GObject) + +-META_EXPORT +-MetaWaylandCompositor *meta_context_get_wayland_compositor (MetaContext *context); +- + META_EXPORT + struct wl_display *meta_wayland_compositor_get_wayland_display (MetaWaylandCompositor *compositor); + +diff --git a/src/meta/types.h b/src/meta/types.h +index cbe2a9a3d..8fba4a839 100644 +--- a/src/meta/types.h ++++ b/src/meta/types.h +@@ -38,3 +38,7 @@ typedef struct _MetaSettings MetaSettings; + + typedef struct _MetaWorkspaceManager MetaWorkspaceManager; + typedef struct _MetaSelection MetaSelection; ++ ++#ifdef HAVE_WAYLAND ++typedef struct _MetaWaylandCompositor MetaWaylandCompositor; ++#endif diff --git a/src/wayland/meta-wayland-cursor-surface.c b/src/wayland/meta-wayland-cursor-surface.c index 87a8895c8..5a16ce7d8 100644 --- a/src/wayland/meta-wayland-cursor-surface.c @@ -709,7 +488,7 @@ index 87a8895c8..5a16ce7d8 100644 meta_wayland_surface_update_outputs (surface); diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c -index 89ae86445..55af4b2ac 100644 +index 89ae86445..f957bc339 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -31,6 +31,10 @@ @@ -740,88 +519,61 @@ index 89ae86445..55af4b2ac 100644 wayland_output->global = wl_global_create (compositor->wayland_display, &wl_output_interface, META_WL_OUTPUT_VERSION, -@@ -596,6 +603,19 @@ static const struct zxdg_output_v1_interface +@@ -596,6 +603,37 @@ static const struct zxdg_output_v1_interface meta_xdg_output_destroy, }; ++#ifdef HAVE_XWAYLAND +static gboolean +is_xwayland_resource (MetaWaylandOutput *wayland_output, + struct wl_resource *resource) +{ -+#ifdef HAVE_XWAYLAND + MetaXWaylandManager *manager = &wayland_output->compositor->xwayland_manager; + + return resource && wl_resource_get_client (resource) == manager->client; -+#else -+ return FALSE; -+#endif +} ++#endif + - static void - send_xdg_output_events (struct wl_resource *resource, - MetaWaylandOutput *wayland_output, -@@ -613,18 +633,51 @@ send_xdg_output_events (struct wl_resource *resource, - layout = meta_logical_monitor_get_layout (logical_monitor); - old_layout = wayland_output->layout; - -- if (need_all_events || -- old_layout.x != layout.x || old_layout.y != layout.y) -+ if (is_xwayland_resource (wayland_output, resource)) - { -- zxdg_output_v1_send_logical_position (resource, layout.x, layout.y); -- need_done = TRUE; -- } ++static void ++maybe_scale_for_xwayland (MetaWaylandOutput *wayland_output, ++ struct wl_resource *resource, ++ int *x, ++ int *y) ++{ +#ifdef HAVE_XWAYLAND ++ if (is_xwayland_resource (wayland_output, resource)) ++ { + MetaXWaylandManager *xwayland_manager = + &wayland_output->compositor->xwayland_manager; + int xwayland_scale; - -- if (need_all_events || -- old_layout.width != layout.width || old_layout.height != layout.height) -+ xwayland_scale = meta_xwayland_get_effective_scale (xwayland_manager); -+ -+ if (need_all_events || -+ old_layout.x != layout.x || old_layout.y != layout.y) -+ { -+ layout.x *= xwayland_scale; -+ layout.y *= xwayland_scale; -+ -+ zxdg_output_v1_send_logical_position (resource, layout.x, layout.y); -+ need_done = TRUE; -+ } -+ -+ if (need_all_events || -+ old_layout.width != layout.width || old_layout.height != layout.height) -+ { -+ layout.width *= xwayland_scale; -+ layout.height *= xwayland_scale; + -+ zxdg_output_v1_send_logical_size (resource, layout.width, layout.height); -+ need_done = TRUE; -+ } -+#endif ++ xwayland_scale = meta_xwayland_get_effective_scale (xwayland_manager); ++ *x *= xwayland_scale; ++ *y *= xwayland_scale; + } -+ else - { -- zxdg_output_v1_send_logical_size (resource, layout.width, layout.height); -- need_done = TRUE; -+ if (need_all_events || -+ old_layout.x != layout.x || old_layout.y != layout.y) -+ { -+ zxdg_output_v1_send_logical_position (resource, layout.x, layout.y); -+ need_done = TRUE; -+ } ++#endif ++} + -+ if (need_all_events || -+ old_layout.width != layout.width || old_layout.height != layout.height) -+ { -+ zxdg_output_v1_send_logical_size (resource, layout.width, layout.height); -+ need_done = TRUE; -+ } + static void + send_xdg_output_events (struct wl_resource *resource, + MetaWaylandOutput *wayland_output, +@@ -616,6 +654,7 @@ send_xdg_output_events (struct wl_resource *resource, + if (need_all_events || + old_layout.x != layout.x || old_layout.y != layout.y) + { ++ maybe_scale_for_xwayland (wayland_output, resource, &layout.x, &layout.y); + zxdg_output_v1_send_logical_position (resource, layout.x, layout.y); + need_done = TRUE; } - - if (need_all_events && version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) -@@ -745,7 +798,7 @@ meta_wayland_outputs_init (MetaWaylandCompositor *compositor) +@@ -623,6 +662,7 @@ send_xdg_output_events (struct wl_resource *resource, + if (need_all_events || + old_layout.width != layout.width || old_layout.height != layout.height) + { ++ maybe_scale_for_xwayland (wayland_output, resource, &layout.width, &layout.height); + zxdg_output_v1_send_logical_size (resource, layout.width, layout.height); + need_done = TRUE; + } +@@ -745,7 +785,7 @@ meta_wayland_outputs_init (MetaWaylandCompositor *compositor) MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend); @@ -1138,7 +890,7 @@ index ea9c27d74..828e6f64e 100644 + META_EXPERIMENTAL_FEATURE_XWAYLAND_NATIVE_SCALING) && + meta_settings_is_experimental_feature_enabled (settings, + META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER)) -+ return max(ceil(manager->highest_monitor_scale), 1); ++ return ceil (manager->highest_monitor_scale); + } + + return 1; @@ -1154,10 +906,34 @@ index daf9d1abb..ae7a06977 100644 + +int meta_xwayland_get_effective_scale (MetaXWaylandManager *manager); diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c -index 55f062714..f67e9e427 100644 +index 438f3bd1e..f2a613392 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c -@@ -130,6 +130,42 @@ backend_from_x11_display (MetaX11Display *x11_display) +@@ -70,7 +70,7 @@ + #include "wayland/meta-xwayland-private.h" + #endif + +-G_DEFINE_TYPE (MetaX11Display, meta_x11_display, G_TYPE_OBJECT) ++#include "meta-dbus-x11.h" + + static GQuark quark_x11_display_logical_monitor_data = 0; + +@@ -89,6 +89,14 @@ typedef struct _MetaX11DisplayLogicalMonitorData + int xinerama_index; + } MetaX11DisplayLogicalMonitorData; + ++typedef struct _MetaX11DisplayPrivate ++{ ++ MetaDBusX11 *dbus_api; ++ guint dbus_name_id; ++} MetaX11DisplayPrivate; ++ ++G_DEFINE_TYPE_WITH_PRIVATE (MetaX11Display, meta_x11_display, G_TYPE_OBJECT) ++ + static char *get_screen_name (Display *xdisplay, + int number); + +@@ -122,6 +130,42 @@ backend_from_x11_display (MetaX11Display *x11_display) return meta_context_get_backend (context); } @@ -1200,12 +976,31 @@ index 55f062714..f67e9e427 100644 static void meta_x11_display_unmanage_windows (MetaX11Display *x11_display) { -@@ -180,10 +216,32 @@ update_ui_scaling_factor (MetaX11Display *x11_display) - MetaX11DisplayPrivate *priv = - meta_x11_display_get_instance_private (x11_display); - MetaBackend *backend = backend_from_x11_display (x11_display); -- MetaSettings *settings = meta_backend_get_settings (backend); -- int ui_scaling_factor; +@@ -151,13 +195,68 @@ meta_x11_event_filter_free (MetaX11EventFilter *filter) + g_free (filter); + } + ++static void ++on_bus_acquired (GDBusConnection *connection, ++ const char *name, ++ gpointer user_data) ++{ ++ MetaX11Display *x11_display = user_data; ++ MetaX11DisplayPrivate *priv = ++ meta_x11_display_get_instance_private (x11_display); ++ ++ g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (priv->dbus_api), ++ connection, ++ "/org/gnome/Mutter/X11", ++ NULL); ++} ++ ++static void ++update_ui_scaling_factor (MetaX11Display *x11_display) ++{ ++ MetaX11DisplayPrivate *priv = ++ meta_x11_display_get_instance_private (x11_display); ++ MetaBackend *backend = backend_from_x11_display (x11_display); + MetaContext *context = meta_backend_get_context (backend); + int ui_scaling_factor = 1; + @@ -1231,12 +1026,26 @@ index 55f062714..f67e9e427 100644 + break; + } + } ++ ++ meta_dbus_x11_set_ui_scaling_factor (priv->dbus_api, ui_scaling_factor); ++} ++ + static void + meta_x11_display_dispose (GObject *object) + { + MetaX11Display *x11_display = META_X11_DISPLAY (object); ++ MetaX11DisplayPrivate *priv = ++ meta_x11_display_get_instance_private (x11_display); -- ui_scaling_factor = meta_settings_get_ui_scaling_factor (settings); - meta_dbus_x11_set_ui_scaling_factor (priv->dbus_api, ui_scaling_factor); - } + x11_display->closing = TRUE; + ++ g_clear_handle_id (&priv->dbus_name_id, g_bus_unown_name); ++ g_clear_object (&priv->dbus_api); ++ + g_clear_pointer (&x11_display->alarm_filters, g_ptr_array_unref); -@@ -641,6 +699,9 @@ set_desktop_geometry_hint (MetaX11Display *x11_display) + g_clear_list (&x11_display->event_funcs, +@@ -572,6 +671,9 @@ set_desktop_geometry_hint (MetaX11Display *x11_display) return; meta_display_get_size (x11_display->display, &monitor_width, &monitor_height); @@ -1246,7 +1055,7 @@ index 55f062714..f67e9e427 100644 data[0] = monitor_width; data[1] = monitor_height; -@@ -1050,14 +1111,22 @@ set_workspace_work_area_hint (MetaWorkspace *workspace, +@@ -981,14 +1083,22 @@ set_workspace_work_area_hint (MetaWorkspace *workspace, for (l = logical_monitors; l; l = l->next) { @@ -1275,7 +1084,7 @@ index 55f062714..f67e9e427 100644 tmp += 4; } -@@ -1086,7 +1155,6 @@ set_work_area_hint (MetaDisplay *display, +@@ -1017,7 +1127,6 @@ set_work_area_hint (MetaDisplay *display, int num_workspaces; GList *l; unsigned long *data, *tmp; @@ -1283,7 +1092,7 @@ index 55f062714..f67e9e427 100644 num_workspaces = meta_workspace_manager_get_n_workspaces (workspace_manager); data = g_new (unsigned long, num_workspaces * 4); -@@ -1095,14 +1163,22 @@ set_work_area_hint (MetaDisplay *display, +@@ -1026,14 +1135,22 @@ set_work_area_hint (MetaDisplay *display, for (l = workspace_manager->workspaces; l; l = l->next) { MetaWorkspace *workspace = l->data; @@ -1311,10 +1120,27 @@ index 55f062714..f67e9e427 100644 tmp += 4; } -@@ -1282,6 +1358,41 @@ initialize_dbus_interface (MetaX11Display *x11_display) - update_ui_scaling_factor (x11_display); +@@ -1196,6 +1313,58 @@ meta_x11_display_init_frames_client (MetaX11Display *x11_display) + on_frames_client_died, x11_display); } ++static void ++initialize_dbus_interface (MetaX11Display *x11_display) ++{ ++ MetaX11DisplayPrivate *priv = ++ meta_x11_display_get_instance_private (x11_display); ++ ++ priv->dbus_api = meta_dbus_x11_skeleton_new (); ++ priv->dbus_name_id = ++ g_bus_own_name (G_BUS_TYPE_SESSION, ++ "org.gnome.Mutter.X11", ++ G_BUS_NAME_OWNER_FLAGS_NONE, ++ on_bus_acquired, ++ NULL, NULL, ++ x11_display, NULL); ++ update_ui_scaling_factor (x11_display); ++} ++ +static void +experimental_features_changed (MetaSettings *settings, + MetaExperimentalFeature old_experimental_features, @@ -1353,7 +1179,7 @@ index 55f062714..f67e9e427 100644 /** * meta_x11_display_new: * -@@ -1300,6 +1411,7 @@ meta_x11_display_new (MetaDisplay *display, +@@ -1214,6 +1383,7 @@ meta_x11_display_new (MetaDisplay *display, MetaBackend *backend = meta_context_get_backend (context); MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend); @@ -1361,7 +1187,16 @@ index 55f062714..f67e9e427 100644 g_autoptr (MetaX11Display) x11_display = NULL; Display *xdisplay; Screen *xscreen; -@@ -1470,7 +1582,7 @@ meta_x11_display_new (MetaDisplay *display, +@@ -1290,6 +1460,8 @@ meta_x11_display_new (MetaDisplay *display, + x11_display = g_object_new (META_TYPE_X11_DISPLAY, NULL); + x11_display->display = display; + ++ initialize_dbus_interface (x11_display); ++ + /* here we use XDisplayName which is what the user + * probably put in, vs. DisplayString(display) which is + * canonicalized by XOpenDisplay() +@@ -1382,7 +1554,7 @@ meta_x11_display_new (MetaDisplay *display, "monitors-changed-internal", G_CALLBACK (on_monitors_changed_internal), x11_display, @@ -1370,7 +1205,7 @@ index 55f062714..f67e9e427 100644 init_leader_window (x11_display, ×tamp); x11_display->timestamp = timestamp; -@@ -1563,6 +1675,11 @@ meta_x11_display_new (MetaDisplay *display, +@@ -1475,6 +1647,11 @@ meta_x11_display_new (MetaDisplay *display, meta_prefs_add_listener (prefs_changed_callback, x11_display); @@ -1382,7 +1217,7 @@ index 55f062714..f67e9e427 100644 set_work_area_hint (display, x11_display); g_signal_connect_object (display, "workareas-changed", -@@ -1771,16 +1888,12 @@ meta_x11_display_reload_cursor (MetaX11Display *x11_display) +@@ -1683,16 +1860,12 @@ meta_x11_display_reload_cursor (MetaX11Display *x11_display) } static void @@ -1404,7 +1239,7 @@ index 55f062714..f67e9e427 100644 } static void -@@ -1832,8 +1945,37 @@ static void +@@ -1744,8 +1917,37 @@ static void update_cursor_theme (MetaX11Display *x11_display) { MetaBackend *backend = backend_from_x11_display (x11_display); @@ -1423,7 +1258,8 @@ index 55f062714..f67e9e427 100644 + meta_context_get_wayland_compositor (context); + MetaXWaylandManager *xwayland_manager = + &wayland_compositor->xwayland_manager; -+ + +- set_cursor_theme (x11_display->xdisplay, backend); + scale = meta_xwayland_get_effective_scale (xwayland_manager); +#endif + break; @@ -1437,13 +1273,12 @@ index 55f062714..f67e9e427 100644 + size = meta_prefs_get_cursor_size () * scale; + + theme = meta_prefs_get_cursor_theme (); - -- set_cursor_theme (x11_display->xdisplay, backend); ++ + set_cursor_theme (x11_display->xdisplay, theme, size); schedule_reload_x11_cursor (x11_display); if (META_IS_BACKEND_X11 (backend)) -@@ -1841,7 +1983,7 @@ update_cursor_theme (MetaX11Display *x11_display) +@@ -1753,7 +1955,7 @@ update_cursor_theme (MetaX11Display *x11_display) MetaBackendX11 *backend_x11 = META_BACKEND_X11 (backend); Display *xdisplay = meta_backend_x11_get_xdisplay (backend_x11); @@ -1452,8 +1287,17 @@ index 55f062714..f67e9e427 100644 meta_backend_x11_reload_cursor (backend_x11); } } +@@ -1946,6 +2148,8 @@ on_monitors_changed_internal (MetaMonitorManager *monitor_manager, + } + + x11_display->has_xinerama_indices = FALSE; ++ ++ update_ui_scaling_factor (x11_display); + } + + static Bool diff --git a/src/x11/window-props.c b/src/x11/window-props.c -index c18b3eab5..6adb69bb8 100644 +index c18b3eab5..494fbe843 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -305,10 +305,15 @@ reload_icon_geometry (MetaWindow *window, @@ -1526,7 +1370,7 @@ index c18b3eab5..6adb69bb8 100644 rect_index++; } -@@ -1245,7 +1269,61 @@ meta_set_normal_hints (MetaWindow *window, +@@ -1245,9 +1269,65 @@ meta_set_normal_hints (MetaWindow *window, * as if flags were zero */ if (hints) @@ -1534,7 +1378,7 @@ index c18b3eab5..6adb69bb8 100644 + { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + -+ window->size_hints = *(MetaSizeHints*)(hints); ++ window->size_hints = *(MetaSizeHints *) hints; + + meta_window_x11_protocol_to_stage (window_x11, + hints->x, hints->y, @@ -1587,10 +1431,15 @@ index c18b3eab5..6adb69bb8 100644 + NULL, NULL); + } else - window->size_hints.flags = 0; +- window->size_hints.flags = 0; ++ { ++ window->size_hints.flags = 0; ++ } + /* Put back saved ConfigureRequest. */ + window->size_hints.x = x; diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c -index 1bc5c57a1..14d334fe0 100644 +index 6d2016e3e..47836c5d2 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -110,6 +110,113 @@ meta_window_x11_get_private (MetaWindowX11 *window_x11) @@ -1899,9 +1748,9 @@ index 1bc5c57a1..14d334fe0 100644 + attrs.border_width, 0, 0, 0, + &priv->border_width, NULL, NULL, NULL); - G_OBJECT_CLASS (meta_window_x11_parent_class)->constructed (object); - } -@@ -2188,6 +2340,8 @@ meta_window_x11_class_init (MetaWindowX11Class *klass) + g_signal_connect (window, "notify::decorated", + G_CALLBACK (meta_window_x11_update_input_region), +@@ -2192,6 +2344,8 @@ meta_window_x11_class_init (MetaWindowX11Class *klass) klass->thaw_commits = meta_window_x11_impl_thaw_commits; klass->always_update_shape = meta_window_x11_impl_always_update_shape; klass->process_property_notify = meta_window_x11_impl_process_property_notify; @@ -1910,7 +1759,46 @@ index 1bc5c57a1..14d334fe0 100644 obj_props[PROP_ATTRIBUTES] = g_param_spec_pointer ("attributes", NULL, NULL, -@@ -2459,7 +2613,10 @@ meta_window_x11_update_input_region (MetaWindow *window) +@@ -2400,6 +2554,7 @@ meta_window_x11_update_input_region (MetaWindow *window) + g_autoptr (MtkRegion) region = NULL; + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); ++ MtkRectangle bounding_rect = { 0 }; + Window xwindow; + + if (window->decorated) +@@ -2411,10 +2566,19 @@ meta_window_x11_update_input_region (MetaWindow *window) + return; + } + xwindow = window->frame->xwindow; ++ bounding_rect.width = window->buffer_rect.width; ++ bounding_rect.height = window->buffer_rect.height; + } + else + { + xwindow = priv->xwindow; ++ meta_window_x11_stage_to_protocol(window_x11, ++ 0, 0, ++ priv->client_rect.width, ++ priv->client_rect.height, ++ NULL, NULL, ++ &bounding_rect.width, ++ &bounding_rect.height); + } + + if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) +@@ -2458,8 +2622,8 @@ meta_window_x11_update_input_region (MetaWindow *window) + else if (n_rects == 1 && + (rects[0].x == 0 && + rects[0].y == 0 && +- rects[0].width == window->buffer_rect.width && +- rects[0].height == window->buffer_rect.height)) ++ rects[0].width == bounding_rect.width && ++ rects[0].height == bounding_rect.height)) + { + /* This is the bounding region case. Keep the + * region as NULL. */ +@@ -2468,7 +2632,10 @@ meta_window_x11_update_input_region (MetaWindow *window) else { /* Window has a custom shape. */ @@ -1922,7 +1810,21 @@ index 1bc5c57a1..14d334fe0 100644 } meta_XFree (rects); -@@ -2543,7 +2700,10 @@ meta_window_x11_update_shape_region (MetaWindow *window) +@@ -2476,13 +2643,6 @@ meta_window_x11_update_input_region (MetaWindow *window) + + if (region != NULL) + { +- MtkRectangle bounding_rect; +- +- bounding_rect.x = 0; +- bounding_rect.y = 0; +- bounding_rect.width = window->buffer_rect.width; +- bounding_rect.height = window->buffer_rect.height; +- + /* The shape we get back from the client may have coordinates + * outside of the frame. The X SHAPE Extension requires that + * the overall shape the client provides never exceeds the +@@ -2551,7 +2711,10 @@ meta_window_x11_update_shape_region (MetaWindow *window) if (rects) { @@ -1934,7 +1836,7 @@ index 1bc5c57a1..14d334fe0 100644 XFree (rects); } } -@@ -2821,6 +2981,7 @@ meta_window_x11_configure_request (MetaWindow *window, +@@ -2829,6 +2992,7 @@ meta_window_x11_configure_request (MetaWindow *window, { MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); @@ -1942,7 +1844,7 @@ index 1bc5c57a1..14d334fe0 100644 /* Note that x, y is the corner of the window border, * and width, height is the size of the window inside -@@ -2829,15 +2990,25 @@ meta_window_x11_configure_request (MetaWindow *window, +@@ -2837,15 +3001,25 @@ meta_window_x11_configure_request (MetaWindow *window, * requested border here. */ if (event->xconfigurerequest.value_mask & CWBorderWidth) @@ -1976,7 +1878,7 @@ index 1bc5c57a1..14d334fe0 100644 /* Handle stacking. We only handle raises/lowers, mostly because * stack.c really can't deal with anything else. I guess we'll fix -@@ -3332,8 +3503,13 @@ meta_window_x11_client_message (MetaWindow *window, +@@ -3340,8 +3514,13 @@ meta_window_x11_client_message (MetaWindow *window, guint32 timestamp; MetaWindowDrag *window_drag; @@ -1992,7 +1894,7 @@ index 1bc5c57a1..14d334fe0 100644 action = event->xclient.data.l[2]; button = event->xclient.data.l[3]; -@@ -3497,6 +3673,7 @@ meta_window_x11_client_message (MetaWindow *window, +@@ -3505,6 +3684,7 @@ meta_window_x11_client_message (MetaWindow *window, { MetaGravity gravity; guint value_mask; @@ -2000,7 +1902,7 @@ index 1bc5c57a1..14d334fe0 100644 gravity = (MetaGravity) (event->xclient.data.l[0] & 0xff); value_mask = (event->xclient.data.l[0] & 0xf00) >> 8; -@@ -3505,13 +3682,20 @@ meta_window_x11_client_message (MetaWindow *window, +@@ -3513,13 +3693,20 @@ meta_window_x11_client_message (MetaWindow *window, if (gravity == 0) gravity = window->size_hints.win_gravity; @@ -2025,7 +1927,7 @@ index 1bc5c57a1..14d334fe0 100644 } else if (event->xclient.message_type == x11_display->atom__NET_ACTIVE_WINDOW && -@@ -3568,11 +3752,15 @@ meta_window_x11_client_message (MetaWindow *window, +@@ -3576,11 +3763,15 @@ meta_window_x11_client_message (MetaWindow *window, else if (event->xclient.message_type == x11_display->atom__GTK_SHOW_WINDOW_MENU) { @@ -2044,7 +1946,7 @@ index 1bc5c57a1..14d334fe0 100644 meta_window_show_menu (window, META_WINDOW_MENU_WM, x, y); } -@@ -4094,10 +4282,11 @@ meta_window_x11_configure_notify (MetaWindow *window, +@@ -4102,10 +4293,11 @@ meta_window_x11_configure_notify (MetaWindow *window, g_assert (window->override_redirect); g_assert (window->frame == NULL); @@ -2113,6 +2015,3 @@ index 205eaaa63..fa3fbea6a 100644 + int *stage_y, + int *stage_width, + int *stage_heigth); --- -2.44.0 - diff --git a/staging/mutter/mutter.spec b/staging/mutter/mutter.spec index b5df9f7..d76aefc 100644 --- a/staging/mutter/mutter.spec +++ b/staging/mutter/mutter.spec @@ -48,8 +48,8 @@ Patch4: 0001-modified-3329.patch # https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441 Patch5: 1441.patch -# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567 -# Patch6: 3567.patch +https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3567 +Patch6: 3567.patch BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.41.0 BuildRequires: pkgconfig(sm)