[DEV] try to find keyboard error

This commit is contained in:
Edouard DUPIN 2014-01-03 21:30:51 +01:00
parent bd184d4f8f
commit cb6d3f0cb9
6 changed files with 187 additions and 21 deletions

2
build

@ -1 +1 @@
Subproject commit 0e08561a5db3080036ffd546c98dcd0a95d6f4a9 Subproject commit 35230a0e958143e3d7c313c7fee90fac2f51a4bf

2
external/etk vendored

@ -1 +1 @@
Subproject commit 8300237b2cc37bd36113c2830bdf1941fd0e8099 Subproject commit 9c6c819288c6ed209a6fa57ecfa788851abdecc8

View File

@ -11,14 +11,15 @@ package org.ewol;
import android.app.Activity; import android.app.Activity;
import android.service.wallpaper.WallpaperService; import android.service.wallpaper.WallpaperService;
import android.service.wallpaper.WallpaperService.Engine; import android.service.wallpaper.WallpaperService.Engine;
import android.util.Log; import android.util.Log;
public class Ewol { public class Ewol {
private int instanceID = -1; // local and private instance ID private int instanceID = -1; // local and private instance ID
private boolean m_hardKeyboardHidden = true;
public <T extends EwolCallback> Ewol(T activityInstance, int typeApplication) { public <T extends EwolCallback> Ewol(T activityInstance, int typeApplication) {
instanceID = -1; instanceID = -1;
m_hardKeyboardHidden = true;
instanceID = EWsetJavaVirtualMachineStart(activityInstance, typeApplication); instanceID = EWsetJavaVirtualMachineStart(activityInstance, typeApplication);
Log.d("Ewol", "new : " + instanceID); Log.d("Ewol", "new : " + instanceID);
} }
@ -30,6 +31,13 @@ public class Ewol {
EWparamSetArchiveDir(instanceID, mode, myString); EWparamSetArchiveDir(instanceID, mode, myString);
} }
public boolean getHardKeyboardHidden() {
return m_hardKeyboardHidden;
}
public void setHardKeyboardHidden(boolean val) {
m_hardKeyboardHidden = val;
}
// activity status // activity status
public void onCreate() { EWonCreate(instanceID); } public void onCreate() { EWonCreate(instanceID); }
public void onStart() { EWonStart(instanceID); } public void onStart() { EWonStart(instanceID); }

View File

@ -39,9 +39,12 @@ import android.util.Log;
import java.io.IOException; import java.io.IOException;
//import activityRootView
import org.ewol.Ewol; import org.ewol.Ewol;
/** /**
* @brief Class : * @brief Class :
* *
@ -58,6 +61,7 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
Log.e("EwolActivity", "error getting lib(): " + e); Log.e("EwolActivity", "error getting lib(): " + e);
} }
} }
public EwolActivity() { public EwolActivity() {
// set the java evironement in the C sources : // set the java evironement in the C sources :
EWOL = new Ewol(this, EWOL_APPL_TYPE_ACTIVITY); EWOL = new Ewol(this, EWOL_APPL_TYPE_ACTIVITY);
@ -83,6 +87,7 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
@Override protected void onCreate(Bundle savedInstanceState) { @Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
//setListnerToRootView();
// Load the application directory // Load the application directory
EWOL.paramSetArchiveDir(1, getFilesDir().toString()); EWOL.paramSetArchiveDir(1, getFilesDir().toString());
@ -172,19 +177,51 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
// cleanup your object here // cleanup your object here
} }
@Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
Log.e("EwolActivity", "Receive event ... ");
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
// Checks whether a hardware keyboard is available
if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
EWOL.setHardKeyboardHidden(false);
Log.e("EwolActivity", "HARD Keyboard active = " + !EWOL.getHardKeyboardHidden() + " (visible)");
} else if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
EWOL.setHardKeyboardHidden(true);
Log.e("EwolActivity", "HARD Keyboard active = " + !EWOL.getHardKeyboardHidden() + " (hidden)");
}
} }
public void keyboardUpdate(boolean show) { public void keyboardUpdate(boolean show) {
Log.e("EwolActivity", "keyboardUpdate(" + show + ")"); Log.i("EwolActivity", "set keyboard status visibility :" + show);
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); final InputMethodManager imm;
if(show) { try {
//EWOL.touchEvent(); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0); } catch(Exception e) {
Log.e("EwolActivity", "Can not get keyboard manager ...");
return;
}
Log.i("EwolActivity", "Get input manager done");
if(show == true) {
try {
imm.showSoftInput(mGLView, InputMethodManager.SHOW_IMPLICIT);
} catch(Exception e) {
Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)");
}
Log.i("EwolActivity", "Display it Done");
} else { } else {
imm.toggleSoftInput(0 ,InputMethodManager.HIDE_IMPLICIT_ONLY + InputMethodManager.HIDE_NOT_ALWAYS); // this is a little sutid this ==> display keyboard to be sure that it toggle in the hide state ...
//imm.hideSoftInputFromWindow(view.getWindowToken(),0); try {
imm.showSoftInput(mGLView, InputMethodManager.SHOW_IMPLICIT);
} catch(Exception e) {
Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)");
}
Log.i("EwolActivity", "Display it Done");
try {
imm.toggleSoftInput(0 ,InputMethodManager.HIDE_IMPLICIT_ONLY + InputMethodManager.HIDE_NOT_ALWAYS);
} catch(Exception e) {
Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)");
}
Log.i("EwolActivity", "Toggle it Done");
} }
} }

View File

@ -8,17 +8,12 @@
package org.ewol; package org.ewol;
// import the ewol package :
/* No need in same package... */
//import org.ewol.Ewol;
//import org.ewol.EwolRendererGL;
import android.content.Context; import android.content.Context;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.os.Bundle; import android.os.Bundle;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.util.Log;
import org.ewol.Ewol; import org.ewol.Ewol;
@ -293,5 +288,4 @@ public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
public boolean onKeyUp(int keyCode, KeyEvent event) { public boolean onKeyUp(int keyCode, KeyEvent event) {
return keyboardEvent(keyCode, event, false); return keyboardEvent(keyCode, event, false);
} }
} }

View File

@ -11,6 +11,7 @@
#include <time.h> #include <time.h>
#include <stdint.h> #include <stdint.h>
#include <pthread.h> #include <pthread.h>
#include <etk/os/Mutex.h>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
//#include <ewol/renderer/audio/audio.h> //#include <ewol/renderer/audio/audio.h>
@ -31,6 +32,8 @@ int64_t ewol::getTime(void) {
// jni doc : /usr/lib/jvm/java-1.6.0-openjdk/include // jni doc : /usr/lib/jvm/java-1.6.0-openjdk/include
static JavaVM* g_JavaVM=NULL; // global acces on the unique JVM !!! static JavaVM* g_JavaVM=NULL; // global acces on the unique JVM !!!
etk::Mutex g_interfaceMutex;
void java_check_exception(JNIEnv* _env) { void java_check_exception(JNIEnv* _env) {
if (_env->ExceptionOccurred()) { if (_env->ExceptionOccurred()) {
@ -400,14 +403,18 @@ extern "C" {
// JNI onLoad // JNI onLoad
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* _jvm, void* _reserved) { JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* _jvm, void* _reserved) {
// get the java virtual machine handle ... // get the java virtual machine handle ...
g_interfaceMutex.lock();
g_JavaVM = _jvm; g_JavaVM = _jvm;
EWOL_DEBUG("JNI-> load the jvm ..." ); EWOL_DEBUG("JNI-> load the jvm ..." );
g_interfaceMutex.unLock();
return JNI_VERSION_1_6; return JNI_VERSION_1_6;
} }
// JNI onUnLoad // JNI onUnLoad
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* _vm, void *_reserved) { JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* _vm, void *_reserved) {
g_interfaceMutex.lock();
g_JavaVM = NULL; g_JavaVM = NULL;
EWOL_DEBUG("JNI-> Un-load the jvm ..." ); EWOL_DEBUG("JNI-> Un-load the jvm ..." );
g_interfaceMutex.unLock();
} }
/* Call to initialize the graphics state */ /* Call to initialize the graphics state */
@ -416,11 +423,14 @@ extern "C" {
jint _id, jint _id,
jint _mode, jint _mode,
jstring _myString) { jstring _myString) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
//EWOL_CRITICAL(" call with ID : " << _id); //EWOL_CRITICAL(" call with ID : " << _id);
@ -433,15 +443,19 @@ extern "C" {
_env->ReleaseStringUTFChars(_myString, str); _env->ReleaseStringUTFChars(_myString, str);
str = NULL; str = NULL;
} }
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
jint Java_org_ewol_Ewol_EWsetJavaVirtualMachineStart(JNIEnv* _env, jint Java_org_ewol_Ewol_EWsetJavaVirtualMachineStart(JNIEnv* _env,
jclass _classBase, jclass _classBase,
jobject _objCallback, jobject _objCallback,
int _typeApplication) { int _typeApplication) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Creating EWOL context **"); EWOL_DEBUG("** Creating EWOL context **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
AndroidContext* tmpContext = NULL; AndroidContext* tmpContext = NULL;
if (org_ewol_EwolConstants_EWOL_APPL_TYPE_ACTIVITY == _typeApplication) { if (org_ewol_EwolConstants_EWOL_APPL_TYPE_ACTIVITY == _typeApplication) {
tmpContext = new AndroidContext(_env, _classBase, _objCallback, AndroidContext::appl_application); tmpContext = new AndroidContext(_env, _classBase, _objCallback, AndroidContext::appl_application);
@ -449,139 +463,189 @@ extern "C" {
tmpContext = new AndroidContext(_env, _classBase, _objCallback, AndroidContext::appl_wallpaper); tmpContext = new AndroidContext(_env, _classBase, _objCallback, AndroidContext::appl_wallpaper);
} else { } else {
EWOL_CRITICAL(" try to create an instance with no apply type: " << _typeApplication); EWOL_CRITICAL(" try to create an instance with no apply type: " << _typeApplication);
g_interfaceMutex.unLock();
return -1; return -1;
} }
if (NULL == tmpContext) { if (NULL == tmpContext) {
EWOL_ERROR("Can not allocate the main context instance _id=" << (s_listInstance.size()-1)); EWOL_ERROR("Can not allocate the main context instance _id=" << (s_listInstance.size()-1));
g_interfaceMutex.unLock();
return -1; return -1;
} }
// for future case : all time this ... // for future case : all time this ...
s_listInstance.push_back(tmpContext); s_listInstance.push_back(tmpContext);
int32_t newID = s_listInstance.size()-1; int32_t newID = s_listInstance.size()-1;
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
return newID; return newID;
} }
void Java_org_ewol_Ewol_EWsetJavaVirtualMachineStop(JNIEnv* _env, jclass _cls, jint _id) { void Java_org_ewol_Ewol_EWsetJavaVirtualMachineStop(JNIEnv* _env, jclass _cls, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** remove JVM Pointer **"); EWOL_DEBUG("** remove JVM Pointer **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0) { || _id<0) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
g_interfaceMutex.unLock();
return; return;
} }
if (NULL == s_listInstance[_id]) { if (NULL == s_listInstance[_id]) {
EWOL_ERROR("the requested instance _id=" << (int32_t)_id << " is already removed ..."); EWOL_ERROR("the requested instance _id=" << (int32_t)_id << " is already removed ...");
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->unInit(_env); s_listInstance[_id]->unInit(_env);
delete(s_listInstance[_id]); delete(s_listInstance[_id]);
s_listInstance[_id]=NULL; s_listInstance[_id]=NULL;
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWtouchEvent(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_ewol_Ewol_EWtouchEvent(JNIEnv* _env, jobject _thiz, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG(" == > Touch Event"); EWOL_DEBUG(" == > Touch Event");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
java_check_exception(_env); java_check_exception(_env);
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWonCreate(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_ewol_Ewol_EWonCreate(JNIEnv* _env, jobject _thiz, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity on Create **"); EWOL_DEBUG("** Activity on Create **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
//s_listInstance[_id]->init(); //s_listInstance[_id]->init();
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWonStart(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_ewol_Ewol_EWonStart(JNIEnv* _env, jobject _thiz, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity on Start **"); EWOL_DEBUG("** Activity on Start **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
//SendSystemMessage(" testmessages ... "); //SendSystemMessage(" testmessages ... ");
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_ewol_Ewol_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity on Re-Start **"); EWOL_DEBUG("** Activity on Re-Start **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWonResume(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_ewol_Ewol_EWonResume(JNIEnv* _env, jobject _thiz, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity on resume **"); EWOL_DEBUG("** Activity on resume **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->OS_Resume(); s_listInstance[_id]->OS_Resume();
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWonPause(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_ewol_Ewol_EWonPause(JNIEnv* _env, jobject _thiz, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity on pause **"); EWOL_DEBUG("** Activity on pause **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
// All the openGl has been destroyed ... // All the openGl has been destroyed ...
s_listInstance[_id]->getResourcesManager().contextHasBeenDestroyed(); s_listInstance[_id]->getResourcesManager().contextHasBeenDestroyed();
s_listInstance[_id]->OS_Suspend(); s_listInstance[_id]->OS_Suspend();
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity on Stop **"); EWOL_DEBUG("** Activity on Stop **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->OS_Stop(); s_listInstance[_id]->OS_Stop();
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWonDestroy(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_ewol_Ewol_EWonDestroy(JNIEnv* _env, jobject _thiz, jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity on Destroy **"); EWOL_DEBUG("** Activity on Destroy **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
//s_listInstance[_id]->UnInit(); //s_listInstance[_id]->UnInit();
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
@ -595,14 +659,19 @@ extern "C" {
jint _pointerID, jint _pointerID,
jfloat _x, jfloat _x,
jfloat _y) { jfloat _y) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->OS_SetInputMotion(_pointerID+1, vec2(_x,_y)); s_listInstance[_id]->OS_SetInputMotion(_pointerID+1, vec2(_x,_y));
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWinputEventState(JNIEnv* _env, void Java_org_ewol_Ewol_EWinputEventState(JNIEnv* _env,
@ -612,14 +681,19 @@ extern "C" {
jboolean _isUp, jboolean _isUp,
jfloat _x, jfloat _x,
jfloat _y) { jfloat _y) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->OS_SetInputState(_pointerID+1, _isUp, vec2(_x,_y)); s_listInstance[_id]->OS_SetInputState(_pointerID+1, _isUp, vec2(_x,_y));
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWmouseEventMotion(JNIEnv* _env, void Java_org_ewol_Ewol_EWmouseEventMotion(JNIEnv* _env,
@ -628,14 +702,19 @@ extern "C" {
jint _pointerID, jint _pointerID,
jfloat _x, jfloat _x,
jfloat _y) { jfloat _y) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->OS_SetMouseMotion(_pointerID+1, vec2(_x,_y)); s_listInstance[_id]->OS_SetMouseMotion(_pointerID+1, vec2(_x,_y));
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWmouseEventState(JNIEnv* _env, void Java_org_ewol_Ewol_EWmouseEventState(JNIEnv* _env,
@ -645,28 +724,38 @@ extern "C" {
jboolean _isUp, jboolean _isUp,
jfloat _x, jfloat _x,
jfloat _y) { jfloat _y) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->OS_SetMouseState(_pointerID+1, _isUp, vec2(_x,_y)); s_listInstance[_id]->OS_SetMouseState(_pointerID+1, _isUp, vec2(_x,_y));
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWunknowEvent(JNIEnv* _env, void Java_org_ewol_Ewol_EWunknowEvent(JNIEnv* _env,
jobject _thiz, jobject _thiz,
jint _id, jint _id,
jint _pointerID) { jint _pointerID) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
EWOL_DEBUG("Unknown IO event : " << _pointerID << " ???"); EWOL_DEBUG("Unknown IO event : " << _pointerID << " ???");
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWkeyboardEventMove(JNIEnv* _env, void Java_org_ewol_Ewol_EWkeyboardEventMove(JNIEnv* _env,
@ -674,14 +763,19 @@ extern "C" {
jint _id, jint _id,
jint _type, jint _type,
jboolean _isdown) { jboolean _isdown) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
EWOL_DEBUG("IO keyboard Move event : \"" << _type << "\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Move event : \"" << _type << "\" is down=" << _isdown);
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWkeyboardEventKey(JNIEnv* _env, void Java_org_ewol_Ewol_EWkeyboardEventKey(JNIEnv* _env,
@ -689,15 +783,20 @@ extern "C" {
jint _id, jint _id,
jint _uniChar, jint _uniChar,
jboolean _isdown) { jboolean _isdown) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
EWOL_DEBUG("IO keyboard Key event : \"" << _uniChar << "\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key event : \"" << _uniChar << "\" is down=" << _isdown);
s_listInstance[_id]->ANDROID_SetKeyboard(_uniChar, _isdown); s_listInstance[_id]->ANDROID_SetKeyboard(_uniChar, _isdown);
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWdisplayPropertyMetrics(JNIEnv* _env, void Java_org_ewol_Ewol_EWdisplayPropertyMetrics(JNIEnv* _env,
@ -705,15 +804,20 @@ extern "C" {
jint _id, jint _id,
jfloat _ratioX, jfloat _ratioX,
jfloat _ratioY) { jfloat _ratioY) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
// set the internal system ratio properties ... // set the internal system ratio properties ...
ewol::Dimension::setPixelRatio(vec2(_ratioX,_ratioY), ewol::Dimension::Inch); ewol::Dimension::setPixelRatio(vec2(_ratioX,_ratioY), ewol::Dimension::Inch);
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
// TODO : set a return true or false if we want to grep this event ... // TODO : set a return true or false if we want to grep this event ...
@ -722,11 +826,14 @@ extern "C" {
jint _id, jint _id,
jint _keyVal, jint _keyVal,
jboolean _isdown) { jboolean _isdown) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
switch (_keyVal) { switch (_keyVal) {
@ -752,6 +859,8 @@ extern "C" {
EWOL_DEBUG("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown);
break; break;
} }
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
@ -761,14 +870,18 @@ extern "C" {
void Java_org_ewol_Ewol_EWrenderInit(JNIEnv* _env, void Java_org_ewol_Ewol_EWrenderInit(JNIEnv* _env,
jobject _thiz, jobject _thiz,
jint _id) { jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWrenderResize(JNIEnv* _env, void Java_org_ewol_Ewol_EWrenderResize(JNIEnv* _env,
@ -776,28 +889,38 @@ extern "C" {
jint _id, jint _id,
jint _w, jint _w,
jint _h) { jint _h) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->OS_Resize(vec2(_w, _h)); s_listInstance[_id]->OS_Resize(vec2(_w, _h));
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
// TODO : Return tur or foalse to not redraw when the under draw has not be done (processing gain of time) // TODO : Return tur or foalse to not redraw when the under draw has not be done (processing gain of time)
void Java_org_ewol_Ewol_EWrenderDraw(JNIEnv* _env, void Java_org_ewol_Ewol_EWrenderDraw(JNIEnv* _env,
jobject _thiz, jobject _thiz,
jint _id) { jint _id) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
g_interfaceMutex.unLock();
return; return;
} }
s_listInstance[_id]->OS_Draw(true); s_listInstance[_id]->OS_Draw(true);
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
void Java_org_ewol_Ewol_EWaudioPlayback(JNIEnv* _env, void Java_org_ewol_Ewol_EWaudioPlayback(JNIEnv* _env,
@ -806,6 +929,8 @@ extern "C" {
jshortArray _location, jshortArray _location,
jint _frameRate, jint _frameRate,
jint _nbChannels) { jint _nbChannels) {
g_interfaceMutex.lock();
EWOL_DEBUG("java->C (begin)");
if( _id >= s_listInstance.size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL == s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
@ -825,6 +950,8 @@ extern "C" {
// release the short* pointer // release the short* pointer
_env->ReleaseShortArrayElements(_location, dst, 0); _env->ReleaseShortArrayElements(_location, dst, 0);
//} //}
EWOL_DEBUG("java->C (end)");
g_interfaceMutex.unLock();
} }
}; };