commit 9495eec
Michael Forney
·
2013-12-21 20:54:16 +0000 UTC
parent 255b466
Move compositor view to compositor.c
8 files changed,
+345,
-424
+336,
-6
1@@ -1,6 +1,5 @@
2 #include "swc.h"
3 #include "compositor.h"
4-#include "compositor_surface.h"
5 #include "cursor_surface.h"
6 #include "data_device_manager.h"
7 #include "drm.h"
8@@ -20,6 +19,29 @@
9 #include <wld/drm.h>
10 #include <xkbcommon/xkbcommon-keysyms.h>
11
12+struct surface_state
13+{
14+ struct swc_compositor * compositor;
15+
16+ /* The box that the surface covers (including it's border). */
17+ pixman_box32_t extents;
18+
19+ /* The region that is covered by opaque regions of surfaces above this
20+ * surface. */
21+ pixman_region32_t clip;
22+
23+ struct
24+ {
25+ uint32_t width;
26+ uint32_t color;
27+ bool damaged;
28+ } border;
29+
30+ bool mapped;
31+
32+ struct wl_listener event_listener;
33+};
34+
35 /* Rendering {{{ */
36
37 struct buffer_state
38@@ -93,7 +115,7 @@ static void repaint_surface(struct render_target * target,
39 pixman_region32_t border_damage;
40 pixman_region32_t surface_region;
41 struct buffer_state * state;
42- struct swc_compositor_surface_state * surface_state = surface->view_state;
43+ struct surface_state * surface_state = surface->view_state;
44
45 if (!surface->state.buffer)
46 return;
47@@ -174,8 +196,8 @@ static void renderer_repaint(struct render_target * target,
48 wld_flush(target->drawable);
49 }
50
51-void swc_compositor_attach(struct swc_surface * surface,
52- struct wl_resource * resource)
53+static void renderer_attach(struct swc_surface * surface,
54+ struct wl_resource * resource)
55 {
56 struct buffer_state * state;
57 struct wl_shm_buffer * shm_buffer;
58@@ -244,10 +266,318 @@ static void renderer_flush_surface(struct swc_surface * surface)
59
60 /* }}} */
61
62+/* Surface Views {{{ */
63+
64+/**
65+ * Adds damage from the region below a surface, taking into account it's clip
66+ * region, to the region specified by `damage'.
67+ */
68+static void damage_below_surface(struct swc_surface * surface)
69+{
70+ struct swc_compositor * compositor = CONTAINER_OF
71+ (surface->view, typeof(*compositor), compositor_view);
72+ struct surface_state * state = surface->view_state;
73+ pixman_region32_t damage_below;
74+
75+ pixman_region32_init_with_extents(&damage_below, &state->extents);
76+ pixman_region32_subtract(&damage_below, &damage_below, &state->clip);
77+ pixman_region32_union(&compositor->damage, &compositor->damage,
78+ &damage_below);
79+ pixman_region32_fini(&damage_below);
80+}
81+
82+/**
83+ * Completely damages the surface and its border.
84+ */
85+static void damage_surface(struct swc_surface * surface)
86+{
87+ struct surface_state * state = surface->view_state;
88+ printf("damaging surface\n");
89+
90+ pixman_region32_fini(&surface->state.damage);
91+ pixman_region32_init_rect(&surface->state.damage, 0, 0,
92+ surface->geometry.width,
93+ surface->geometry.height);
94+ state->border.damaged = true;
95+}
96+
97+static void update_extents(struct swc_surface * surface)
98+{
99+ struct surface_state * state = surface->view_state;
100+
101+ state->extents.x1 = surface->geometry.x - state->border.width;
102+ state->extents.y1 = surface->geometry.y - state->border.width;
103+ state->extents.x2 = surface->geometry.x + surface->geometry.width
104+ + state->border.width;
105+ state->extents.y2 = surface->geometry.y + surface->geometry.height
106+ + state->border.width;
107+
108+ /* Damage border. */
109+ state->border.damaged = true;
110+}
111+
112+static void update_outputs(struct swc_surface * surface)
113+{
114+ struct swc_compositor * compositor = CONTAINER_OF
115+ (surface->view, typeof(*compositor), compositor_view);
116+ struct surface_state * state = surface->view_state;
117+ uint32_t old_outputs = surface->outputs, new_outputs = 0,
118+ entered_outputs, left_outputs, changed_outputs;
119+ struct swc_output * output;
120+ struct wl_client * client;
121+ struct wl_resource * resource;
122+
123+ if (state->mapped)
124+ {
125+ wl_list_for_each(output, &compositor->outputs, link)
126+ {
127+ if (swc_rectangle_overlap(&output->geometry, &surface->geometry))
128+ new_outputs |= SWC_OUTPUT_MASK(output);
129+ }
130+ }
131+
132+ if (new_outputs == old_outputs)
133+ return;
134+
135+ entered_outputs = new_outputs & ~old_outputs;
136+ left_outputs = old_outputs & ~new_outputs;
137+ changed_outputs = old_outputs ^ new_outputs;
138+
139+ wl_list_for_each(output, &compositor->outputs, link)
140+ {
141+ if (!(changed_outputs & SWC_OUTPUT_MASK(output)))
142+ continue;
143+
144+ client = wl_resource_get_client(surface->resource);
145+ resource = wl_resource_find_for_client(&output->resources, client);
146+
147+ if (resource)
148+ {
149+ if (entered_outputs & SWC_OUTPUT_MASK(output))
150+ wl_surface_send_enter(surface->resource, resource);
151+ else if (left_outputs & SWC_OUTPUT_MASK(output))
152+ wl_surface_send_leave(surface->resource, resource);
153+ }
154+ }
155+
156+ surface->outputs = new_outputs;
157+}
158+
159+static void update(struct swc_surface * surface);
160+
161+static void handle_surface_event(struct wl_listener * listener, void * data)
162+{
163+ struct surface_state * state
164+ = CONTAINER_OF(listener, typeof(*state), event_listener);
165+ struct swc_event * event = data;
166+ struct swc_surface_event_data * event_data = event->data;
167+ struct swc_surface * surface = event_data->surface;
168+
169+ switch (event->type)
170+ {
171+ case SWC_SURFACE_EVENT_TYPE_RESIZE:
172+ damage_below_surface(surface);
173+
174+ update_extents(surface);
175+ update(surface);
176+ update_outputs(surface);
177+
178+ break;
179+ }
180+}
181+
182+static bool add(struct swc_surface * surface)
183+{
184+ struct swc_compositor * compositor = CONTAINER_OF
185+ (surface->view, typeof(*compositor), compositor_view);
186+ struct surface_state * state;
187+
188+ state = malloc(sizeof *state);
189+
190+ if (!state)
191+ return false;
192+
193+ state->compositor = compositor;
194+ state->extents.x1 = surface->geometry.x;
195+ state->extents.y1 = surface->geometry.y;
196+ state->extents.x2 = surface->geometry.x + surface->geometry.width;
197+ state->extents.y2 = surface->geometry.y + surface->geometry.height;
198+ state->border.width = 0;
199+ state->border.color = 0x000000;
200+ state->border.damaged = false;
201+ state->mapped = false;
202+ state->event_listener.notify = &handle_surface_event;
203+
204+ wl_signal_add(&surface->event_signal, &state->event_listener);
205+
206+ pixman_region32_init(&state->clip);
207+
208+ surface->view_state = state;
209+
210+ return true;
211+}
212+
213+static void remove_(struct swc_surface * surface)
214+{
215+ struct swc_compositor * compositor = CONTAINER_OF
216+ (surface->view, typeof(*compositor), compositor_view);
217+ struct surface_state * state = surface->view_state;
218+
219+ swc_compositor_surface_hide(surface);
220+
221+ wl_list_remove(&state->event_listener.link);
222+ pixman_region32_fini(&state->clip);
223+
224+ free(state);
225+}
226+
227+static void attach(struct swc_surface * surface, struct wl_resource * resource)
228+{
229+ renderer_attach(surface, resource);
230+}
231+
232+static void update(struct swc_surface * surface)
233+{
234+ struct swc_compositor * compositor = CONTAINER_OF
235+ (surface->view, typeof(*compositor), compositor_view);
236+ struct surface_state * state = surface->view_state;
237+ struct swc_output * output;
238+
239+ if (!state->mapped)
240+ return;
241+
242+ wl_list_for_each(output, &compositor->outputs, link)
243+ {
244+ if (surface->outputs & SWC_OUTPUT_MASK(output))
245+ swc_compositor_schedule_update(compositor, output);
246+ }
247+}
248+
249+static void move(struct swc_surface * surface, int32_t x, int32_t y)
250+{
251+ struct swc_compositor * compositor = CONTAINER_OF
252+ (surface->view, typeof(*compositor), compositor_view);
253+ struct surface_state * state = surface->view_state;
254+
255+ if (x == surface->geometry.x && y == surface->geometry.y)
256+ return;
257+
258+ if (state->mapped)
259+ damage_below_surface(surface);
260+
261+ surface->geometry.x = x;
262+ surface->geometry.y = y;
263+
264+ update_extents(surface);
265+
266+ if (state->mapped)
267+ {
268+ /* Assume worst-case no clipping until we draw the next frame (in case
269+ * the surface gets moved again before that). */
270+ pixman_region32_init(&state->clip);
271+
272+ damage_below_surface(surface);
273+ update(surface);
274+ update_outputs(surface);
275+ update(surface);
276+ }
277+}
278+
279+const struct swc_view_impl view_impl = {
280+ .add = &add,
281+ .remove = &remove_,
282+ .attach = &attach,
283+ .update = &update,
284+ .move = &move
285+};
286+
287+void swc_compositor_surface_show(struct swc_surface * surface)
288+{
289+ struct swc_compositor * compositor = CONTAINER_OF
290+ (surface->view, typeof(*compositor), compositor_view);
291+ struct surface_state * state = surface->view_state;
292+
293+ if (surface->view->impl != &view_impl)
294+ return;
295+
296+ if (state->mapped)
297+ return;
298+
299+ printf("showing surface %u\n", wl_resource_get_id(surface->resource));
300+
301+ state->mapped = true;
302+
303+ /* Assume worst-case no clipping until we draw the next frame (in case the
304+ * surface gets moved before that. */
305+ pixman_region32_clear(&state->clip);
306+
307+ damage_surface(surface);
308+ update_outputs(surface);
309+ update(surface);
310+ wl_list_insert(&compositor->surfaces, &surface->link);
311+}
312+
313+void swc_compositor_surface_hide(struct swc_surface * surface)
314+{
315+ struct swc_compositor * compositor = CONTAINER_OF
316+ (surface->view, typeof(*compositor), compositor_view);
317+ struct surface_state * state = surface->view_state;
318+
319+ if (surface->view->impl != &view_impl)
320+ return;
321+
322+ if (!state->mapped)
323+ return;
324+
325+ /* Update all the outputs the surface was on. */
326+ update(surface);
327+
328+ state->mapped = false;
329+
330+ damage_below_surface(surface);
331+ update_outputs(surface);
332+ wl_list_remove(&surface->link);
333+}
334+
335+void swc_compositor_surface_set_border_width(struct swc_surface * surface,
336+ uint32_t width)
337+{
338+ struct surface_state * state = surface->view_state;
339+
340+ if (state->border.width == width)
341+ return;
342+
343+ state->border.width = width;
344+ state->border.damaged = true;
345+
346+ /* XXX: Damage above surface for transparent surfaces? */
347+
348+ update_extents(surface);
349+ update(surface);
350+}
351+
352+void swc_compositor_surface_set_border_color(struct swc_surface * surface,
353+ uint32_t color)
354+{
355+ struct surface_state * state = surface->view_state;
356+
357+ if (state->border.color == color)
358+ return;
359+
360+ state->border.color = color;
361+ state->border.damaged = true;
362+
363+ /* XXX: Damage above surface for transparent surfaces? */
364+
365+ update(surface);
366+}
367+
368+/* }}} */
369+
370 static void calculate_damage(struct swc_compositor * compositor)
371 {
372 struct swc_surface * surface;
373- struct swc_compositor_surface_state * state;
374+ struct surface_state * state;
375 pixman_region32_t surface_opaque;
376
377 pixman_region32_clear(&compositor->opaque);
378@@ -561,7 +891,7 @@ bool swc_compositor_initialize(struct swc_compositor * compositor,
379 compositor->pointer_listener.notify = &handle_pointer_event;
380 compositor->scheduled_updates = 0;
381 compositor->pending_flips = 0;
382- compositor->compositor_view.impl = &swc_compositor_view_impl;
383+ compositor->compositor_view.impl = &view_impl;
384 compositor->cursor_view.impl = &swc_cursor_view_impl;
385 compositor->pointer_handler = (struct swc_pointer_handler) {
386 .focus = &handle_focus,
+6,
-2
1@@ -51,8 +51,12 @@ void swc_compositor_add_globals(struct swc_compositor * compositor,
2 void swc_compositor_schedule_update(struct swc_compositor * compositor,
3 struct swc_output * output);
4
5-void swc_compositor_attach(struct swc_surface * surface,
6- struct wl_resource * resource);
7+void swc_compositor_surface_show(struct swc_surface * surface);
8+void swc_compositor_surface_hide(struct swc_surface * surface);
9+void swc_compositor_surface_set_border_color(struct swc_surface * surface,
10+ uint32_t color);
11+void swc_compositor_surface_set_border_width(struct swc_surface * surface,
12+ uint32_t width);
13
14 #endif
15
+0,
-341
1@@ -1,341 +0,0 @@
2-/* swc: compositor_surface.c
3- *
4- * Copyright (c) 2013 Michael Forney
5- *
6- * Permission is hereby granted, free of charge, to any person obtaining a copy
7- * of this software and associated documentation files (the "Software"), to deal
8- * in the Software without restriction, including without limitation the rights
9- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10- * copies of the Software, and to permit persons to whom the Software is
11- * furnished to do so, subject to the following conditions:
12- *
13- * The above copyright notice and this permission notice shall be included in
14- * all copies or substantial portions of the Software.
15- *
16- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22- * SOFTWARE.
23- */
24-
25-#include "compositor_surface.h"
26-#include "compositor.h"
27-#include "event.h"
28-#include "output.h"
29-#include "util.h"
30-
31-#include <stdio.h>
32-#include <stdlib.h>
33-
34-static bool add(struct swc_surface * surface);
35-static void remove_(struct swc_surface * surface);
36-static void attach(struct swc_surface * surface, struct wl_resource * resource);
37-static void update(struct swc_surface * surface);
38-static void move(struct swc_surface * surface, int32_t x, int32_t y);
39-
40-const struct swc_view_impl swc_compositor_view_impl = {
41- .add = &add,
42- .remove = &remove_,
43- .attach = &attach,
44- .update = &update,
45- .move = &move
46-};
47-
48-/**
49- * Adds damage from the region below a surface, taking into account it's clip
50- * region, to the region specified by `damage'.
51- */
52-static void damage_below_surface(struct swc_surface * surface)
53-{
54- struct swc_compositor * compositor = CONTAINER_OF
55- (surface->view, typeof(*compositor), compositor_view);
56- struct swc_compositor_surface_state * state = surface->view_state;
57- pixman_region32_t damage_below;
58-
59- pixman_region32_init_with_extents(&damage_below, &state->extents);
60- pixman_region32_subtract(&damage_below, &damage_below, &state->clip);
61- pixman_region32_union(&compositor->damage, &compositor->damage,
62- &damage_below);
63- pixman_region32_fini(&damage_below);
64-}
65-
66-/**
67- * Completely damages the surface and its border.
68- */
69-static void damage_surface(struct swc_surface * surface)
70-{
71- struct swc_compositor_surface_state * state = surface->view_state;
72- printf("damaging surface\n");
73-
74- pixman_region32_fini(&surface->state.damage);
75- pixman_region32_init_rect(&surface->state.damage, 0, 0,
76- surface->geometry.width,
77- surface->geometry.height);
78- state->border.damaged = true;
79-}
80-
81-static void update_extents(struct swc_surface * surface)
82-{
83- struct swc_compositor_surface_state * state = surface->view_state;
84-
85- state->extents.x1 = surface->geometry.x - state->border.width;
86- state->extents.y1 = surface->geometry.y - state->border.width;
87- state->extents.x2 = surface->geometry.x + surface->geometry.width
88- + state->border.width;
89- state->extents.y2 = surface->geometry.y + surface->geometry.height
90- + state->border.width;
91-
92- /* Damage border. */
93- state->border.damaged = true;
94-}
95-
96-static void update_outputs(struct swc_surface * surface)
97-{
98- struct swc_compositor * compositor = CONTAINER_OF
99- (surface->view, typeof(*compositor), compositor_view);
100- struct swc_compositor_surface_state * state = surface->view_state;
101- uint32_t old_outputs = surface->outputs, new_outputs = 0,
102- entered_outputs, left_outputs, changed_outputs;
103- struct swc_output * output;
104- struct wl_client * client;
105- struct wl_resource * resource;
106-
107- if (state->mapped)
108- {
109- wl_list_for_each(output, &compositor->outputs, link)
110- {
111- if (swc_rectangle_overlap(&output->geometry, &surface->geometry))
112- new_outputs |= SWC_OUTPUT_MASK(output);
113- }
114- }
115-
116- if (new_outputs == old_outputs)
117- return;
118-
119- entered_outputs = new_outputs & ~old_outputs;
120- left_outputs = old_outputs & ~new_outputs;
121- changed_outputs = old_outputs ^ new_outputs;
122-
123- wl_list_for_each(output, &compositor->outputs, link)
124- {
125- if (!(changed_outputs & SWC_OUTPUT_MASK(output)))
126- continue;
127-
128- client = wl_resource_get_client(surface->resource);
129- resource = wl_resource_find_for_client(&output->resources, client);
130-
131- if (resource)
132- {
133- if (entered_outputs & SWC_OUTPUT_MASK(output))
134- wl_surface_send_enter(surface->resource, resource);
135- else if (left_outputs & SWC_OUTPUT_MASK(output))
136- wl_surface_send_leave(surface->resource, resource);
137- }
138- }
139-
140- surface->outputs = new_outputs;
141-}
142-
143-static void handle_surface_event(struct wl_listener * listener, void * data)
144-{
145- struct swc_compositor_surface_state * state
146- = CONTAINER_OF(listener, typeof(*state), event_listener);
147- struct swc_event * event = data;
148- struct swc_surface_event_data * event_data = event->data;
149- struct swc_surface * surface = event_data->surface;
150-
151- switch (event->type)
152- {
153- case SWC_SURFACE_EVENT_TYPE_RESIZE:
154- damage_below_surface(surface);
155-
156- update_extents(surface);
157- update(surface);
158- update_outputs(surface);
159-
160- break;
161- }
162-}
163-
164-/* Compositor view */
165-bool add(struct swc_surface * surface)
166-{
167- struct swc_compositor * compositor = CONTAINER_OF
168- (surface->view, typeof(*compositor), compositor_view);
169- struct swc_compositor_surface_state * state;
170-
171- state = malloc(sizeof *state);
172-
173- if (!state)
174- return false;
175-
176- state->compositor = compositor;
177- state->extents.x1 = surface->geometry.x;
178- state->extents.y1 = surface->geometry.y;
179- state->extents.x2 = surface->geometry.x + surface->geometry.width;
180- state->extents.y2 = surface->geometry.y + surface->geometry.height;
181- state->border.width = 0;
182- state->border.color = 0x000000;
183- state->border.damaged = false;
184- state->mapped = false;
185- state->event_listener.notify = &handle_surface_event;
186-
187- wl_signal_add(&surface->event_signal, &state->event_listener);
188-
189- pixman_region32_init(&state->clip);
190-
191- surface->view_state = state;
192-
193- return true;
194-}
195-
196-void remove_(struct swc_surface * surface)
197-{
198- struct swc_compositor * compositor = CONTAINER_OF
199- (surface->view, typeof(*compositor), compositor_view);
200- struct swc_compositor_surface_state * state = surface->view_state;
201-
202- swc_compositor_surface_hide(surface);
203-
204- wl_list_remove(&state->event_listener.link);
205- pixman_region32_fini(&state->clip);
206-
207- free(state);
208-}
209-
210-void attach(struct swc_surface * surface, struct wl_resource * resource)
211-{
212- swc_compositor_attach(surface, resource);
213-}
214-
215-void update(struct swc_surface * surface)
216-{
217- struct swc_compositor * compositor = CONTAINER_OF
218- (surface->view, typeof(*compositor), compositor_view);
219- struct swc_compositor_surface_state * state = surface->view_state;
220- struct swc_output * output;
221-
222- if (!state->mapped)
223- return;
224-
225- wl_list_for_each(output, &compositor->outputs, link)
226- {
227- if (surface->outputs & SWC_OUTPUT_MASK(output))
228- swc_compositor_schedule_update(compositor, output);
229- }
230-}
231-
232-void move(struct swc_surface * surface, int32_t x, int32_t y)
233-{
234- struct swc_compositor * compositor = CONTAINER_OF
235- (surface->view, typeof(*compositor), compositor_view);
236- struct swc_compositor_surface_state * state = surface->view_state;
237-
238- if (x == surface->geometry.x && y == surface->geometry.y)
239- return;
240-
241- if (state->mapped)
242- damage_below_surface(surface);
243-
244- surface->geometry.x = x;
245- surface->geometry.y = y;
246-
247- update_extents(surface);
248-
249- if (state->mapped)
250- {
251- /* Assume worst-case no clipping until we draw the next frame (in case
252- * the surface gets moved again before that). */
253- pixman_region32_init(&state->clip);
254-
255- damage_below_surface(surface);
256- update(surface);
257- update_outputs(surface);
258- update(surface);
259- }
260-}
261-
262-void swc_compositor_surface_show(struct swc_surface * surface)
263-{
264- struct swc_compositor * compositor = CONTAINER_OF
265- (surface->view, typeof(*compositor), compositor_view);
266- struct swc_compositor_surface_state * state = surface->view_state;
267-
268- if (surface->view->impl != &swc_compositor_view_impl)
269- return;
270-
271- if (state->mapped)
272- return;
273-
274- printf("showing surface %u\n", wl_resource_get_id(surface->resource));
275-
276- state->mapped = true;
277-
278- /* Assume worst-case no clipping until we draw the next frame (in case the
279- * surface gets moved before that. */
280- pixman_region32_clear(&state->clip);
281-
282- damage_surface(surface);
283- update_outputs(surface);
284- update(surface);
285- wl_list_insert(&compositor->surfaces, &surface->link);
286-}
287-
288-void swc_compositor_surface_hide(struct swc_surface * surface)
289-{
290- struct swc_compositor * compositor = CONTAINER_OF
291- (surface->view, typeof(*compositor), compositor_view);
292- struct swc_compositor_surface_state * state = surface->view_state;
293-
294- if (surface->view->impl != &swc_compositor_view_impl)
295- return;
296-
297- if (!state->mapped)
298- return;
299-
300- /* Update all the outputs the surface was on. */
301- update(surface);
302-
303- state->mapped = false;
304-
305- damage_below_surface(surface);
306- update_outputs(surface);
307- wl_list_remove(&surface->link);
308-}
309-
310-void swc_compositor_surface_set_border_width(struct swc_surface * surface,
311- uint32_t width)
312-{
313- struct swc_compositor_surface_state * state = surface->view_state;
314-
315- if (state->border.width == width)
316- return;
317-
318- state->border.width = width;
319- state->border.damaged = true;
320-
321- /* XXX: Damage above surface for transparent surfaces? */
322-
323- update_extents(surface);
324- update(surface);
325-}
326-
327-void swc_compositor_surface_set_border_color(struct swc_surface * surface,
328- uint32_t color)
329-{
330- struct swc_compositor_surface_state * state = surface->view_state;
331-
332- if (state->border.color == color)
333- return;
334-
335- state->border.color = color;
336- state->border.damaged = true;
337-
338- /* XXX: Damage above surface for transparent surfaces? */
339-
340- update(surface);
341-}
342-
+0,
-70
1@@ -1,70 +0,0 @@
2-/* swc: compositor_surface.h
3- *
4- * Copyright (c) 2013 Michael Forney
5- *
6- * Permission is hereby granted, free of charge, to any person obtaining a copy
7- * of this software and associated documentation files (the "Software"), to deal
8- * in the Software without restriction, including without limitation the rights
9- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10- * copies of the Software, and to permit persons to whom the Software is
11- * furnished to do so, subject to the following conditions:
12- *
13- * The above copyright notice and this permission notice shall be included in
14- * all copies or substantial portions of the Software.
15- *
16- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22- * SOFTWARE.
23- */
24-
25-#ifndef SWC_COMPOSITOR_SURFACE_H
26-#define SWC_COMPOSITOR_SURFACE_H
27-
28-#include "view.h"
29-
30-#include <wayland-server.h>
31-#include <pixman.h>
32-
33-struct swc_surface;
34-
35-struct swc_compositor_surface_state
36-{
37- struct swc_compositor * compositor;
38-
39- /* The box that the surface covers (including it's border). */
40- pixman_box32_t extents;
41-
42- /* The region that is covered by opaque regions of surfaces above this
43- * surface. */
44- pixman_region32_t clip;
45-
46- struct
47- {
48- uint32_t width;
49- uint32_t color;
50- bool damaged;
51- } border;
52-
53- bool mapped;
54-
55- struct wl_listener event_listener;
56-};
57-
58-extern const struct swc_view_impl swc_compositor_view_impl;
59-
60-void swc_compositor_surface_show(struct swc_surface * surface);
61-
62-void swc_compositor_surface_hide(struct swc_surface * surface);
63-
64-void swc_compositor_surface_set_border_width(struct swc_surface * surface,
65- uint32_t width);
66-
67-void swc_compositor_surface_set_border_color(struct swc_surface * surface,
68- uint32_t color);
69-
70-#endif
71-
+0,
-1
1@@ -34,7 +34,6 @@ SWC_SOURCES = \
2 libswc/output.c \
3 libswc/plane.c \
4 libswc/surface.c \
5- libswc/compositor_surface.c \
6 libswc/cursor_surface.c \
7 libswc/region.c \
8 libswc/input_focus.c \
+2,
-2
1@@ -21,9 +21,9 @@
2 * SOFTWARE.
3 */
4
5-#include "swc.h"
6-#include "compositor_surface.h"
7 #include "shell_surface.h"
8+#include "compositor.h"
9+#include "swc.h"
10 #include "surface.h"
11 #include "util.h"
12 #include "window.h"
+0,
-1
1@@ -23,7 +23,6 @@
2
3 #include "window.h"
4 #include "compositor.h"
5-#include "compositor_surface.h"
6 #include "event.h"
7 #include "internal.h"
8 #include "keyboard.h"
+1,
-1
1@@ -22,7 +22,7 @@
2 */
3
4 #include "xwm.h"
5-#include "compositor_surface.h"
6+#include "compositor.h"
7 #include "internal.h"
8 #include "surface.h"
9 #include "swc.h"