From 2b59b85d858978a16834eccbc708d723f4a46c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 5 Feb 2021 16:46:43 +0100 Subject: [PATCH] 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: --- src/wayland/meta-wayland-legacy-xdg-shell.c | 14 +++++++++++--- src/wayland/meta-wayland-outputs.c | 6 ++++++ src/wayland/meta-wayland-outputs.h | 2 ++ src/wayland/meta-wayland-surface.c | 2 +- src/wayland/meta-wayland-xdg-shell.c | 12 ++++++++---- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/wayland/meta-wayland-legacy-xdg-shell.c b/src/wayland/meta-wayland-legacy-xdg-shell.c index 3c1ed8e93..af789ec2a 100644 --- a/src/wayland/meta-wayland-legacy-xdg-shell.c +++ b/src/wayland/meta-wayland-legacy-xdg-shell.c @@ -438,9 +438,17 @@ zxdg_toplevel_v6_set_fullscreen (struct wl_client *client, if (output_resource) { - MetaWaylandOutput *output = wl_resource_get_user_data (output_resource); - if (output && output->logical_monitor) - meta_window_move_to_monitor (window, output->logical_monitor->number); + MetaWaylandOutput *wayland_output; + + 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); diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index 623832731..5d085f12f 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -63,6 +63,12 @@ meta_wayland_output_get_resources (MetaWaylandOutput *wayland_output) return wayland_output->resources; } +MetaLogicalMonitor * +meta_wayland_output_get_logical_monitor (MetaWaylandOutput *wayland_output) +{ + return wayland_output->logical_monitor; +} + static void output_resource_destroy (struct wl_resource *res) { diff --git a/src/wayland/meta-wayland-outputs.h b/src/wayland/meta-wayland-outputs.h index f906818e7..480468178 100644 --- a/src/wayland/meta-wayland-outputs.h +++ b/src/wayland/meta-wayland-outputs.h @@ -52,6 +52,8 @@ struct _MetaWaylandOutput 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); #endif /* META_WAYLAND_OUTPUTS_H */ diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index ee1635792..872ee6c49 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1368,7 +1368,7 @@ update_surface_output_state (gpointer key, gpointer value, gpointer user_data) g_assert (surface->role); - logical_monitor = wayland_output->logical_monitor; + logical_monitor = meta_wayland_output_get_logical_monitor (wayland_output); if (!logical_monitor) { set_surface_is_on_output (surface, wayland_output, FALSE); diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index c5f0d0b91..62a5e786c 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -461,12 +461,16 @@ xdg_toplevel_set_fullscreen (struct wl_client *client, 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, - output->logical_monitor->number); + MetaLogicalMonitor *logical_monitor; + + logical_monitor = + meta_wayland_output_get_logical_monitor (wayland_output); + meta_window_move_to_monitor (window, logical_monitor->number); } }