diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c index f503fd5bb..c2e8c5fc7 100644 --- a/src/wayland/meta-wayland-shell-surface.c +++ b/src/wayland/meta-wayland-shell-surface.c @@ -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; diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index c20bbbe29..351bc589c 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -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)) { diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index 2f8c9bd11..bb33ce2d2 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -125,6 +125,10 @@ struct _MetaWaylandSurfaceState /* presentation-time */ struct wl_list presentation_feedback_list; + + struct { + gboolean surface_size_changed; + } derived; }; struct _MetaWaylandDragDestFuncs diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 59a0f443e..5ae8408c7 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -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); - meta_window_wayland_finish_move_resize (window, window_geometry, pending); - } + 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); diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index e7e35556b..83181c741 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -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;