[mutter] wayland: Add "painting" signal to surface actor



commit 020ae58fe4f890a9a9ebbc8545d4b34e22aff906
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Jul 10 16:14:51 2015 +0800

    wayland: Add "painting" signal to surface actor
    
    Make MetaWaylandSurface a listener and move output state updating to
    the handler function.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744104

 src/compositor/meta-surface-actor-wayland.c |   18 +++++++++++++++++-
 src/wayland/meta-wayland-surface.c          |   13 +++++++++++++
 2 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index 4e3ae8d..bb8bed2 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -36,6 +36,14 @@
 
 #include "compositor/region-utils.h"
 
+enum {
+  PAINTING,
+
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
 struct _MetaSurfaceActorWaylandPrivate
 {
   MetaWaylandSurface *surface;
@@ -347,12 +355,13 @@ meta_surface_actor_wayland_paint (ClutterActor *actor)
   if (priv->surface)
     {
       MetaWaylandCompositor *compositor = priv->surface->compositor;
-      meta_wayland_surface_update_outputs (priv->surface);
 
       wl_list_insert_list (&compositor->frame_callbacks, &priv->frame_callback_list);
       wl_list_init (&priv->frame_callback_list);
     }
 
+  g_signal_emit (actor, signals[PAINTING], 0);
+
   CLUTTER_ACTOR_CLASS (meta_surface_actor_wayland_parent_class)->paint (actor);
 }
 
@@ -388,6 +397,13 @@ meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
   surface_actor_class->get_window = meta_surface_actor_wayland_get_window;
 
   object_class->dispose = meta_surface_actor_wayland_dispose;
+
+  signals[PAINTING] = g_signal_new ("painting",
+                                    G_TYPE_FROM_CLASS (object_class),
+                                    G_SIGNAL_RUN_LAST,
+                                    0,
+                                    NULL, NULL, NULL,
+                                    G_TYPE_NONE, 0);
 }
 
 static void
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 29465e7..4c569c5 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1073,6 +1073,13 @@ wl_surface_destructor (struct wl_resource *resource)
   meta_wayland_compositor_repick (compositor);
 }
 
+static void
+surface_actor_painting (MetaSurfaceActorWayland *surface_actor,
+                        MetaWaylandSurface      *surface)
+{
+  meta_wayland_surface_update_outputs (surface);
+}
+
 MetaWaylandSurface *
 meta_wayland_surface_create (MetaWaylandCompositor *compositor,
                              struct wl_client      *client,
@@ -1092,6 +1099,12 @@ meta_wayland_surface_create (MetaWaylandCompositor *compositor,
 
   wl_list_init (&surface->pending_frame_callback_list);
 
+  g_signal_connect_object (surface->surface_actor,
+                           "painting",
+                           G_CALLBACK (surface_actor_painting),
+                           surface,
+                           0);
+
   sync_drag_dest_funcs (surface);
 
   surface->outputs_to_destroy_notify_id = g_hash_table_new (NULL, NULL);


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