commit 740bae3161bf310b55745a0740f9910b1e216971
parent 6a909e227e18403c75651aa733d03b4c45f6f234
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 22 Apr 2014 20:14:45 -0700
compositor: Add new_surface signal
Diffstat:
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/libswc/compositor.c b/libswc/compositor.c
@@ -87,7 +87,7 @@ static struct
struct wl_global * global;
} compositor;
-const struct swc_compositor swc_compositor = {
+struct swc_compositor swc_compositor = {
.pointer_handler = &pointer_handler
};
@@ -813,6 +813,8 @@ static void create_surface(struct wl_client * client,
wl_resource_post_no_memory(resource);
return;
}
+
+ wl_signal_emit(&swc_compositor.signal.new_surface, surface);
}
static void create_region(struct wl_client * client,
@@ -864,6 +866,7 @@ bool swc_compositor_initialize()
pixman_region32_init(&compositor.damage);
pixman_region32_init(&compositor.opaque);
wl_list_init(&compositor.views);
+ wl_signal_init(&swc_compositor.signal.new_surface);
wl_signal_add(&swc.launch->event_signal, &launch_listener);
wl_list_for_each(screen, &swc.screens, link)
diff --git a/libswc/compositor.h b/libswc/compositor.h
@@ -31,7 +31,17 @@
struct swc_compositor
{
- struct pointer_handler * pointer_handler;
+ struct pointer_handler * const pointer_handler;
+ struct
+ {
+ /**
+ * Emitted when a new surface is created.
+ *
+ * The data argument of the signal refers to the swc_surface that has
+ * been created.
+ */
+ struct wl_signal new_surface;
+ } signal;
};
bool swc_compositor_initialize();
diff --git a/libswc/internal.h b/libswc/internal.h
@@ -38,7 +38,7 @@ struct swc
const struct swc_seat * const seat;
const struct swc_bindings * const bindings;
struct wl_list screens;
- const struct swc_compositor * const compositor;
+ struct swc_compositor * const compositor;
struct swc_shm * const shm;
struct swc_drm * const drm;
};
diff --git a/libswc/swc.c b/libswc/swc.c
@@ -44,7 +44,7 @@
extern struct swc_launch swc_launch;
extern const struct swc_seat swc_seat;
extern const struct swc_bindings swc_bindings;
-extern const struct swc_compositor swc_compositor;
+extern struct swc_compositor swc_compositor;
extern struct swc_drm swc_drm;
extern struct swc_shm swc_shm;