[mutter/wayland] wayland-surface: Replace MetaWindowActor with MetaSurfaceActor



commit 304005e04f1dcb783cebe766fb17493090d7c867
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Nov 22 15:24:06 2013 -0500

    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 b046d23..6697ff1 100644
--- a/src/compositor/meta-surface-actor.c
+++ b/src/compositor/meta-surface-actor.c
@@ -15,6 +15,7 @@
 #include <cogl/cogl-texture-pixmap-x11.h>
 #include <meta/meta-shaped-texture.h>
 #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 45284f6..484877b 100644
--- a/src/compositor/meta-surface-actor.h
+++ b/src/compositor/meta-surface-actor.h
@@ -6,7 +6,7 @@
 #include <config.h>
 
 #include <meta/meta-shaped-texture.h>
-#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 e37d8e8..82326d2 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 7a3b786..6df5a36 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 =
@@ -2150,30 +2153,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)
 {
   MetaWindowActorPrivate *priv = self->priv;
@@ -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 deee021..f6335f8 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 25b4939..4edab87 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -29,6 +29,7 @@
 
 #include <meta/meta-cursor-tracker.h>
 #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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]