[PATCH 3/9] compositor: Avoid sending event for invalid point

Rob Bradford robert.bradford at intel.com
Wed Dec 5 10:47:05 PST 2012


From: Rob Bradford <rob at linux.intel.com>

Avoid sending a touch down event using uninitialised surface x/y co-ordinates.
Instead present a log message about this unexpected case.
---
 src/compositor.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 565212d..b29d697 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2079,6 +2079,13 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
 		} else if (touch->focus) {
 			es = (struct weston_surface *) touch->focus;
 			weston_surface_from_global_fixed(es, x, y, &sx, &sy);
+		} else {
+			/* Unexpected condition: We have non-initial touch but
+			 * there is no focused surface.
+			 */
+			weston_log("touch event received with %d points down"
+				   "but no surface focused\n", seat->num_tp);
+			return;
 		}
 
 		grab->interface->down(grab, time, touch_id, sx, sy);
-- 
1.7.11.7



More information about the wayland-devel mailing list