[mutter] wayland/output: Always send xdg_output layout



commit cea39b7f0cca99da22b9486873861acb122c66f8
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Mon Oct 11 14:06:00 2021 +0200

    wayland/output: Always send xdg_output layout
    
    With each wl_ouitput corresponding to a monitor, the logical monitor is
    not part of the MetaWaylandOutput anymore.
    
    Previously, send_xdg_output_events() would compare the old logical
    monitor against the new one to determine whether the size and/or
    position was changed and should be sent along with the xdg_output
    events.
    
    But that logic is now defeated as there is no old/new logical monitor
    anymore, so the updated size or location would never be sent again.
    
    Xwayland relies on this information to update its X11 clients and its
    own internal root size, without this the X11 screen size and XRandR
    information would never be updated.
    
    To avoid that issue, always send the xdg_output size and location on
    xdg_output events, Xwayland is smart enough to update its X11 clients
    with XRandR only when the layout actually change.
    
    Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1964
    Fixes: bf7c3450 - Make each wl_output correspond to one monitor
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2050>

 src/wayland/meta-wayland-outputs.c | 34 +++++-----------------------------
 1 file changed, 5 insertions(+), 29 deletions(-)
---
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index 3c9baf23fb..f8069b6929 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -596,39 +596,15 @@ send_xdg_output_events (struct wl_resource *resource,
                         gboolean            need_all_events,
                         gboolean           *pending_done_event)
 {
-  MetaRectangle new_layout;
-  MetaRectangle old_layout;
+  MetaRectangle layout;
   MetaLogicalMonitor *logical_monitor;
-  MetaLogicalMonitor *old_logical_monitor;
-  gboolean need_done;
   int version;
 
-  need_done = FALSE;
   logical_monitor = meta_monitor_get_logical_monitor (monitor);
-  old_logical_monitor =
-    meta_monitor_get_logical_monitor (wayland_output->monitor);
-  old_layout = meta_logical_monitor_get_layout (old_logical_monitor);
-  new_layout = meta_logical_monitor_get_layout (logical_monitor);
-
-  if (need_all_events ||
-      old_layout.x != new_layout.x ||
-      old_layout.y != new_layout.y)
-    {
-      zxdg_output_v1_send_logical_position (resource,
-                                            new_layout.x,
-                                            new_layout.y);
-      need_done = TRUE;
-    }
+  layout = meta_logical_monitor_get_layout (logical_monitor);
 
-  if (need_all_events ||
-      old_layout.width != new_layout.width ||
-      old_layout.height != new_layout.height)
-    {
-      zxdg_output_v1_send_logical_size (resource,
-                                        new_layout.width,
-                                        new_layout.height);
-      need_done = TRUE;
-    }
+  zxdg_output_v1_send_logical_position (resource, layout.x, layout.y);
+  zxdg_output_v1_send_logical_size (resource, layout.width, layout.height);
 
   version = wl_resource_get_version (resource);
 
@@ -648,7 +624,7 @@ send_xdg_output_events (struct wl_resource *resource,
       zxdg_output_v1_send_description (resource, description);
     }
 
-  if (pending_done_event && need_done)
+  if (pending_done_event)
     *pending_done_event = TRUE;
 }
 


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