commit ac131cb
Michael Forney
·
2013-09-11 23:49:55 +0000 UTC
parent 787e0ff
compositor_surface: Handle surface resize
1 files changed,
+22,
-0
+22,
-0
1@@ -137,6 +137,27 @@ static void update_outputs(struct swc_surface * surface)
2 surface->outputs = new_outputs;
3 }
4
5+static void handle_surface_event(struct wl_listener * listener, void * data)
6+{
7+ struct swc_compositor_surface_state * state
8+ = swc_container_of(listener, typeof(*state), event_listener);
9+ struct swc_event * event = data;
10+ struct swc_surface_event_data * event_data = event->data;
11+ struct swc_surface * surface = event_data->surface;
12+
13+ switch (event->type)
14+ {
15+ case SWC_SURFACE_EVENT_TYPE_RESIZE:
16+ damage_below_surface(surface);
17+
18+ update_extents(surface);
19+ update(surface);
20+ update_outputs(surface);
21+
22+ break;
23+ }
24+}
25+
26 /* Compositor class */
27 bool add(struct swc_surface * surface)
28 {
29@@ -158,6 +179,7 @@ bool add(struct swc_surface * surface)
30 state->border.color = 0x000000;
31 state->border.damaged = false;
32 state->mapped = false;
33+ state->event_listener.notify = &handle_surface_event;
34
35 wl_signal_add(&surface->event_signal, &state->event_listener);
36