[mutter] wayland: Let shell surface role sync generic window state
- From: Jonas Ã…dahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Let shell surface role sync generic window state
- Date: Thu, 25 Aug 2016 04:45:55 +0000 (UTC)
commit f21df371902f942ff9f77abcaaf1a202207c61d1
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Jul 1 15:59:23 2016 +0800
wayland: Let shell surface role sync generic window state
Instead of having each final role do the same call, lets just make the
common role object deal with synchronizing window buffer size.
https://bugzilla.gnome.org/show_bug.cgi?id=769936
src/wayland/meta-wayland-surface.c | 48 ++++++++++++++++++++++-----------
src/wayland/meta-wayland-surface.h | 3 --
src/wayland/meta-wayland-wl-shell.c | 1 -
src/wayland/meta-wayland-xdg-shell.c | 3 --
4 files changed, 32 insertions(+), 23 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 1c41e55..4ad6e7a 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -453,22 +453,6 @@ queue_surface_actor_frame_callbacks (MetaWaylandSurface *surface,
wl_list_init (&pending->frame_callback_list);
}
-void
-meta_wayland_surface_apply_window_state (MetaWaylandSurface *surface,
- MetaWaylandPendingState *pending)
-{
- MetaSurfaceActorWayland *actor =
- META_SURFACE_ACTOR_WAYLAND (surface->surface_actor);
- MetaWindow *window = surface->window;
- MetaWaylandBuffer *buffer = surface->buffer_ref.buffer;
- CoglTexture *texture = buffer->texture;
- double scale;
-
- scale = meta_surface_actor_wayland_get_scale (actor);
- window->buffer_rect.width = cogl_texture_get_width (texture) * scale;
- window->buffer_rect.height = cogl_texture_get_height (texture) * scale;
-}
-
static void
pending_buffer_resource_destroyed (MetaWaylandBuffer *buffer,
MetaWaylandPendingState *pending)
@@ -2036,6 +2020,34 @@ meta_wayland_surface_role_actor_surface_class_init (MetaWaylandSurfaceRoleActorS
}
static void
+shell_surface_role_surface_commit (MetaWaylandSurfaceRole *surface_role,
+ MetaWaylandPendingState *pending)
+{
+ MetaWaylandSurface *surface =
+ meta_wayland_surface_role_get_surface (surface_role);
+ MetaWaylandSurfaceRoleClass *surface_role_class;
+ MetaWindow *window = surface->window;
+ MetaWaylandBuffer *buffer;
+ CoglTexture *texture;
+ MetaSurfaceActorWayland *actor;
+ double scale;
+
+ surface_role_class =
+ META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_surface_role_shell_surface_parent_class);
+ surface_role_class->commit (surface_role, pending);
+
+ buffer = surface->buffer_ref.buffer;
+ if (!buffer)
+ 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;
+}
+
+static void
meta_wayland_surface_role_shell_surface_init (MetaWaylandSurfaceRoleShellSurface *role)
{
}
@@ -2043,6 +2055,10 @@ meta_wayland_surface_role_shell_surface_init (MetaWaylandSurfaceRoleShellSurface
static void
meta_wayland_surface_role_shell_surface_class_init (MetaWaylandSurfaceRoleShellSurfaceClass *klass)
{
+ MetaWaylandSurfaceRoleClass *surface_role_class =
+ META_WAYLAND_SURFACE_ROLE_CLASS (klass);
+
+ surface_role_class->commit = shell_surface_role_surface_commit;
}
static void
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index f20e226..6c892de 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -301,9 +301,6 @@ MetaWaylandSurface * meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRo
cairo_region_t * meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface);
-void meta_wayland_surface_apply_window_state (MetaWaylandSurface *surface,
- MetaWaylandPendingState *pending);
-
void meta_wayland_surface_calculate_window_geometry (MetaWaylandSurface *surface,
MetaRectangle *total_geometry,
float parent_x,
diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c
index 0b00309..e04df47 100644
--- a/src/wayland/meta-wayland-wl-shell.c
+++ b/src/wayland/meta-wayland-wl-shell.c
@@ -595,7 +595,6 @@ wl_shell_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
if (!pending->newly_attached)
return;
- meta_wayland_surface_apply_window_state (surface, pending);
meta_wayland_surface_calculate_window_geometry (surface, &geom, 0, 0);
meta_window_wayland_move_resize (window,
NULL,
diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c
index a3e0896..6a7441d 100644
--- a/src/wayland/meta-wayland-xdg-shell.c
+++ b/src/wayland/meta-wayland-xdg-shell.c
@@ -432,8 +432,6 @@ xdg_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
if (!window)
return;
- meta_wayland_surface_apply_window_state (surface, pending);
-
if (pending->has_new_geometry)
{
/* If we have new geometry, use it. */
@@ -606,7 +604,6 @@ xdg_popup_role_commit (MetaWaylandSurfaceRole *surface_role,
if (!window)
return;
- meta_wayland_surface_apply_window_state (surface, pending);
meta_wayland_surface_calculate_window_geometry (surface, &geom, 0, 0);
meta_window_wayland_move_resize (window,
NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]