wayland: Don't access MetaWaylandSurface::window directly
It'll be moved to the role owning it, accessed via a helper function implemented by the role. Currently it still just fetches the field in MetaWaylandSurface. https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
This commit is contained in:

committed by
Robert Mader

parent
5149e1e43a
commit
c0c74484bc
@ -196,7 +196,7 @@ xdg_toplevel_set_parent (struct wl_client *client,
|
||||
MetaWindow *transient_for = NULL;
|
||||
MetaWindow *window;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -205,7 +205,7 @@ xdg_toplevel_set_parent (struct wl_client *client,
|
||||
MetaWaylandSurface *parent_surface =
|
||||
surface_from_xdg_surface_resource (parent_resource);
|
||||
|
||||
transient_for = parent_surface->window;
|
||||
transient_for = meta_wayland_surface_get_window (parent_surface);
|
||||
}
|
||||
|
||||
meta_window_set_transient_for (window, transient_for);
|
||||
@ -219,7 +219,7 @@ xdg_toplevel_set_title (struct wl_client *client,
|
||||
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
||||
MetaWindow *window;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -237,7 +237,7 @@ xdg_toplevel_set_app_id (struct wl_client *client,
|
||||
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
||||
MetaWindow *window;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -260,7 +260,7 @@ xdg_toplevel_show_window_menu (struct wl_client *client,
|
||||
MetaWindow *window;
|
||||
int monitor_scale;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -284,7 +284,7 @@ xdg_toplevel_move (struct wl_client *client,
|
||||
MetaWindow *window;
|
||||
float x, y;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -330,7 +330,7 @@ xdg_toplevel_resize (struct wl_client *client,
|
||||
gfloat x, y;
|
||||
MetaGrabOp grab_op;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -398,7 +398,7 @@ xdg_toplevel_set_maximized (struct wl_client *client,
|
||||
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
||||
MetaWindow *window;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -416,7 +416,7 @@ xdg_toplevel_unset_maximized (struct wl_client *client,
|
||||
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
||||
MetaWindow *window;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -431,7 +431,7 @@ xdg_toplevel_set_fullscreen (struct wl_client *client,
|
||||
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
||||
MetaWindow *window;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -456,7 +456,7 @@ xdg_toplevel_unset_fullscreen (struct wl_client *client,
|
||||
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
||||
MetaWindow *window;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -470,7 +470,7 @@ xdg_toplevel_set_minimized (struct wl_client *client,
|
||||
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
|
||||
MetaWindow *window;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -604,7 +604,7 @@ fill_states (MetaWaylandXdgToplevel *xdg_toplevel,
|
||||
META_WAYLAND_SURFACE_ROLE (xdg_toplevel);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWindow *window = surface->window;
|
||||
MetaWindow *window = meta_wayland_surface_get_window (surface);
|
||||
|
||||
if (META_WINDOW_MAXIMIZED (window))
|
||||
add_state_value (states, XDG_TOPLEVEL_STATE_MAXIMIZED);
|
||||
@ -694,7 +694,7 @@ meta_wayland_xdg_toplevel_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaRectangle old_geometry;
|
||||
gboolean geometry_changed;
|
||||
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
{
|
||||
meta_wayland_surface_cache_pending_frame_callbacks (surface, pending);
|
||||
@ -904,9 +904,10 @@ static void
|
||||
scale_placement_rule (MetaPlacementRule *placement_rule,
|
||||
MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWindow *window = meta_wayland_surface_get_window (surface);
|
||||
int geometry_scale;
|
||||
|
||||
geometry_scale = meta_window_wayland_get_geometry_scale (surface->window);
|
||||
geometry_scale = meta_window_wayland_get_geometry_scale (window);
|
||||
|
||||
placement_rule->anchor_rect.x *= geometry_scale;
|
||||
placement_rule->anchor_rect.y *= geometry_scale;
|
||||
@ -926,12 +927,13 @@ meta_wayland_xdg_popup_place (MetaWaylandXdgPopup *xdg_popup,
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaPlacementRule scaled_placement_rule;
|
||||
MetaWindow *window;
|
||||
|
||||
scaled_placement_rule = *placement_rule;
|
||||
scale_placement_rule (&scaled_placement_rule, surface);
|
||||
|
||||
meta_window_place_with_placement_rule (surface->window,
|
||||
&scaled_placement_rule);
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
meta_window_place_with_placement_rule (window, &scaled_placement_rule);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -958,7 +960,7 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
|
||||
xdg_popup->setup.parent_surface = NULL;
|
||||
xdg_popup->setup.grab_seat = NULL;
|
||||
|
||||
if (!parent_surface->window)
|
||||
if (!meta_wayland_surface_get_window (parent_surface))
|
||||
{
|
||||
xdg_popup_send_popup_done (xdg_popup->resource);
|
||||
return;
|
||||
@ -1065,7 +1067,7 @@ meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
}
|
||||
|
||||
/* If the window disappeared the surface is not coming back. */
|
||||
window = surface->window;
|
||||
window = meta_wayland_surface_get_window (surface);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
@ -1083,7 +1085,7 @@ meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
meta_window_wayland_finish_move_resize (window, window_geometry, pending);
|
||||
}
|
||||
|
||||
parent_window = xdg_popup->parent_surface->window;
|
||||
parent_window = meta_wayland_surface_get_window (xdg_popup->parent_surface);
|
||||
meta_window_get_buffer_rect (window, &buffer_rect);
|
||||
meta_window_get_buffer_rect (parent_window, &parent_buffer_rect);
|
||||
if (!meta_rectangle_overlap (&buffer_rect, &parent_buffer_rect) &&
|
||||
@ -1126,7 +1128,8 @@ meta_wayland_xdg_popup_configure (MetaWaylandShellSurface *shell_surface,
|
||||
{
|
||||
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (shell_surface);
|
||||
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_popup);
|
||||
MetaWindow *parent_window = xdg_popup->parent_surface->window;
|
||||
MetaWindow *parent_window =
|
||||
meta_wayland_surface_get_window (xdg_popup->parent_surface);
|
||||
int geometry_scale;
|
||||
int x, y;
|
||||
|
||||
@ -1160,7 +1163,8 @@ meta_wayland_xdg_popup_managed (MetaWaylandShellSurface *shell_surface,
|
||||
|
||||
g_assert (parent);
|
||||
|
||||
meta_window_set_transient_for (window, parent->window);
|
||||
meta_window_set_transient_for (window,
|
||||
meta_wayland_surface_get_window (parent));
|
||||
meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU);
|
||||
}
|
||||
|
||||
@ -1447,7 +1451,7 @@ meta_wayland_xdg_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
meta_wayland_xdg_surface_get_instance_private (xdg_surface);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWindow *window = surface->window;
|
||||
MetaWindow *window = meta_wayland_surface_get_window (surface);
|
||||
MetaWaylandSurfaceRoleClass *surface_role_class;
|
||||
|
||||
surface_role_class =
|
||||
|
Reference in New Issue
Block a user