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
This commit is contained in:
Jonas Ådahl 2015-07-10 16:14:51 +08:00
parent 525644059d
commit 020ae58fe4
2 changed files with 30 additions and 1 deletions

View File

@ -36,6 +36,14 @@
#include "compositor/region-utils.h" #include "compositor/region-utils.h"
enum {
PAINTING,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
struct _MetaSurfaceActorWaylandPrivate struct _MetaSurfaceActorWaylandPrivate
{ {
MetaWaylandSurface *surface; MetaWaylandSurface *surface;
@ -347,12 +355,13 @@ meta_surface_actor_wayland_paint (ClutterActor *actor)
if (priv->surface) if (priv->surface)
{ {
MetaWaylandCompositor *compositor = priv->surface->compositor; 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_insert_list (&compositor->frame_callbacks, &priv->frame_callback_list);
wl_list_init (&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); 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; surface_actor_class->get_window = meta_surface_actor_wayland_get_window;
object_class->dispose = meta_surface_actor_wayland_dispose; 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 static void

View File

@ -1073,6 +1073,13 @@ wl_surface_destructor (struct wl_resource *resource)
meta_wayland_compositor_repick (compositor); meta_wayland_compositor_repick (compositor);
} }
static void
surface_actor_painting (MetaSurfaceActorWayland *surface_actor,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs (surface);
}
MetaWaylandSurface * MetaWaylandSurface *
meta_wayland_surface_create (MetaWaylandCompositor *compositor, meta_wayland_surface_create (MetaWaylandCompositor *compositor,
struct wl_client *client, struct wl_client *client,
@ -1092,6 +1099,12 @@ meta_wayland_surface_create (MetaWaylandCompositor *compositor,
wl_list_init (&surface->pending_frame_callback_list); 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); sync_drag_dest_funcs (surface);
surface->outputs_to_destroy_notify_id = g_hash_table_new (NULL, NULL); surface->outputs_to_destroy_notify_id = g_hash_table_new (NULL, NULL);