summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-11-23 11:15:30 -0800
committerChase Douglas <chase.douglas@canonical.com>2011-11-29 18:06:18 -0800
commit2f1ecfeda32ef1adb8ea8077b7c134bff47e7612 (patch)
tree29615c25c8d3078e357b2d20af5faae40aadce5b
parent6db80193241c00dfa7b37131576eea7de1a864e8 (diff)
Check for a found touch before attempting to paint it
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--multitouch.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/multitouch.c b/multitouch.c
index 53c52de..817de22 100644
--- a/multitouch.c
+++ b/multitouch.c
@@ -341,6 +341,12 @@ static void paint_touch_update(struct multitouch *mt, XIDeviceEvent *event)
{
struct touchpoint *t = find_touch(mt, event->detail);
+ if (!t)
+ {
+ error("Could not find touch in %s\n", __FUNCTION__);
+ return;
+ }
+
cairo_save(mt->cr);
cairo_set_source_rgba(mt->cr, 0, 0, 0, t->owned ? 1 : .5);
cairo_move_to(mt->cr, t->x, t->y);
@@ -359,6 +365,12 @@ static void paint_touch_end(struct multitouch *mt, XIDeviceEvent *event)
int rsize = 30;
struct touchpoint *t = find_touch(mt, event->detail);
+ if (!t)
+ {
+ error("Could not find touch in %s\n", __FUNCTION__);
+ return;
+ }
+
t->x = event->event_x;
t->y = event->event_y;
t->state = TSTATE_END;