wayland: Move calc-showing window logic to roles having windows

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
This commit is contained in:
Jonas Ådahl 2019-10-09 09:56:34 +02:00 committed by Robert Mader
parent 722ae2b77a
commit df642eb150
3 changed files with 33 additions and 6 deletions

View File

@ -146,6 +146,21 @@ meta_wayland_shell_surface_assigned (MetaWaylandSurfaceRole *surface_role)
surface_role_class->assigned (surface_role);
}
static void
meta_wayland_shell_surface_surface_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window;
window = meta_wayland_surface_get_window (surface);
if (pending->newly_attached &&
!surface->buffer_ref.buffer &&
window)
meta_window_queue (window, META_QUEUE_CALC_SHOWING);
}
static void
meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
@ -277,6 +292,8 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass)
object_class->finalize = meta_wayland_shell_surface_finalize;
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 =

View File

@ -633,12 +633,6 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
if (state->newly_attached)
{
MetaWindow *window;
window = meta_wayland_surface_get_window (surface);
if (!surface->buffer_ref.buffer && window)
meta_window_queue (window, META_QUEUE_CALC_SHOWING);
/* Always release any previously held buffer. If the buffer held is same
* as the newly attached buffer, we still need to release it here, because
* wl_surface.attach+commit and wl_buffer.release on the attached buffer

View File

@ -94,6 +94,21 @@ meta_xwayland_surface_assigned (MetaWaylandSurfaceRole *surface_role)
surface_role_class->assigned (surface_role);
}
static void
meta_xwayland_surface_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window;
window = meta_wayland_surface_get_window (surface);
if (pending->newly_attached &&
surface->buffer_ref.buffer &&
window)
meta_window_queue (window, META_QUEUE_CALC_SHOWING);
}
static void
meta_xwayland_surface_get_relative_coordinates (MetaWaylandSurfaceRole *surface_role,
float abs_x,
@ -175,6 +190,7 @@ meta_xwayland_surface_class_init (MetaXwaylandSurfaceClass *klass)
object_class->finalize = meta_xwayland_surface_finalize;
surface_role_class->assigned = meta_xwayland_surface_assigned;
surface_role_class->pre_apply_state = meta_xwayland_surface_pre_apply_state;
surface_role_class->get_relative_coordinates =
meta_xwayland_surface_get_relative_coordinates;
surface_role_class->get_toplevel = meta_xwayland_surface_get_toplevel;