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>
This commit is contained in:
Olivier Fourdan 2021-10-11 14:06:00 +02:00
parent 867db93043
commit cea39b7f0c

View File

@ -596,39 +596,15 @@ send_xdg_output_events (struct wl_resource *resource,
gboolean need_all_events, gboolean need_all_events,
gboolean *pending_done_event) gboolean *pending_done_event)
{ {
MetaRectangle new_layout; MetaRectangle layout;
MetaRectangle old_layout;
MetaLogicalMonitor *logical_monitor; MetaLogicalMonitor *logical_monitor;
MetaLogicalMonitor *old_logical_monitor;
gboolean need_done;
int version; int version;
need_done = FALSE;
logical_monitor = meta_monitor_get_logical_monitor (monitor); logical_monitor = meta_monitor_get_logical_monitor (monitor);
old_logical_monitor = layout = meta_logical_monitor_get_layout (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 || zxdg_output_v1_send_logical_position (resource, layout.x, layout.y);
old_layout.x != new_layout.x || zxdg_output_v1_send_logical_size (resource, layout.width, layout.height);
old_layout.y != new_layout.y)
{
zxdg_output_v1_send_logical_position (resource,
new_layout.x,
new_layout.y);
need_done = TRUE;
}
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;
}
version = wl_resource_get_version (resource); 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); zxdg_output_v1_send_description (resource, description);
} }
if (pending_done_event && need_done) if (pending_done_event)
*pending_done_event = TRUE; *pending_done_event = TRUE;
} }