commit 740bae3

Michael Forney  ·  2014-04-23 03:14:45 +0000 UTC
parent 6a909e2
compositor: Add new_surface signal
4 files changed,  +17, -4
+4, -1
 1@@ -87,7 +87,7 @@ static struct
 2     struct wl_global * global;
 3 } compositor;
 4 
 5-const struct swc_compositor swc_compositor = {
 6+struct swc_compositor swc_compositor = {
 7     .pointer_handler = &pointer_handler
 8 };
 9 
10@@ -813,6 +813,8 @@ static void create_surface(struct wl_client * client,
11         wl_resource_post_no_memory(resource);
12         return;
13     }
14+
15+    wl_signal_emit(&swc_compositor.signal.new_surface, surface);
16 }
17 
18 static void create_region(struct wl_client * client,
19@@ -864,6 +866,7 @@ bool swc_compositor_initialize()
20     pixman_region32_init(&compositor.damage);
21     pixman_region32_init(&compositor.opaque);
22     wl_list_init(&compositor.views);
23+    wl_signal_init(&swc_compositor.signal.new_surface);
24     wl_signal_add(&swc.launch->event_signal, &launch_listener);
25 
26     wl_list_for_each(screen, &swc.screens, link)
+11, -1
 1@@ -31,7 +31,17 @@
 2 
 3 struct swc_compositor
 4 {
 5-    struct pointer_handler * pointer_handler;
 6+    struct pointer_handler * const pointer_handler;
 7+    struct
 8+    {
 9+        /**
10+         * Emitted when a new surface is created.
11+         *
12+         * The data argument of the signal refers to the swc_surface that has
13+         * been created.
14+         */
15+        struct wl_signal new_surface;
16+    } signal;
17 };
18 
19 bool swc_compositor_initialize();
+1, -1
1@@ -38,7 +38,7 @@ struct swc
2     const struct swc_seat * const seat;
3     const struct swc_bindings * const bindings;
4     struct wl_list screens;
5-    const struct swc_compositor * const compositor;
6+    struct swc_compositor * const compositor;
7     struct swc_shm * const shm;
8     struct swc_drm * const drm;
9 };
+1, -1
1@@ -44,7 +44,7 @@
2 extern struct swc_launch swc_launch;
3 extern const struct swc_seat swc_seat;
4 extern const struct swc_bindings swc_bindings;
5-extern const struct swc_compositor swc_compositor;
6+extern struct swc_compositor swc_compositor;
7 extern struct swc_drm swc_drm;
8 extern struct swc_shm swc_shm;
9