[PATCH weston 1/3] compositor: Update input region when updating surface transfomations
Jonas Ådahl
jadahl at gmail.com
Wed Nov 14 14:39:51 PST 2012
If the compositor updated the geometry of a surface, the input region
would still represent the original geometry. By intersecting the input
region specified by the client, if any, by the new geometry when
updating surface transformations the active input region can be kept up
to date.
Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
src/compositor.c | 23 +++++++++++++++++------
src/compositor.h | 1 +
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 83bd244..75c66ab 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -249,6 +249,7 @@ weston_surface_create(struct weston_compositor *compositor)
pixman_region32_init(&surface->opaque);
pixman_region32_init(&surface->clip);
region_init_infinite(&surface->input);
+ region_init_infinite(&surface->full_input);
pixman_region32_init(&surface->transform.opaque);
wl_list_init(&surface->frame_callback_list);
@@ -508,6 +509,17 @@ weston_surface_update_transform_enable(struct weston_surface *surface)
return 0;
}
+static void
+weston_surface_update_input_region(struct weston_surface *surface)
+{
+ pixman_region32_fini(&surface->input);
+ pixman_region32_init_rect(&surface->input, 0, 0,
+ surface->geometry.width,
+ surface->geometry.height);
+ pixman_region32_intersect(&surface->input,
+ &surface->input, &surface->full_input);
+}
+
WL_EXPORT void
weston_surface_update_transform(struct weston_surface *surface)
{
@@ -522,6 +534,8 @@ weston_surface_update_transform(struct weston_surface *surface)
pixman_region32_fini(&surface->transform.opaque);
pixman_region32_init(&surface->transform.opaque);
+ weston_surface_update_input_region(surface);
+
/* transform.position is always in transformation_list */
if (surface->geometry.transformation_list.next ==
&surface->transform.position.link &&
@@ -791,6 +805,7 @@ destroy_surface(struct wl_resource *resource)
pixman_region32_fini(&surface->opaque);
pixman_region32_fini(&surface->clip);
pixman_region32_fini(&surface->input);
+ pixman_region32_fini(&surface->full_input);
wl_list_for_each_safe(cb, next, &surface->frame_callback_list, link)
wl_resource_destroy(&cb->resource);
@@ -1286,12 +1301,8 @@ surface_commit(struct wl_client *client, struct wl_resource *resource)
pixman_region32_fini(&opaque);
/* wl_surface.set_input_region */
- pixman_region32_fini(&surface->input);
- pixman_region32_init_rect(&surface->input, 0, 0,
- surface->geometry.width,
- surface->geometry.height);
- pixman_region32_intersect(&surface->input,
- &surface->input, &surface->pending.input);
+ pixman_region32_copy(&surface->full_input, &surface->pending.input);
+ weston_surface_update_input_region(surface);
/* wl_surface.frame */
wl_list_insert_list(&surface->frame_callback_list,
diff --git a/src/compositor.h b/src/compositor.h
index d2e121b..933831c 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -415,6 +415,7 @@ struct weston_surface {
pixman_region32_t damage;
pixman_region32_t opaque;
pixman_region32_t input;
+ pixman_region32_t full_input;
int32_t pitch;
struct wl_list link;
struct wl_list layer_link;
--
1.7.10.4
More information about the wayland-devel
mailing list