summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-07-15 17:44:21 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-08-25 12:19:40 +0800
commitdc03b3aa474a77bca319b8b96f2e572b4a62d7a0 (patch)
tree155e0dac0550f40c12cb4fb65c592b0e60af789f
parentef3e036b45facfa8aa755eadd289ae8ab23ced5b (diff)
downloadmutter-dc03b3aa474a77bca319b8b96f2e572b4a62d7a0.tar.gz
xdg-shell: Don't early out of role commit before calling parent impl
Make sure to always call the parent role commit vfunc, so that they can handle updating their state properly. This means other places need to handle the situation where surface->window is NULL on commit. This may for example happen when the parent of a modal dialog is unmapped or NULL is attached to a wl_shell_surface. https://bugzilla.gnome.org/show_bug.cgi?id=769936
-rw-r--r--src/wayland/meta-wayland-surface.c14
-rw-r--r--src/wayland/meta-wayland-xdg-shell.c8
2 files changed, 15 insertions, 7 deletions
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 4ad6e7ab0..1819d36a6 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1997,10 +1997,13 @@ actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
+ queue_surface_actor_frame_callbacks (surface, pending);
+
+ if (!surface->window)
+ return;
+
meta_surface_actor_wayland_sync_state (
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor));
-
- queue_surface_actor_frame_callbacks (surface, pending);
}
static void
@@ -2026,7 +2029,7 @@ shell_surface_role_surface_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandSurfaceRoleClass *surface_role_class;
- MetaWindow *window = surface->window;
+ MetaWindow *window;
MetaWaylandBuffer *buffer;
CoglTexture *texture;
MetaSurfaceActorWayland *actor;
@@ -2040,9 +2043,14 @@ shell_surface_role_surface_commit (MetaWaylandSurfaceRole *surface_role,
if (!buffer)
return;
+ window = surface->window;
+ if (!window)
+ return;
+
actor = META_SURFACE_ACTOR_WAYLAND (surface->surface_actor);
scale = meta_surface_actor_wayland_get_scale (actor);
texture = buffer->texture;
+
window->buffer_rect.width = cogl_texture_get_width (texture) * scale;
window->buffer_rect.height = cogl_texture_get_height (texture) * scale;
}
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index e8c56bb85..f2d8572ad 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -751,14 +751,14 @@ xdg_popup_role_commit (MetaWaylandSurfaceRole *surface_role,
if (xdg_popup->setup.parent_surface)
finish_popup_setup (xdg_popup);
- /* If the window disappeared the surface is not coming back. */
- if (!surface->window)
- return;
-
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_popup_parent_class);
surface_role_class->commit (surface_role, pending);
+ /* If the window disappeared the surface is not coming back. */
+ if (!surface->window)
+ return;
+
if (!pending->newly_attached)
return;