<div class="gmail_quote">On Tue, Dec 18, 2012 at 4:58 AM, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Instead of directly setting the dirty flag on weston_surface geometry,<br>
use a function for that.<br>
<br>
This allows us to hook into geometry dirtying in following patches.<br>
<br>
Also add comments to weston_surface fields, whose modification causes<br>
transform state to become outdated.<br>
<br>
Signed-off-by: Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>><br>
---<br>
src/compositor.c | 20 +++++++++++++-------<br>
src/compositor.h | 17 ++++++++++-------<br>
src/shell.c | 24 ++++++++++--------------<br>
src/util.c | 4 ++--<br>
src/xwayland/window-manager.c | 4 ++--<br>
tests/weston-test.c | 2 +-<br>
6 files changed, 38 insertions(+), 33 deletions(-)<br>
<br>
diff --git a/src/compositor.c b/src/compositor.c<br>
index 0b37e63..24ae6e3 100644<br>
--- a/src/compositor.c<br>
+++ b/src/compositor.c<br>
@@ -297,7 +297,7 @@ weston_surface_create(struct weston_compositor *compositor)<br>
&surface->transform.position.link);<br>
weston_matrix_init(&surface->transform.position.matrix);<br>
pixman_region32_init(&surface->transform.boundingbox);<br>
- surface->geometry.dirty = 1;<br>
+ surface->transform.dirty = 1;<br>
<br>
surface->pending.buffer_destroy_listener.notify =<br>
surface_handle_pending_buffer_destroy;<br>
@@ -568,10 +568,10 @@ weston_surface_update_transform_enable(struct weston_surface *surface)<br>
WL_EXPORT void<br>
weston_surface_update_transform(struct weston_surface *surface)<br>
{<br>
- if (!surface->geometry.dirty)<br>
+ if (!surface->transform.dirty)<br>
return;<br>
<br>
- surface->geometry.dirty = 0;<br>
+ surface->transform.dirty = 0;<br>
<br>
weston_surface_damage_below(surface);<br>
<br>
@@ -596,6 +596,12 @@ weston_surface_update_transform(struct weston_surface *surface)<br>
}<br>
<br>
WL_EXPORT void<br>
+weston_surface_geometry_dirty(struct weston_surface *surface)<br>
+{<br>
+ surface->transform.dirty = 1;<br>
+}<br>
+<br>
+WL_EXPORT void<br>
weston_surface_to_global_fixed(struct weston_surface *surface,<br>
wl_fixed_t sx, wl_fixed_t sy,<br>
wl_fixed_t *x, wl_fixed_t *y)<br>
@@ -690,7 +696,7 @@ weston_surface_configure(struct weston_surface *surface,<br>
surface->geometry.y = y;<br>
surface->geometry.width = width;<br>
surface->geometry.height = height;<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
}<br>
<br>
WL_EXPORT void<br>
@@ -699,7 +705,7 @@ weston_surface_set_position(struct weston_surface *surface,<br>
{<br>
surface->geometry.x = x;<br>
surface->geometry.y = y;<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
}<br>
<br>
WL_EXPORT int<br>
@@ -1393,7 +1399,7 @@ surface_commit(struct wl_client *client, struct wl_resource *resource)<br>
if (surface->pending.sx || surface-><a href="http://pending.sy" target="_blank">pending.sy</a> ||<br>
(surface->pending.buffer &&<br>
surface_pending_buffer_has_different_size(surface)))<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
<br>
/* wl_surface.set_buffer_rotation */<br>
surface->buffer_transform = surface->pending.buffer_transform;<br>
@@ -1426,7 +1432,7 @@ surface_commit(struct wl_client *client, struct wl_resource *resource)<br>
<br>
if (!pixman_region32_equal(&opaque, &surface->opaque)) {<br>
pixman_region32_copy(&surface->opaque, &opaque);<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
}<br>
<br>
pixman_region32_fini(&opaque);<br>
diff --git a/src/compositor.h b/src/compositor.h<br>
index 1d790d3..3a3580a 100644<br>
--- a/src/compositor.h<br>
+++ b/src/compositor.h<br>
@@ -360,8 +360,8 @@ struct weston_region {<br>
* To add a transformation to a surface, create a struct weston_transform, and<br>
* add it to the list surface->geometry.transformation_list. Whenever you<br>
* change the list, anything under surface->geometry, or anything in the<br>
- * weston_transforms linked into the list, you must set<br>
- * surface->geometry.dirty = 1.<br>
+ * weston_transforms linked into the list, you must call<br>
+ * weston_surface_geometry_dirty().<br>
*<br>
* The order in the list defines the order of transformations. Let the list<br>
* contain the transformation matrices M1, ..., Mn as head to tail. The<br>
@@ -385,17 +385,17 @@ struct weston_surface {<br>
struct weston_compositor *compositor;<br>
pixman_region32_t clip;<br>
pixman_region32_t damage;<br>
- pixman_region32_t opaque;<br>
+ pixman_region32_t opaque; /* geometry dirty */<br></blockquote><div><br>I'm not sure what this comment is supposed to convey.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
pixman_region32_t input;<br>
struct wl_list link;<br>
struct wl_list layer_link;<br>
- float alpha;<br>
+ float alpha; /* geometry dirty */<br></blockquote><div><br>This one as well.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
struct weston_plane *plane;<br>
<br>
void *renderer_state;<br>
<br>
/* Surface geometry state, mutable.<br>
- * If you change anything, set dirty = 1.<br>
+ * If you change anything, call weston_surface_geometry_dirty().<br>
* That includes the transformations referenced from the list.<br>
*/<br>
struct {<br>
@@ -404,14 +404,14 @@ struct weston_surface {<br>
<br>
/* struct weston_transform */<br>
struct wl_list transformation_list;<br>
-<br>
- int dirty;<br></blockquote><div><br>Why are we changing whitespace here?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
} geometry;<br>
<br>
/* State derived from geometry state, read-only.<br>
* This is updated by weston_surface_update_transform().<br>
*/<br>
struct {<br>
+ int dirty;<br>
+<br>
pixman_region32_t boundingbox;<br>
pixman_region32_t opaque;<br></blockquote><div><br>And here?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
@@ -489,6 +489,9 @@ void<br>
weston_surface_update_transform(struct weston_surface *surface);<br>
<br>
void<br>
+weston_surface_geometry_dirty(struct weston_surface *surface);<br>
+<br>
+void<br>
weston_surface_to_global_fixed(struct weston_surface *surface,<br>
wl_fixed_t sx, wl_fixed_t sy,<br>
wl_fixed_t *x, wl_fixed_t *y);<br>
diff --git a/src/shell.c b/src/shell.c<br>
index aa1c7c1..5b9acd7 100644<br>
--- a/src/shell.c<br>
+++ b/src/shell.c<br>
@@ -594,7 +594,7 @@ surface_translate(struct weston_surface *surface, double d)<br>
weston_matrix_init(&shsurf->workspace_transform.matrix);<br>
weston_matrix_translate(&shsurf->workspace_transform.matrix,<br>
0.0, d, 0.0);<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
}<br>
<br>
static void<br>
@@ -670,7 +670,7 @@ workspace_deactivate_transforms(struct workspace *ws)<br>
wl_list_remove(&shsurf->workspace_transform.link);<br>
wl_list_init(&shsurf->workspace_transform.link);<br>
}<br>
- shsurf->surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
}<br>
}<br>
<br>
@@ -1511,7 +1511,7 @@ set_surface_type(struct shell_surface *shsurf)<br>
if (!wl_list_empty(&shsurf->rotation.transform.link)) {<br>
wl_list_remove(&shsurf->rotation.transform.link);<br>
wl_list_init(&shsurf->rotation.transform.link);<br>
- shsurf->surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(shsurf->surface);<br>
shsurf->saved_rotation_valid = true;<br>
}<br>
break;<br>
@@ -2404,7 +2404,7 @@ surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t axis,<br>
if (surface->alpha < step)<br>
surface->alpha = step;<br>
<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
weston_surface_damage(surface);<br>
}<br>
<br>
@@ -2498,7 +2498,7 @@ rotate_grab_motion(struct wl_pointer_grab *grab,<br>
r = sqrtf(dx * dx + dy * dy);<br>
<br>
wl_list_remove(&shsurf->rotation.transform.link);<br>
- shsurf->surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(shsurf->surface);<br>
<br>
if (r > 20.0f) {<br>
struct weston_matrix *matrix =<br>
@@ -2789,7 +2789,7 @@ show_input_panels(struct wl_listener *listener, void *data)<br>
ws = surface->surface;<br>
wl_list_insert(&shell->input_panel_layer.surface_list,<br>
&ws->layer_link);<br>
- ws->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(ws);<br>
weston_surface_update_transform(ws);<br>
weston_surface_damage(ws);<br>
weston_slide_run(ws, ws->geometry.height, 0, NULL, NULL);<br>
@@ -2903,7 +2903,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface,<br>
<br>
surface->geometry.width = width;<br>
surface->geometry.height = height;<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
<br>
/* initial positioning, see also configure() */<br>
switch (surface_type) {<br>
@@ -2997,11 +2997,7 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,<br>
if (shsurf)<br>
surface_type = shsurf->type;<br>
<br>
- surface->geometry.x = x;<br>
- surface->geometry.y = y;<br>
- surface->geometry.width = width;<br>
- surface->geometry.height = height;<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_configure(surface, x, y, width, height);<br>
<br>
switch (surface_type) {<br>
case SHELL_SURFACE_FULLSCREEN:<br>
@@ -3342,7 +3338,7 @@ switcher_next(struct switcher *switcher)<br>
next = surface;<br>
prev = surface;<br>
surface->alpha = 0.25;<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
weston_surface_damage(surface);<br>
break;<br>
default:<br>
@@ -3351,7 +3347,7 @@ switcher_next(struct switcher *switcher)<br>
<br>
if (is_black_surface(surface, NULL)) {<br>
surface->alpha = 0.25;<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
weston_surface_damage(surface);<br>
}<br>
}<br>
diff --git a/src/util.c b/src/util.c<br>
index 5f8e9c8..bae1bb9 100644<br>
--- a/src/util.c<br>
+++ b/src/util.c<br>
@@ -116,7 +116,7 @@ weston_surface_animation_destroy(struct weston_surface_animation *animation)<br>
wl_list_remove(&animation->animation.link);<br>
wl_list_remove(&animation->listener.link);<br>
wl_list_remove(&animation->transform.link);<br>
- animation->surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(animation->surface);<br>
if (animation->done)<br>
animation->done(animation, animation->data);<br>
free(animation);<br>
@@ -153,7 +153,7 @@ weston_surface_animation_frame(struct weston_animation *base,<br>
if (animation->frame)<br>
animation->frame(animation);<br>
<br>
- animation->surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(animation->surface);<br>
weston_compositor_schedule_repaint(animation->surface->compositor);<br>
}<br>
<br>
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c<br>
index 303ef15..168c717 100644<br>
--- a/src/xwayland/window-manager.c<br>
+++ b/src/xwayland/window-manager.c<br>
@@ -757,7 +757,7 @@ weston_wm_window_draw_decoration(void *data)<br>
x - 1, y - 1,<br>
window->width + 2,<br>
window->height + 2);<br>
- window->surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(window->surface);<br>
<br>
pixman_region32_init_rect(&window->surface->input,<br>
t->margin, t->margin,<br>
@@ -778,7 +778,7 @@ weston_wm_window_schedule_repaint(struct weston_wm_window *window)<br>
pixman_region32_fini(&window->surface->pending.opaque);<br>
pixman_region32_init_rect(&window->surface->pending.opaque, 0, 0,<br>
width, height);<br>
- window->surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(window->surface);<br>
}<br>
return;<br>
}<br>
diff --git a/tests/weston-test.c b/tests/weston-test.c<br>
index be635fa..e89f104 100644<br>
--- a/tests/weston-test.c<br>
+++ b/tests/weston-test.c<br>
@@ -87,7 +87,7 @@ test_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)<br>
surface->geometry.y = test_surface->y;<br>
surface->geometry.width = surface->buffer_ref.buffer->width;<br>
surface->geometry.height = surface->buffer_ref.buffer->height;<br>
- surface->geometry.dirty = 1;<br>
+ weston_surface_geometry_dirty(surface);<br>
<br>
if (!weston_surface_is_mapped(surface))<br>
weston_surface_update_transform(surface);<br>
<span><font color="#888888">--<br>
1.7.8.6<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org" target="_blank">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br>