window/wayland: Update buffer and frame rect in the same place
First make sure we call 'move_resize()' in all cases where the size or position can change, then move the updating of the buffer rect to the same place as we update the frame rect. This means keeping track of surface size changes, in addition to geometry changes, and calling finish_move_resize() whenever any of those changes, in addition to acknowledged configurations. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
This commit is contained in:
parent
5be8c50746
commit
6cbc518089
@ -219,43 +219,6 @@ meta_wayland_shell_surface_surface_pre_apply_state (MetaWaylandSurfaceRole *sur
|
||||
meta_window_queue (priv->window, META_QUEUE_CALC_SHOWING);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandSurfaceState *pending)
|
||||
{
|
||||
MetaWaylandShellSurface *shell_surface =
|
||||
META_WAYLAND_SHELL_SURFACE (surface_role);
|
||||
MetaWaylandShellSurfacePrivate *priv =
|
||||
meta_wayland_shell_surface_get_instance_private (shell_surface);
|
||||
MetaWaylandActorSurface *actor_surface =
|
||||
META_WAYLAND_ACTOR_SURFACE (surface_role);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWaylandSurfaceRoleClass *surface_role_class;
|
||||
MetaWindow *window;
|
||||
MetaWaylandBuffer *buffer;
|
||||
int geometry_scale;
|
||||
|
||||
surface_role_class =
|
||||
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_shell_surface_parent_class);
|
||||
surface_role_class->apply_state (surface_role, pending);
|
||||
|
||||
buffer = surface->buffer_ref->buffer;
|
||||
if (!buffer)
|
||||
return;
|
||||
|
||||
window = priv->window;
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
geometry_scale = meta_wayland_actor_surface_get_geometry_scale (actor_surface);
|
||||
|
||||
window->buffer_rect.width =
|
||||
meta_wayland_surface_get_width (surface) * geometry_scale;
|
||||
window->buffer_rect.height =
|
||||
meta_wayland_surface_get_height (surface) * geometry_scale;
|
||||
}
|
||||
|
||||
static MetaWindow *
|
||||
meta_wayland_shell_surface_get_window (MetaWaylandSurfaceRole *surface_role)
|
||||
{
|
||||
@ -367,8 +330,6 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass)
|
||||
surface_role_class->assigned = meta_wayland_shell_surface_assigned;
|
||||
surface_role_class->pre_apply_state =
|
||||
meta_wayland_shell_surface_surface_pre_apply_state;
|
||||
surface_role_class->apply_state =
|
||||
meta_wayland_shell_surface_surface_apply_state;
|
||||
surface_role_class->notify_subsurface_state_changed =
|
||||
meta_wayland_shell_surface_notify_subsurface_state_changed;
|
||||
surface_role_class->get_window = meta_wayland_shell_surface_get_window;
|
||||
|
@ -716,6 +716,10 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
|
||||
{
|
||||
MetaWaylandSurface *subsurface_surface;
|
||||
gboolean had_damage = FALSE;
|
||||
int old_width, old_height;
|
||||
|
||||
old_width = meta_wayland_surface_get_width (surface);
|
||||
old_height = meta_wayland_surface_get_height (surface);
|
||||
|
||||
g_signal_emit (surface, surface_signals[SURFACE_PRE_STATE_APPLIED], 0);
|
||||
|
||||
@ -823,6 +827,10 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
|
||||
surface->viewport.has_dst_size = surface->viewport.dst_width > 0;
|
||||
}
|
||||
|
||||
state->derived.surface_size_changed =
|
||||
meta_wayland_surface_get_width (surface) != old_width ||
|
||||
meta_wayland_surface_get_height (surface) != old_height;
|
||||
|
||||
if (!cairo_region_is_empty (state->surface_damage) ||
|
||||
!cairo_region_is_empty (state->buffer_damage))
|
||||
{
|
||||
|
@ -125,6 +125,10 @@ struct _MetaWaylandSurfaceState
|
||||
|
||||
/* presentation-time */
|
||||
struct wl_list presentation_feedback_list;
|
||||
|
||||
struct {
|
||||
gboolean surface_size_changed;
|
||||
} derived;
|
||||
};
|
||||
|
||||
struct _MetaWaylandDragDestFuncs
|
||||
|
@ -836,7 +836,9 @@ meta_wayland_xdg_toplevel_post_apply_state (MetaWaylandSurfaceRole *surface_rol
|
||||
window_geometry = meta_wayland_xdg_surface_get_window_geometry (xdg_surface);
|
||||
geometry_changed = !meta_rectangle_equal (&old_geometry, &window_geometry);
|
||||
|
||||
if (geometry_changed || pending->has_acked_configure_serial)
|
||||
if (geometry_changed ||
|
||||
pending->derived.surface_size_changed ||
|
||||
pending->has_acked_configure_serial)
|
||||
{
|
||||
meta_window_wayland_finish_move_resize (window, window_geometry, pending);
|
||||
}
|
||||
@ -1174,10 +1176,14 @@ meta_wayland_xdg_popup_post_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWaylandXdgSurfacePrivate *xdg_surface_priv =
|
||||
meta_wayland_xdg_surface_get_instance_private (xdg_surface);
|
||||
MetaWaylandSurfaceRoleClass *surface_role_class =
|
||||
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_popup_parent_class);
|
||||
MetaWindow *window;
|
||||
MetaWindow *parent_window;
|
||||
MetaRectangle old_geometry;
|
||||
MetaRectangle window_geometry;
|
||||
MetaRectangle buffer_rect;
|
||||
MetaRectangle parent_buffer_rect;
|
||||
|
||||
@ -1190,13 +1196,12 @@ meta_wayland_xdg_popup_post_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
|
||||
surface_role_class->post_apply_state (surface_role, pending);
|
||||
|
||||
if (pending->has_acked_configure_serial)
|
||||
{
|
||||
MetaRectangle window_geometry;
|
||||
|
||||
window_geometry = meta_wayland_xdg_surface_get_window_geometry (xdg_surface);
|
||||
old_geometry = xdg_surface_priv->geometry;
|
||||
if (!meta_rectangle_equal (&old_geometry, &window_geometry) ||
|
||||
pending->derived.surface_size_changed ||
|
||||
pending->has_acked_configure_serial)
|
||||
meta_window_wayland_finish_move_resize (window, window_geometry, pending);
|
||||
}
|
||||
|
||||
parent_window = meta_wayland_surface_get_window (xdg_popup->parent_surface);
|
||||
meta_window_get_buffer_rect (window, &buffer_rect);
|
||||
|
@ -293,6 +293,15 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
||||
window->rect.height = unconstrained_rect.height;
|
||||
}
|
||||
|
||||
window->buffer_rect.width =
|
||||
window->rect.width +
|
||||
window->custom_frame_extents.left +
|
||||
window->custom_frame_extents.right;
|
||||
window->buffer_rect.height =
|
||||
window->rect.height +
|
||||
window->custom_frame_extents.top +
|
||||
window->custom_frame_extents.bottom;
|
||||
|
||||
/* This is a commit of an attach. We should move the window to match the
|
||||
* new position the client wants. */
|
||||
can_move_now = TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user