Modification of the Java abstraction to manage the difference between Mouse and touch event ==> Not compiled and tested...

This commit is contained in:
Edouard Dupin 2012-05-21 13:53:33 +02:00
parent 0ce79b8b15
commit 4383fab72d
4 changed files with 92 additions and 12 deletions

View File

@ -338,7 +338,19 @@ extern "C"
EWOL_ThreadEventInputState(pointerID+1, isUp, x, y);
}
void Java_org_ewol_interfaceJNI_IOInputEventUnknow( JNIEnv* env, jobject thiz, jint pointerID)
void Java_org_ewol_interfaceJNI_IOMouseEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{
APPL_DEBUG("IO Mouse event : " << pointerID << " ???");
EWOL_ThreadEventInputMotion(pointerID+1, x, y);
}
void Java_org_ewol_interfaceJNI_IOMouseEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{
APPL_DEBUG("IO Mouse event : " << pointerID << " ???");
EWOL_ThreadEventInputState(pointerID+1, isUp, x, y);
}
void Java_org_ewol_interfaceJNI_IOUnknowEvent( JNIEnv* env, jobject thiz, jint pointerID)
{
APPL_DEBUG("Unknown IO event : " << pointerID << " ???");
}

View File

@ -35,9 +35,15 @@ public class interfaceJNI {
public static native void ActivityOnStop();
public static native void ActivityOnDestroy();
// IO native function :
// Specific for the type of input : TOOL_TYPE_FINGER and TOOL_TYPE_STYLUS (work as the same)
public static native void IOInputEventMotion(int pointerID, float x, float y);
public static native void IOInputEventState(int pointerID, boolean isDown, float x, float y);
public static native void IOInputEventUnknow(int eventID);
// Specific for the type of input : TOOL_TYPE_MOUSE
public static native void IOMouseEventMotion(int pointerID, float x, float y);
public static native void IOMouseEventState(int pointerID, boolean isDown, float x, float y);
// other unknow event ...
public static native void IOUnknowEvent(int eventID);
public static native void IOKeyboardEventMove(int type, boolean isDown);
public static native void IOKeyboardEventKey(int uniChar, boolean isDown);

View File

@ -68,36 +68,97 @@ public class interfaceSurfaceView extends GLSurfaceView {
if (tmpActionType == MotionEvent.ACTION_MOVE) {
final int pointerCount = event.getPointerCount();
for (int p = 0; p < pointerCount; p++) {
interfaceJNI.IOInputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
int typeOfPointer = getToolType(p);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
}
}
} else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
|| tmpActionType == MotionEvent.ACTION_DOWN) {
interfaceJNI.IOInputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
int typeOfPointer = getToolType(0);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
}
InputDown1 = true;
} else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
int typeOfPointer = getToolType(0);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
InputDown1 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) {
interfaceJNI.IOInputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
int typeOfPointer = getToolType(1);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
}
InputDown2 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) {
interfaceJNI.IOInputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
int typeOfPointer = getToolType(1);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
}
InputDown2 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) {
interfaceJNI.IOInputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
int typeOfPointer = getToolType(2);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
}
InputDown3 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) {
interfaceJNI.IOInputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
int typeOfPointer = getToolType(2);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
}
InputDown3 = false;
} else if(tmpActionType == MotionEvent.ACTION_UP){
if (InputDown1) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
int typeOfPointer = getToolType(0);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
InputDown1 = false;
} else if (InputDown2) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
int typeOfPointer = getToolType(0);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
InputDown2 = false;
} else {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
int typeOfPointer = getToolType(0);
if( typeOfPointer == TOOL_TYPE_FINGER
|| typeOfPointer == TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
InputDown3 = false;
}
}

View File

@ -144,6 +144,7 @@ void ewol::List::OnDraw(void)
m_listOObject[m_currentDrawId][iii]->Draw();
}
}
WidgetScrooled::OnDraw();
}