From 304005e04f1dcb783cebe766fb17493090d7c867 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 22 Nov 2013 15:24:06 -0500 Subject: [PATCH] wayland-surface: Replace MetaWindowActor with MetaSurfaceActor Since subsurfaces won't have toplevel MetaWindowActors, we need to use MetaSurfaceActor instead. These are embedded in the MetaWindowActor, just like MetaShapedTexture was (in fact, MetaSurfaceActor now contains a MetaShapedTexture) --- src/compositor/meta-surface-actor.c | 1 + src/compositor/meta-surface-actor.h | 2 +- src/compositor/meta-window-actor-private.h | 8 ---- src/compositor/meta-window-actor.c | 43 +++++----------------- src/wayland/meta-wayland-surface.c | 26 ++++++------- src/wayland/meta-wayland-surface.h | 2 + 6 files changed, 25 insertions(+), 57 deletions(-) diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c index b046d239f..6697ff1b2 100644 --- a/src/compositor/meta-surface-actor.c +++ b/src/compositor/meta-surface-actor.c @@ -15,6 +15,7 @@ #include #include #include "meta-surface-actor.h" +#include "meta-wayland-private.h" #include "meta-cullable.h" #include "meta-shaped-texture-private.h" diff --git a/src/compositor/meta-surface-actor.h b/src/compositor/meta-surface-actor.h index 45284f6f2..484877b73 100644 --- a/src/compositor/meta-surface-actor.h +++ b/src/compositor/meta-surface-actor.h @@ -6,7 +6,7 @@ #include #include -#include "meta-wayland-private.h" +#include "meta-wayland-types.h" G_BEGIN_DECLS diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h index e37d8e81e..82326d29b 100644 --- a/src/compositor/meta-window-actor-private.h +++ b/src/compositor/meta-window-actor-private.h @@ -31,14 +31,6 @@ void meta_window_actor_unmaximize (MetaWindowActor *self, void meta_window_actor_process_x11_damage (MetaWindowActor *self, XDamageNotifyEvent *event); -void meta_window_actor_process_wayland_damage (MetaWindowActor *self, - int x, - int y, - int width, - int height); -void meta_window_actor_attach_wayland_buffer (MetaWindowActor *self, - MetaWaylandBuffer *buffer); - void meta_window_actor_pre_paint (MetaWindowActor *self); void meta_window_actor_post_paint (MetaWindowActor *self); void meta_window_actor_frame_complete (MetaWindowActor *self, diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 7a3b78653..6df5a36d6 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -409,6 +409,9 @@ meta_window_actor_constructed (GObject *object) { priv->surface = meta_surface_actor_new (); + if (window->surface) + window->surface->surface_actor = priv->surface; + clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface)); priv->surface_allocation_changed_id = @@ -2149,30 +2152,6 @@ meta_window_actor_process_x11_damage (MetaWindowActor *self, } -void -meta_window_actor_process_wayland_damage (MetaWindowActor *self, - int x, - int y, - int width, - int height) -{ - MetaWindowActorPrivate *priv = self->priv; - cairo_region_t *unobscured_region; - gboolean redraw_queued; - - if (!priv->mapped) - return; - - unobscured_region = - clutter_actor_has_mapped_clones (CLUTTER_ACTOR (priv->surface)) - ? NULL : priv->unobscured_region; - redraw_queued = meta_surface_actor_damage_area (priv->surface, - x, y, width, height, - unobscured_region); - - priv->repaint_scheduled = priv->repaint_scheduled || redraw_queued; -} - void meta_window_actor_sync_visibility (MetaWindowActor *self) { @@ -2446,8 +2425,12 @@ check_needs_reshape (MetaWindowActor *self) client_area.height = priv->window->rect.height; meta_window_actor_update_shape_region (self, &client_area); - meta_window_actor_update_input_region (self, &client_area); - meta_window_actor_update_opaque_region (self); + + if (priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11) + { + meta_window_actor_update_input_region (self, &client_area); + meta_window_actor_update_opaque_region (self); + } priv->needs_reshape = FALSE; } @@ -2465,14 +2448,6 @@ meta_window_actor_update_shape (MetaWindowActor *self) clutter_actor_queue_redraw (CLUTTER_ACTOR (priv->surface)); } -void -meta_window_actor_attach_wayland_buffer (MetaWindowActor *self, - MetaWaylandBuffer *buffer) -{ - MetaWindowActorPrivate *priv = self->priv; - meta_surface_actor_attach_wayland_buffer (priv->surface, buffer); -} - static void meta_window_actor_handle_updates (MetaWindowActor *self) { diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index deee0212d..f6335f8ad 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -44,7 +44,7 @@ #include "meta-wayland-private.h" #include "meta-xwayland-private.h" #include "meta-wayland-stage.h" -#include "meta-window-actor-private.h" +#include "meta-surface-actor.h" #include "meta-wayland-seat.h" #include "meta-wayland-keyboard.h" #include "meta-wayland-pointer.h" @@ -67,8 +67,6 @@ surface_process_damage (MetaWaylandSurface *surface, if (surface->buffer_ref.buffer) { - MetaWindowActor *window_actor = - META_WINDOW_ACTOR (meta_window_get_compositor_private (surface->window)); MetaRectangle rect; cairo_rectangle_int_t cairo_rect; @@ -80,7 +78,7 @@ surface_process_damage (MetaWaylandSurface *surface, cairo_region_intersect_rectangle (region, &cairo_rect); - if (window_actor) + if (surface->surface_actor) { int i, n_rectangles = cairo_region_num_rectangles (region); @@ -90,11 +88,12 @@ surface_process_damage (MetaWaylandSurface *surface, cairo_region_get_rectangle (region, i, &rectangle); - meta_window_actor_process_wayland_damage (window_actor, - rectangle.x, - rectangle.y, - rectangle.width, - rectangle.height); + meta_surface_actor_damage_area (surface->surface_actor, + rectangle.x, + rectangle.y, + rectangle.width, + rectangle.height, + NULL); } } } @@ -278,6 +277,7 @@ cursor_surface_commit (MetaWaylandSurface *surface) static void toplevel_surface_commit (MetaWaylandSurface *surface) { + MetaSurfaceActor *surface_actor = surface->surface_actor; MetaWindow *window = surface->window; MetaWaylandBuffer *buffer = surface->pending.buffer; @@ -291,9 +291,7 @@ toplevel_surface_commit (MetaWaylandSurface *surface) if (buffer != NULL) { - MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window)); - - meta_window_actor_attach_wayland_buffer (window_actor, buffer); + meta_surface_actor_attach_wayland_buffer (surface_actor, buffer); /* We resize X based surfaces according to X events */ if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND) @@ -316,9 +314,9 @@ toplevel_surface_commit (MetaWaylandSurface *surface) surface_process_damage (surface, surface->pending.damage); if (surface->pending.opaque_region) - meta_window_set_opaque_region (window, surface->pending.opaque_region); + meta_surface_actor_set_opaque_region (surface_actor, surface->pending.opaque_region); if (surface->pending.input_region) - meta_window_set_input_region (window, surface->pending.input_region); + meta_surface_actor_set_input_region (surface_actor, surface->pending.input_region); } static void diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index 25b493927..4edab8770 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -29,6 +29,7 @@ #include #include "meta-wayland-types.h" +#include "meta-surface-actor.h" struct _MetaWaylandBuffer { @@ -77,6 +78,7 @@ struct _MetaWaylandSurface struct wl_resource *resource; MetaWaylandCompositor *compositor; MetaWaylandBufferReference buffer_ref; + MetaSurfaceActor *surface_actor; MetaWindow *window; MetaWaylandSurfaceExtension xdg_surface; MetaWaylandSurfaceExtension xdg_popup;