wayland: Fetch wl_output logical monitor via helper

Will be useful when wl_output gets tied to a MetaMonitor, instead of a
MetaLogicalMonitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
This commit is contained in:
Jonas Ådahl 2021-02-05 16:46:43 +01:00 committed by Marge Bot
parent 99531f9d4b
commit 2b59b85d85
5 changed files with 28 additions and 8 deletions

View File

@ -438,9 +438,17 @@ zxdg_toplevel_v6_set_fullscreen (struct wl_client *client,
if (output_resource) if (output_resource)
{ {
MetaWaylandOutput *output = wl_resource_get_user_data (output_resource); MetaWaylandOutput *wayland_output;
if (output && output->logical_monitor)
meta_window_move_to_monitor (window, output->logical_monitor->number); wayland_output = wl_resource_get_user_data (output_resource);
if (wayland_output)
{
MetaLogicalMonitor *logical_monitor;
logical_monitor =
meta_wayland_output_get_logical_monitor (wayland_output);
meta_window_move_to_monitor (window, logical_monitor->number);
}
} }
meta_window_make_fullscreen (window); meta_window_make_fullscreen (window);

View File

@ -63,6 +63,12 @@ meta_wayland_output_get_resources (MetaWaylandOutput *wayland_output)
return wayland_output->resources; return wayland_output->resources;
} }
MetaLogicalMonitor *
meta_wayland_output_get_logical_monitor (MetaWaylandOutput *wayland_output)
{
return wayland_output->logical_monitor;
}
static void static void
output_resource_destroy (struct wl_resource *res) output_resource_destroy (struct wl_resource *res)
{ {

View File

@ -52,6 +52,8 @@ struct _MetaWaylandOutput
const GList * meta_wayland_output_get_resources (MetaWaylandOutput *wayland_output); const GList * meta_wayland_output_get_resources (MetaWaylandOutput *wayland_output);
MetaLogicalMonitor * meta_wayland_output_get_logical_monitor (MetaWaylandOutput *wayland_output);
void meta_wayland_outputs_init (MetaWaylandCompositor *compositor); void meta_wayland_outputs_init (MetaWaylandCompositor *compositor);
#endif /* META_WAYLAND_OUTPUTS_H */ #endif /* META_WAYLAND_OUTPUTS_H */

View File

@ -1368,7 +1368,7 @@ update_surface_output_state (gpointer key, gpointer value, gpointer user_data)
g_assert (surface->role); g_assert (surface->role);
logical_monitor = wayland_output->logical_monitor; logical_monitor = meta_wayland_output_get_logical_monitor (wayland_output);
if (!logical_monitor) if (!logical_monitor)
{ {
set_surface_is_on_output (surface, wayland_output, FALSE); set_surface_is_on_output (surface, wayland_output, FALSE);

View File

@ -461,12 +461,16 @@ xdg_toplevel_set_fullscreen (struct wl_client *client,
if (output_resource) if (output_resource)
{ {
MetaWaylandOutput *output = wl_resource_get_user_data (output_resource); MetaWaylandOutput *wayland_output;
if (output && output->logical_monitor) wayland_output = wl_resource_get_user_data (output_resource);
if (wayland_output)
{ {
meta_window_move_to_monitor (window, MetaLogicalMonitor *logical_monitor;
output->logical_monitor->number);
logical_monitor =
meta_wayland_output_get_logical_monitor (wayland_output);
meta_window_move_to_monitor (window, logical_monitor->number);
} }
} }