From 020ae58fe4f890a9a9ebbc8545d4b34e22aff906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 10 Jul 2015 16:14:51 +0800 Subject: [PATCH] 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 deletion(-) diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c index 4e3ae8d6e..bb8bed2ae 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 29465e709..4c569c5a3 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);