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 bef94a71b1)

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1806 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2017-06-14 20:51:20 +00:00
parent caa5ffe29a
commit 75854e0698

View File

@ -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;