[PATCH] compositor: Fix pick an incorrect surface due to dirty surface_list
zhiwen.wu at linux.intel.com
zhiwen.wu at linux.intel.com
Thu Mar 8 19:57:36 PST 2012
From: Alex Wu <zhiwen.wu at linux.intel.com>
When a new toplevel window is activated and positioned under the
cursor, the pointer focus still on the previous window. The botton
event can not deliver to the new window. The root cause is that
weston_surface_restack() change the surface stack but not update
the weston_compositor::surface_list, and then calling
weston_compositor_repick() picks an incorrect surface.
---
src/compositor.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 96e7fe7..2b84e4b 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -165,6 +165,20 @@ weston_client_launch(struct weston_compositor *compositor,
}
static void
+weston_compositor_rebuild_surface_list(struct weston_compositor *ec)
+{
+ struct weston_layer *layer;
+ struct weston_surface *es;
+
+ wl_list_init(&ec->surface_list);
+ wl_list_for_each(layer, &ec->layer_list, link) {
+ wl_list_for_each(es, &layer->surface_list, layer_link) {
+ wl_list_insert(ec->surface_list.prev, &es->link);
+ }
+ }
+}
+
+static void
surface_handle_buffer_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time)
{
@@ -546,6 +560,7 @@ weston_compositor_pick_surface(struct weston_compositor *compositor,
{
struct weston_surface *surface;
+ weston_compositor_rebuild_surface_list(compositor);
wl_list_for_each(surface, &compositor->surface_list, link) {
weston_surface_from_global(surface, x, y, sx, sy);
if (pixman_region32_contains_point(&surface->input,
@@ -914,13 +929,9 @@ weston_output_repaint(struct weston_output *output, int msecs)
glViewport(0, 0, width, height);
/* Rebuild the surface list and update surface transforms up front. */
- wl_list_init(&ec->surface_list);
- wl_list_for_each(layer, &ec->layer_list, link) {
- wl_list_for_each(es, &layer->surface_list, layer_link) {
- weston_surface_update_transform(es);
- wl_list_insert(ec->surface_list.prev, &es->link);
- }
- }
+ weston_compositor_rebuild_surface_list(ec);
+ wl_list_for_each(es, &ec->surface_list, link)
+ weston_surface_update_transform(es);
if (output->assign_planes)
/*
--
1.7.5.4
More information about the wayland-devel
mailing list