Skip to content

Commit

Permalink
Single touch is now working
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmarsan committed Dec 22, 2011
1 parent 1020f03 commit 4effee3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Expand Up @@ -116,9 +116,9 @@ private MotionEvent makeOrUpdateMotionEvent(TuioContainer point, long id, int ac
int totalcursors = getNumCursors();
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {
//totalcursors -= 1;
if (totalcursors <= 0) { //no cursors is a special case
if (totalcursors <= 1) { //no cursors is a special case
//id = -1;
//totalcursors = 1;
totalcursors = 1;
action = MotionEvent.ACTION_UP; //no more ACTION_POINTER_UP. need to be serious.
}
}
Expand Down Expand Up @@ -185,8 +185,8 @@ public int compare(TuioCursor object1, TuioCursor object2) {
}
}
else {
currentEvent = MotionEvent.obtain(startms, SystemClock.uptimeMillis(), actionmasked, totalcursors, pointerIds, inData, 0, 0.0f, 0.0f, 0, 0, 0, 0);
// return null; //EEK! something happened in the middle of us doing stuff.
//currentEvent = MotionEvent.obtain(startms, SystemClock.uptimeMillis(), actionmasked, totalcursors, pointerIds, inData, 0, 0.0f, 0.0f, 0, 0, 0, 0);
if (1==1) return null; //EEK! something happened in the middle of us doing stuff.
synchronized(events) {
if (currentEvent != null)
events.add(currentEvent);
Expand Down Expand Up @@ -236,7 +236,8 @@ public void addTuioObject(TuioObject tobj) {

private void addTuioThing(TuioContainer point, long id) {
// Log.d(TAG, "forwarding");
int event = (id == 0) ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_POINTER_DOWN;
//int event = (id == id) ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_POINTER_DOWN;
int event = (getNumCursors() <= 1) ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_POINTER_DOWN;
MotionEvent me = makeOrUpdateMotionEvent(point, id, event);
// callback.sendMotionEvent(me);
this.sendUpDownEvent(me);
Expand Down Expand Up @@ -277,7 +278,7 @@ public void removeTuioObject(TuioObject tobj) {

private void removeTuioThing(TuioContainer point, long id) {
// Log.d(TAG, "forwarding");
int event = (id == 0) ? MotionEvent.ACTION_UP : MotionEvent.ACTION_POINTER_UP;
int event = (id == id) ? MotionEvent.ACTION_UP : MotionEvent.ACTION_POINTER_UP;
MotionEvent me = makeOrUpdateMotionEvent(point, id, event);
//callback.sendMotionEvent(me);
this.sendUpDownEvent(me);
Expand Down
Binary file modified androidx86/froyo/TuioSign/TUIOService-Signed.apk
Binary file not shown.
Binary file modified androidx86/froyo/TuioSign/TUIOService.apk
Binary file not shown.

0 comments on commit 4effee3

Please sign in to comment.