[PATCH weston] input: Add comment explaining why pointer isn't freed when device is removed

Derek Foreman derekf at osg.samsung.com
Wed Jan 7 13:00:25 PST 2015


When the last pointer is removed from a seat, the pointer struct is
intentionally kept.  This has some interesting side effects, so I've
documented it here so people like me don't errantly assume it's a bug.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---

I tried to "fix" this "bug" the other day, so maybe a comment will
help others from making the same mistake...

 src/input.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/input.c b/src/input.c
index d3bfa5e..c039af0 100644
--- a/src/input.c
+++ b/src/input.c
@@ -2226,6 +2226,11 @@ weston_seat_release_pointer(struct weston_seat *seat)
 
 		weston_pointer_reset_state(pointer);
 		seat_send_updated_caps(seat);
+
+		/* seat->pointer is intentionally not destroyed so that
+		 * a newly attached pointer on this seat will retain
+		 * the previous cursor co-ordinates.
+		 */
 	}
 }
 
-- 
2.1.4



More information about the wayland-devel mailing list