From 75854e06989e1b2468e59deffc25b574a5983591 Mon Sep 17 00:00:00 2001 From: dcnieho Date: Wed, 14 Jun 2017 20:51:20 +0000 Subject: [PATCH] multi-touch demo: if an index 64 would come in, this would be written in the wrong place in the cursor buffer. Supporting 64 IDs means writing to slots 0--63 (cherry picked from commit bef94a71b19e92de5ff82b620fbac853bf83a15b) git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1806 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/progs/demos/multi-touch/multi-touch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/freeglut/freeglut/progs/demos/multi-touch/multi-touch.c b/freeglut/freeglut/progs/demos/multi-touch/multi-touch.c index e4fc596..37f5d79 100644 --- a/freeglut/freeglut/progs/demos/multi-touch/multi-touch.c +++ b/freeglut/freeglut/progs/demos/multi-touch/multi-touch.c @@ -109,8 +109,8 @@ void onMotion(int x, int y) { /* Using FG2.8 (reversed) prototype for now */ /* void onMultiButton(int cursor_id, int button, int state, int x, int y) { */ void onMultiButton(int cursor_id, int x, int y, int button, int state) { - if (cursor_id > NUM_CURSORS) { - fprintf(stderr, "cursor_id (%d) > NUM_CURSORS (%d)\n", cursor_id, NUM_CURSORS); + if (cursor_id >= NUM_CURSORS) { + fprintf(stderr, "cursor_id (%d) >= NUM_CURSORS (%d), out of slots\n", cursor_id, NUM_CURSORS); return; } if (button == 0) { @@ -122,8 +122,8 @@ void onMultiButton(int cursor_id, int x, int y, int button, int state) { } void onMultiMotion(int cursor_id, int x, int y) { - if (cursor_id > NUM_CURSORS) { - fprintf(stderr, "cursor_id (%d) > NUM_CURSORS (%d)\n", cursor_id, NUM_CURSORS); + if (cursor_id >= NUM_CURSORS) { + fprintf(stderr, "cursor_id (%d) >= NUM_CURSORS (%d), out of slots\n", cursor_id, NUM_CURSORS); return; } cursors[0][cursor_id].x = (float)x;