Add message broadcast system and test the thread system of display

This commit is contained in:
Edouard Dupin 2012-01-31 18:27:35 +01:00
parent d5e64688c7
commit a3b404ec4d
27 changed files with 1116 additions and 1090 deletions

View File

@ -32,11 +32,13 @@
#include <ewol/threadMsg.h> #include <ewol/threadMsg.h>
// declaration of the ewol android abstraction ... // declaration of the ewol android abstraction ...
void EWOL_NativeInit(void);
void EWOL_NativeDone(void); void EWOL_SystemStart(void);
void EWOL_NativeApplicationInit(void); void EWOL_SystemStop(void);
void EWOL_NativeApplicationUnInit(void); void EWOL_ThreadSetArchiveDir(int mode, const char* str);
void EWOL_NativeRender(void); void EWOL_ThreadResize(int w, int h );
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y);
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y);
extern "C" extern "C"
@ -54,7 +56,7 @@ extern "C"
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnCreate( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnCreate( JNIEnv* env )
{ {
EDN_DEBUG("Activity On Create"); EDN_DEBUG("Activity On Create");
BaseInit(); EWOL_SystemStart();
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStart( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStart( JNIEnv* env )
{ {
@ -79,7 +81,7 @@ extern "C"
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnDestroy( JNIEnv* env ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnDestroy( JNIEnv* env )
{ {
EDN_DEBUG("Activity On Destroy"); EDN_DEBUG("Activity On Destroy");
BaseUnInit(); EWOL_SystemStop();
} }
@ -92,41 +94,29 @@ extern "C"
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolRenderer_nativeResize( JNIEnv* env, jobject thiz, jint w, jint h ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolRenderer_nativeResize( JNIEnv* env, jobject thiz, jint w, jint h )
{ {
eventResize_ts tmpData; EWOL_ThreadResize(w, h);
tmpData.w = w;
tmpData.h = h;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_RESIZE, ewol::threadMsg::MSG_PRIO_MEDIUM, &tmpData, sizeof(eventResize_ts) );
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventInputMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventInputMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{ {
eventInputMotion_ts tmpData; EWOL_ThreadEventInputMotion(pointerID, x, y);
tmpData.pointerID = pointerID;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventInputState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y ) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventInputState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{ {
eventInputState_ts tmpData; EWOL_ThreadEventInputState(pointerID, isUp, x, y);
tmpData.pointerID = pointerID;
tmpData.state = isUp;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeApplicationInit( JNIEnv* env) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeApplicationInit( JNIEnv* env)
{ {
ewol::threadMsg::SendMessage(androidJniMsg, JNI_APP_INIT); //ewol::threadMsg::SendMessage(androidJniMsg, JNI_APP_INIT);
//EWOL_NativeApplicationInit(); //EWOL_NativeApplicationInit();
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeApplicationUnInit( JNIEnv* env) void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeApplicationUnInit( JNIEnv* env)
{ {
ewol::threadMsg::SendMessage(androidJniMsg, JNI_APP_UN_INIT); //ewol::threadMsg::SendMessage(androidJniMsg, JNI_APP_UN_INIT);
//EWOL_NativeApplicationUnInit(); //EWOL_NativeApplicationUnInit();
} }

View File

@ -307,7 +307,6 @@ class Bitmap
}; };
class LoadedTexture class LoadedTexture
{ {
public: public:
@ -315,7 +314,6 @@ class LoadedTexture
int32_t m_nbTimeLoaded; int32_t m_nbTimeLoaded;
// openGl configuration : // openGl configuration :
uint32_t m_openGlTextureID; uint32_t m_openGlTextureID;
int32_t m_target; int32_t m_target;
int32_t m_level; int32_t m_level;
int32_t m_internalFormat; int32_t m_internalFormat;
@ -327,6 +325,7 @@ class LoadedTexture
char* m_data; char* m_data;
int32_t m_nbBytes; int32_t m_nbBytes;
bool m_loaded; bool m_loaded;
bool m_destroy;
}; };
@ -336,20 +335,21 @@ class LoadedTexture
etk::VectorType<LoadedTexture*> listLoadedTexture; etk::VectorType<LoadedTexture*> listLoadedTexture;
static bool OGLContextLoaded=false;
#undef __class__ #undef __class__
#define __class__ "ewol" #define __class__ "ewol"
void ewol::TextureOGLContext(bool enable)
void ewol::UpdateTextureContext(void)
{ {
if (OGLContextLoaded != enable) { bool needRedraw = false;
EWOL_INFO("Change Open-GL context property : old=" << OGLContextLoaded << " new=" << enable);
OGLContextLoaded = enable;
if (true == OGLContextLoaded) {
EWOL_INFO(" ==> Set all Texture in openGL memory nb=" << listLoadedTexture.Size());
for (int32_t iii=0; iii < listLoadedTexture.Size(); iii++) { for (int32_t iii=0; iii < listLoadedTexture.Size(); iii++) {
if (NULL != listLoadedTexture[iii]->m_data) { if( NULL != listLoadedTexture[iii]
&& NULL != listLoadedTexture[iii]->m_data)
{
if( false == listLoadedTexture[iii]->m_destroy
&& false == listLoadedTexture[iii]->m_loaded)
{
GLuint textureid; GLuint textureid;
glGenTextures(1, &textureid); glGenTextures(1, &textureid);
glBindTexture(listLoadedTexture[iii]->m_target, textureid); glBindTexture(listLoadedTexture[iii]->m_target, textureid);
@ -361,7 +361,7 @@ void ewol::TextureOGLContext(bool enable)
//--- Mode linear //--- Mode linear
glTexParameteri(listLoadedTexture[iii]->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(listLoadedTexture[iii]->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(listLoadedTexture[iii]->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(listLoadedTexture[iii]->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
EWOL_INFO(" [" << iii << "] texture =(" << listLoadedTexture[iii]->m_width << "px," << EWOL_INFO("TEXTURE: Add [" << iii << "]=(" << listLoadedTexture[iii]->m_width << "px," <<
listLoadedTexture[iii]->m_height << "px) in file:" << listLoadedTexture[iii]->m_height << "px) in file:" <<
listLoadedTexture[iii]->m_filename << " OGl_Id=" <<textureid); listLoadedTexture[iii]->m_filename << " OGl_Id=" <<textureid);
glTexImage2D(listLoadedTexture[iii]->m_target, glTexImage2D(listLoadedTexture[iii]->m_target,
@ -375,25 +375,29 @@ void ewol::TextureOGLContext(bool enable)
listLoadedTexture[iii]->m_data); listLoadedTexture[iii]->m_data);
listLoadedTexture[iii]->m_openGlTextureID = textureid; listLoadedTexture[iii]->m_openGlTextureID = textureid;
listLoadedTexture[iii]->m_loaded = true; listLoadedTexture[iii]->m_loaded = true;
} else { needRedraw = true;
EWOL_ERROR("Can not load texture with no data ..."); } else if ( true == listLoadedTexture[iii]->m_destroy
} && true == listLoadedTexture[iii]->m_loaded)
} {
ewol::ForceRedrawAll(); // Request remove texture ...
} else { EWOL_DEBUG("TEXTURE: Rm [" << iii << "] file:" << listLoadedTexture[iii]->m_filename);
EWOL_INFO(" ==> UnSet all Texture in openGL memory nb=" << listLoadedTexture.Size());
for (int32_t iii=0; iii < listLoadedTexture.Size(); iii++) {
EWOL_DEBUG(" [" << iii << "] file:" << listLoadedTexture[iii]->m_filename);
glDeleteTextures(1, &listLoadedTexture[iii]->m_openGlTextureID); glDeleteTextures(1, &listLoadedTexture[iii]->m_openGlTextureID);
listLoadedTexture[iii]->m_loaded = false; listLoadedTexture[iii]->m_loaded = false;
listLoadedTexture[iii]->m_openGlTextureID = -1; listLoadedTexture[iii]->m_openGlTextureID = -1;
if (NULL != listLoadedTexture[iii]->m_data) {
delete[] listLoadedTexture[iii]->m_data;
listLoadedTexture[iii]->m_data = NULL;
}
delete(listLoadedTexture[iii]);
listLoadedTexture[iii] = NULL;
} }
} }
EWOL_INFO(" *** END ***"); }
if (true == needRedraw) {
ewol::ForceRedrawAll();
} }
} }
int32_t ewol::LoadTexture(int32_t target, int32_t ewol::LoadTexture(int32_t target,
int32_t level, int32_t level,
int32_t internalFormat, int32_t internalFormat,
@ -428,37 +432,13 @@ int32_t ewol::LoadTexture(int32_t target,
tmpTex->m_nbBytes = nbBytes; tmpTex->m_nbBytes = nbBytes;
tmpTex->m_data = new char[tmpTex->m_nbBytes+4096]; tmpTex->m_data = new char[tmpTex->m_nbBytes+4096];
tmpTex->m_loaded = false; tmpTex->m_loaded = false;
tmpTex->m_destroy = false;
if (NULL == tmpTex->m_data) { if (NULL == tmpTex->m_data) {
EWOL_ERROR("Texture : Data Allocation ERROR... " << filename); EWOL_ERROR("Texture : Data Allocation ERROR... " << filename);
return -1; return -1;
} }
memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes); memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes);
if (true == OGLContextLoaded) {
uint32_t textureid = 0;
glGenTextures(1, &textureid);
glBindTexture(tmpTex->m_target, textureid);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_T, GL_REPEAT);
//--- mode nearest
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//--- Mode linear
glTexParameteri(tmpTex->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(tmpTex->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
EWOL_INFO("Set in OpenGl texture =" << tmpTex->m_width << "px different of height=" << tmpTex->m_height << "px in file:" << filename << " in id OGL : " <<textureid);
glTexImage2D(tmpTex->m_target,
tmpTex->m_level,
tmpTex->m_internalFormat,
tmpTex->m_width,
tmpTex->m_height,
tmpTex->m_border,
tmpTex->m_format,
tmpTex->m_type,
tmpTex->m_data);
tmpTex->m_openGlTextureID = textureid;
tmpTex->m_loaded = true;
}
listLoadedTexture.PushBack(tmpTex); listLoadedTexture.PushBack(tmpTex);
outTextureID = listLoadedTexture.Size()-1; outTextureID = listLoadedTexture.Size()-1;
return outTextureID; return outTextureID;
@ -470,9 +450,11 @@ int32_t ewol::LoadTexture(etk::File fileName)
int32_t outTextureID = -1; int32_t outTextureID = -1;
if (listLoadedTexture.Size()!=0) { if (listLoadedTexture.Size()!=0) {
for (int32_t iii=0; iii<listLoadedTexture.Size(); iii++) { for (int32_t iii=0; iii<listLoadedTexture.Size(); iii++) {
if (NULL != listLoadedTexture[iii]) {
if (listLoadedTexture[iii]->m_filename == fileName.GetCompleateName()) { if (listLoadedTexture[iii]->m_filename == fileName.GetCompleateName()) {
listLoadedTexture[iii]->m_nbTimeLoaded++; listLoadedTexture[iii]->m_nbTimeLoaded++;
return listLoadedTexture[iii]->m_openGlTextureID; return iii;
}
} }
} }
} }
@ -502,19 +484,14 @@ void ewol::UnLoadTexture(uint32_t textureID)
{ {
EWOL_INFO("Unload a specific tecture ID=" << textureID); EWOL_INFO("Unload a specific tecture ID=" << textureID);
if (textureID>=0 && (int32_t)textureID<listLoadedTexture.Size()) { if (textureID>=0 && (int32_t)textureID<listLoadedTexture.Size()) {
if (NULL == listLoadedTexture[textureID]) {
EWOL_ERROR("Texture : " << textureID << " does not existe anymore...");
return;
}
listLoadedTexture[textureID]->m_nbTimeLoaded--; listLoadedTexture[textureID]->m_nbTimeLoaded--;
if (0 == listLoadedTexture[textureID]->m_nbTimeLoaded) { if (0 == listLoadedTexture[textureID]->m_nbTimeLoaded) {
EWOL_DEBUG("Remove openGL texture ID=" << textureID << " file:" << listLoadedTexture[textureID]->m_filename); EWOL_DEBUG("Remove openGL texture ID=" << textureID << " file:" << listLoadedTexture[textureID]->m_filename);
if (true == listLoadedTexture[textureID]->m_loaded) { listLoadedTexture[textureID]->m_destroy = true;
glDeleteTextures(1,&listLoadedTexture[textureID]->m_openGlTextureID);
}
if (NULL != listLoadedTexture[textureID]->m_data) {
delete[] listLoadedTexture[textureID]->m_data;
listLoadedTexture[textureID]->m_data = NULL;
}
delete(listLoadedTexture[textureID]);
listLoadedTexture[textureID] = NULL;
listLoadedTexture.Erase(textureID);
} }
return; return;
} }

View File

@ -44,6 +44,7 @@ namespace ewol
void UnLoadTexture(uint32_t textureID); void UnLoadTexture(uint32_t textureID);
int32_t GetTextureSize(uint32_t textureID); int32_t GetTextureSize(uint32_t textureID);
uint32_t GetTextureGLID(uint32_t textureID); uint32_t GetTextureGLID(uint32_t textureID);
void UpdateTextureContext(void);
void TextureOGLContext(bool enable); void TextureOGLContext(bool enable);
}; };

View File

@ -24,6 +24,7 @@
#include <ewol/Widget.h> #include <ewol/Widget.h>
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
#include <ewol/WidgetMessageMultiCast.h>
char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type) char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type)
@ -97,6 +98,7 @@ ewol::Widget::Widget(void)
ewol::Widget::~Widget(void) ewol::Widget::~Widget(void)
{ {
ewol::widgetMessageMultiCast::Rm(GetWidgetId());
ewol::widgetManager::Rm(this); ewol::widgetManager::Rm(this);
} }
@ -166,7 +168,7 @@ bool ewol::Widget::GenEventInputExternal(const char * generateEventId, etkFloat_
if (NULL == tmpWidget) { if (NULL == tmpWidget) {
EWOL_ERROR("Try to call an NULL Widget, it might be removed ... id=" << m_externEvent[jjj].widgetCall); EWOL_ERROR("Try to call an NULL Widget, it might be removed ... id=" << m_externEvent[jjj].widgetCall);
} else { } else {
ended = tmpWidget->OnEventAreaExternal(GetWidgetId(), generateEventId, m_externEvent[jjj].generateEventIdExtern, x, y); ended = tmpWidget->OnEventAreaExternal(GetWidgetId(), m_externEvent[jjj].generateEventIdExtern, NULL, x, y);
} }
if (true == ended) { if (true == ended) {
break; break;

View File

@ -272,8 +272,9 @@ namespace ewol {
protected: protected:
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t X, etkFloat_t Y) { return false; }; virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t X, etkFloat_t Y) { return false; };
virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y) { return false; }; virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y) { return false; };
public:
// when an event arrive from an other widget, it will arrive here: // when an event arrive from an other widget, it will arrive here:
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y) { return false; }; virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) { return false; };
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Keboard event (when one is present or when a graphical is present // -- Keboard event (when one is present or when a graphical is present

View File

@ -0,0 +1,100 @@
/**
*******************************************************************************
* @file ewol/WidgetMessageMulticast.cpp
* @brief basic ewol Widget Message Multi-cast (Sources)
* @author Edouard DUPIN
* @date 31/01/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/WidgetManager.h>
#undef __class__
#define __class__ "ewol::WidgetMessageMultiCast"
extern "C" {
typedef struct {
int32_t widgetId;
const char* message;
} messageList_ts;
};
// internal element of the widget manager :
static etk::VectorType<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
void ewol::widgetMessageMultiCast::Init(void)
{
EWOL_INFO("user widget message Multi-Cast");
}
void ewol::widgetMessageMultiCast::UnInit(void)
{
EWOL_INFO("user widget message Multi-Cast");
m_messageList.Clear();
}
void ewol::widgetMessageMultiCast::Add(int32_t widgetId, const char* const message)
{
// TODO : Check if the message exist before ...
messageList_ts tmpMessage;
tmpMessage.widgetId = widgetId;
tmpMessage.message = message;
m_messageList.PushBack(tmpMessage);
}
// TODO : Do this better ...
void ewol::widgetMessageMultiCast::Rm(int32_t widgetId)
{
// send the message at all registered widget ...
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
if(m_messageList[iii].widgetId != widgetId) {
m_messageList[iii].message = NULL;
m_messageList[iii].widgetId = -1;
}
}
}
void ewol::widgetMessageMultiCast::Send(int32_t widgetId, const char* const message, int32_t data)
{
char tmpData[50];
sprintf(tmpData, "%d", data);
Send(widgetId, message, tmpData);
}
void ewol::widgetMessageMultiCast::Send(int32_t widgetId, const char* const message, const char * data)
{
EWOL_DEBUG("SendMulticast message \"" << message << "\" to :");
// send the message at all registered widget ...
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
if( m_messageList[iii].message == message
&& m_messageList[iii].widgetId != widgetId)
{
ewol::Widget * tmpWidget = ewol::widgetManager::Get(m_messageList[iii].widgetId);
if (NULL != tmpWidget) {
EWOL_DEBUG(" id = " << m_messageList[iii].widgetId);
// generate event ...
(void)tmpWidget->OnEventAreaExternal(widgetId, m_messageList[iii].message, data, 0, 0);
}
}
}
}

View File

@ -0,0 +1,46 @@
/**
*******************************************************************************
* @file ewol/WidgetMessageMulticast.h
* @brief basic ewol Widget Message Multi-cast (Header)
* @author Edouard DUPIN
* @date 31/01/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_WIDGET_MESSAGE_MULTIICAST_H__
#define __EWOL_WIDGET_MESSAGE_MULTIICAST_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/OObject.h>
#include <etk/VectorType.h>
#include <ewol/Widget.h>
namespace ewol {
namespace widgetMessageMultiCast {
void Init( void);
void UnInit(void);
void Add( int32_t widgetId, const char* const message);
void Rm( int32_t widgetId);
void Send(int32_t widgetId, const char* const message, int32_t data);
void Send(int32_t widgetId, const char* const message, const char * data = NULL);
};
};
#endif

View File

@ -27,12 +27,13 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/threadMsg.h> #include <ewol/threadMsg.h>
#include <ewol/base/MainThread.h> #include <ewol/base/MainThread.h>
#include <ewol/base/gui.h>
static ewol::threadMsg::threadMsg_ts androidJniMsg; static ewol::threadMsg::threadMsg_ts androidJniMsg;
static pthread_t androidJniThread; static pthread_t androidJniThread;
static pthread_attr_t androidJniThreadAttr; //static pthread_attr_t androidJniThreadAttr;
enum { enum {
JNI_NONE, JNI_NONE,
@ -70,83 +71,84 @@ typedef struct {
} eventInputState_ts; } eventInputState_ts;
extern int EWOL_appArgC;
extern char *EWOL_appArgV[];
static void* BaseAppEntry(void* param) static void* BaseAppEntry(void* param)
{ {
bool requestEndProcessing = false; bool requestEndProcessing = false;
EDN_DEBUG("start Ewol Basic thread ..."); EWOL_DEBUG("BThread Init (START)");
guiAbstraction::Init(0, NULL);
ewol::Init(0, NULL); ewol::Init(EWOL_appArgC, EWOL_appArgV);
APP_Init(0, NULL); APP_Init(EWOL_appArgC, EWOL_appArgV);
EWOL_DEBUG("BThread Init (END)");
while(false == requestEndProcessing) { while(false == requestEndProcessing) {
ewol::threadMsg::threadMsgContent_ts data; ewol::threadMsg::threadMsgContent_ts data;
ewol::threadMsg::WaitMessage(androidJniMsg, data); ewol::threadMsg::WaitMessage(androidJniMsg, data);
switch (data.type) { switch (data.type) {
case JNI_NONE: case JNI_NONE:
EDN_DEBUG("Receive MSG : JNI_NONE"); EWOL_DEBUG("Receive MSG : JNI_NONE");
break; break;
case JNI_INIT: case JNI_INIT:
EDN_DEBUG("Receive MSG : JNI_INIT"); EWOL_DEBUG("Receive MSG : JNI_INIT");
EWOL_NativeApplicationInit(); //Android : EWOL_NativeApplicationInit();
break; break;
case JNI_UN_INIT: case JNI_UN_INIT:
EDN_DEBUG("Receive MSG : JNI_UN_INIT"); EWOL_DEBUG("Receive MSG : JNI_UN_INIT");
EWOL_NativeApplicationUnInit(); //Android : EWOL_NativeApplicationUnInit();
requestEndProcessing = true; requestEndProcessing = true;
break; break;
case JNI_DONE: case JNI_DONE:
EDN_DEBUG("Receive MSG : JNI_DONE"); EWOL_DEBUG("Receive MSG : JNI_DONE");
break; break;
case JNI_RESIZE: case JNI_RESIZE:
EDN_DEBUG("Receive MSG : JNI_RESIZE"); EWOL_DEBUG("Receive MSG : JNI_RESIZE");
{ {
eventResize_ts * tmpData = (eventResize_ts*)data.data; eventResize_ts * tmpData = (eventResize_ts*)data.data;
EWOL_NativeResize(tmpData->w, tmpData->h); //Android : EWOL_NativeResize(tmpData->w, tmpData->h);
EWOL_NativeInit(); //Android : EWOL_NativeInit();
} }
break; break;
case JNI_INPUT_MOTION: case JNI_INPUT_MOTION:
EDN_DEBUG("Receive MSG : JNI_INPUT_MOTION"); EWOL_DEBUG("Receive MSG : JNI_INPUT_MOTION");
{ {
eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data; eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data;
EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y); //Android : EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y);
} }
break; break;
case JNI_INPUT_STATE: case JNI_INPUT_STATE:
EDN_DEBUG("Receive MSG : JNI_INPUT_STATE"); EWOL_DEBUG("Receive MSG : JNI_INPUT_STATE");
{ {
eventInputState_ts * tmpData = (eventInputState_ts*)data.data; eventInputState_ts * tmpData = (eventInputState_ts*)data.data;
EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y); //Android : EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y);
} }
break; break;
case JNI_DATA_ARCHIVE_DIR: case JNI_DATA_ARCHIVE_DIR:
EDN_DEBUG("Receive MSG : JNI_DATA_ARCHIVE_DIR"); EWOL_DEBUG("Receive MSG : JNI_DATA_ARCHIVE_DIR");
break; break;
case JNI_APP_INIT: case JNI_APP_INIT:
EDN_DEBUG("Receive MSG : JNI_APP_INIT"); EWOL_DEBUG("Receive MSG : JNI_APP_INIT");
break; break;
case JNI_APP_UN_INIT: case JNI_APP_UN_INIT:
EDN_DEBUG("Receive MSG : JNI_APP_UN_INIT"); EWOL_DEBUG("Receive MSG : JNI_APP_UN_INIT");
break; break;
case JNI_APP_RENDERER: case JNI_APP_RENDERER:
EDN_DEBUG("Receive MSG : JNI_APP_RENDERER"); EWOL_DEBUG("Receive MSG : JNI_APP_RENDERER");
break; break;
default: default:
EDN_DEBUG("Receive MSG : UNKNOW"); EWOL_DEBUG("Receive MSG : UNKNOW");
break; break;
} }
} }
EDN_DEBUG("End Ewol Basic thread ..."); EWOL_DEBUG("BThread Un-Init (START)");
// unset all windows // unset all windows
ewol::DisplayWindows(NULL); ewol::DisplayWindows(NULL);
// call application to uninit // call application to uninit
APP_UnInit(); APP_UnInit();
// basic abstraction un-init
guiAbstraction::UnInit();
// uninit Ewol // uninit Ewol
ewol::UnInit(); ewol::UnInit();
EWOL_DEBUG("BThread Un-Init (END)");
pthread_exit(NULL); pthread_exit(NULL);
} }
@ -206,7 +208,7 @@ void EWOL_SystemStop(void)
isGlobalSystemInit = false; isGlobalSystemInit = false;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_UN_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME); ewol::threadMsg::SendMessage(androidJniMsg, JNI_UN_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
EDN_DEBUG("Wait end of the thread ..."); EWOL_DEBUG("Wait end of the thread ...");
// Wait end of the thread // Wait end of the thread
pthread_join(androidJniThread, NULL); pthread_join(androidJniThread, NULL);
ewol::threadMsg::UnInit(androidJniMsg); ewol::threadMsg::UnInit(androidJniMsg);
@ -217,18 +219,29 @@ void EWOL_SystemStop(void)
void EWOL_ThreadResize(int w, int h ) void EWOL_ThreadResize(int w, int h )
{ {
eventResize_ts tmpData;
tmpData.w = w;
tmpData.h = h;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_RESIZE, ewol::threadMsg::MSG_PRIO_MEDIUM, &tmpData, sizeof(eventResize_ts) );
} }
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y ) void EWOL_ThreadEventInputMotion(int pointerID, float x, float y )
{ {
eventInputMotion_ts tmpData;
tmpData.pointerID = pointerID;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
} }
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y ) void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y )
{ {
eventInputState_ts tmpData;
tmpData.pointerID = pointerID;
tmpData.state = isUp;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
} }

View File

@ -12,7 +12,7 @@
* *
* This software is distributed in the hope that it will be useful, but WITHOUT * This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY. * ANY WARRANTY.
* *O
* Licence summary : * Licence summary :
* You can modify and redistribute the sources code and binaries. * You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix * You can send me the bug-fix

View File

@ -41,14 +41,8 @@
#undef __class__ #undef __class__
#define __class__ "AndroidJNI" #define __class__ "AndroidJNI"
int EWOL_appArgC = 0;
char *EWOL_appArgV[] = NULL;
int gAppAlive = 1;
static int sDemoStopped = 0;
static long sTimeOffset = 0;
static int sTimeOffsetInit = 0;
static long sTimeStopped = 0;
static etkFloat_t m_width = 320; static etkFloat_t m_width = 320;
static etkFloat_t m_height = 480; static etkFloat_t m_height = 480;
@ -84,10 +78,6 @@ bool firstInitDone = false;
void EWOL_NativeInit(void) void EWOL_NativeInit(void)
{ {
EWOL_INFO("Init : Start All Application"); EWOL_INFO("Init : Start All Application");
gAppAlive = 1;
sDemoStopped = 0;
sTimeOffsetInit = 0;
ewol::TextureOGLContext(true);
firstInitDone = true; firstInitDone = true;
} }
@ -97,8 +87,6 @@ void EWOL_NativeResize(int w, int h )
m_width = w; m_width = w;
m_height = h; m_height = h;
EWOL_INFO("Resize w=" << w << " h=" << h); EWOL_INFO("Resize w=" << w << " h=" << h);
ewol::TextureOGLContext(false);
ewol::TextureOGLContext(true);
if (NULL != m_uniqueWindows) { if (NULL != m_uniqueWindows) {
m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height); m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height);
m_uniqueWindows->SetOrigin(0.0, 0.0); m_uniqueWindows->SetOrigin(0.0, 0.0);
@ -109,7 +97,6 @@ void EWOL_NativeResize(int w, int h )
void EWOL_NativeDone(void) void EWOL_NativeDone(void)
{ {
EWOL_INFO("Renderer : Close All Application"); EWOL_INFO("Renderer : Close All Application");
ewol::TextureOGLContext(false);
} }
void EWOL_NativeEventInputMotion(int pointerID, float x, float y ) void EWOL_NativeEventInputMotion(int pointerID, float x, float y )
@ -265,6 +252,7 @@ static etkFloat_t gTriangleVertices5[] = { 200.0f, 200.0f, 100.0f, 200.0f, 200.0
void Draw(void) void Draw(void)
{ {
ewol::UpdateTextureContext();
//EWOL_DEBUG("redraw (" << m_width << "," << m_height << ")"); //EWOL_DEBUG("redraw (" << m_width << "," << m_height << ")");
if(NULL == m_uniqueWindows) { if(NULL == m_uniqueWindows) {
// set the size of the open GL system // set the size of the open GL system
@ -371,95 +359,9 @@ void Draw(void)
#undef __class__ #undef __class__
#define __class__ "guiAbstraction" #define __class__ "guiAbstraction"
static bool guiAbstractionIsInit = false;
//static guiAbstraction::X11systemInterface * myX11Access = NULL;
void guiAbstraction::Init(int32_t argc, char *argv[])
{
if (false == guiAbstractionIsInit) {
// set the gui is init :
guiAbstractionIsInit = true;
EWOL_INFO("INIT for X11 environement");
//myX11Access = new guiAbstraction::X11systemInterface();
} else {
EWOL_CRITICAL("Can not INIT X11 ==> already init before");
}
}
void guiAbstraction::Run(void)
{
EWOL_INFO("Noting to run in android mode ...");
}
void guiAbstraction::Stop(void)
{
if (true == guiAbstractionIsInit) {
//myX11Access->Stop();
} else {
EWOL_CRITICAL("Can not Stop X11 ==> not init ... ");
}
}
void guiAbstraction::SetDisplayOnWindows(ewol::Windows * newOne) void guiAbstraction::SetDisplayOnWindows(ewol::Windows * newOne)
{ {
if (true == guiAbstractionIsInit) {
Setwindow(newOne); Setwindow(newOne);
} else {
EWOL_CRITICAL("Can not set Windows X11 ==> not init ... ");
}
}
void guiAbstraction::UnInit(void)
{
if (true == guiAbstractionIsInit) {
EWOL_INFO("UN-INIT for X11 environement");
//if (NULL != myX11Access) {
// delete(myX11Access);
//}
guiAbstractionIsInit = false;
} else {
EWOL_CRITICAL("Can not Un-Init X11 ==> not init ... ");
}
}
void guiAbstraction::ChangeSize(int32_t w, int32_t h)
{
if (true == guiAbstractionIsInit) {
//myX11Access->ChangeSize(w, h);
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
void guiAbstraction::ChangePos(int32_t x, int32_t y)
{
if (true == guiAbstractionIsInit) {
//myX11Access->ChangePos(x, y);
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
{
if (true == guiAbstractionIsInit) {
//myX11Access->GetAbsPos(x, y);
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
bool guiAbstraction::IsPressedInput(int32_t inputID)
{
//if (true == guiAbstractionIsInit) {
// return myX11Access->IsPressedInput(inputID);
//} else {
// EWOL_CRITICAL("X11 ==> not init ... ");
return false;
//}
} }
void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode) void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode)
@ -499,13 +401,6 @@ void guiAbstraction::SendKeyboardEvent(bool isDown, etk::String &keyInput)
} }
} }
// never had main in android ...
/*
int main(int argc, char *argv[])
{
return -1;
}
*/
void glOrtho(GLfloat left, void glOrtho(GLfloat left,
GLfloat right, GLfloat right,

View File

@ -29,6 +29,7 @@
#include <ewol/base/gui.h> #include <ewol/base/gui.h>
#include <ewol/Texture.h> #include <ewol/Texture.h>
#include <ewol/base/MainThread.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -103,7 +104,7 @@ extern bool guiKeyBoardMode_AltGr;
extern bool guiKeyBoardMode_VerNum; extern bool guiKeyBoardMode_VerNum;
extern bool guiKeyBoardMode_Insert; extern bool guiKeyBoardMode_Insert;
namespace guiAbstraction {
extern "C" { extern "C" {
typedef struct Hints typedef struct Hints
{ {
@ -114,9 +115,7 @@ namespace guiAbstraction {
unsigned long status; unsigned long status;
} Hints; } Hints;
} }
class X11systemInterface
{
private:
// for double and triple click selection, we need to save the previous click up and down position , and the previous time ... // for double and triple click selection, we need to save the previous click up and down position , and the previous time ...
int32_t m_previousBouttonId; int32_t m_previousBouttonId;
int32_t m_previousDown_x; int32_t m_previousDown_x;
@ -125,7 +124,7 @@ namespace guiAbstraction {
int32_t m_previous_y; int32_t m_previous_y;
int64_t m_previousTime; int64_t m_previousTime;
bool m_previousDouble; bool m_previousDouble;
private:
Atom m_delAtom; Atom m_delAtom;
Display * m_display; Display * m_display;
Window WindowHandle; Window WindowHandle;
@ -144,6 +143,18 @@ namespace guiAbstraction {
bool m_run; bool m_run;
ewol::Windows* m_uniqueWindows; ewol::Windows* m_uniqueWindows;
bool inputIsPressed[20];
static void X11_Stop(void);
static void X11_ChangeSize(int32_t w, int32_t h);
static void X11_ChangePos(int32_t x, int32_t y);
static void X11_GetAbsPos(int32_t & x, int32_t & y);
static void X11_KeyboardShow(ewol::keyboardMode_te mode);
static void X11_KeyboardHide(void);
static void X11_ForceRedrawAll(void);
static bool X11_IsPressedInput(int32_t inputID);
bool CreateX11Context(void) bool CreateX11Context(void)
{ {
int x,y, attr_mask; int x,y, attr_mask;
@ -288,7 +299,7 @@ namespace guiAbstraction {
XSetWMProtocols(m_display, WindowHandle, &m_delAtom, 1); XSetWMProtocols(m_display, WindowHandle, &m_delAtom, 1);
} }
ChangeSize(400, 300); X11_ChangeSize(400, 300);
return true; return true;
} }
@ -356,14 +367,12 @@ namespace guiAbstraction {
EWOL_INFO("XF86 DRI NOT available\n"); EWOL_INFO("XF86 DRI NOT available\n");
} }
#endif #endif
//ewol::TextureOGLContext(true);
return true; return true;
} }
void Draw(void) void Draw(void)
{ {
// TODO : set this otherwise ewol::UpdateTextureContext();
ewol::TextureOGLContext(true);
//EWOL_DEBUG("redraw (" << m_width << "," << m_height << ")"); //EWOL_DEBUG("redraw (" << m_width << "," << m_height << ")");
if(NULL == m_uniqueWindows) { if(NULL == m_uniqueWindows) {
//EWOL_DEBUG("Has No Windows set..."); //EWOL_DEBUG("Has No Windows set...");
@ -403,8 +412,7 @@ namespace guiAbstraction {
#endif #endif
} }
public: void X11_Init(void)
X11systemInterface(void)
{ {
m_visual = NULL; m_visual = NULL;
m_previousBouttonId = 0; m_previousBouttonId = 0;
@ -426,12 +434,8 @@ namespace guiAbstraction {
m_run = true; m_run = true;
} }
~X11systemInterface(void)
{
Stop();
}
void Setwindow(ewol::Windows* newWindows) void X11_Setwindow(ewol::Windows* newWindows)
{ {
m_uniqueWindows = newWindows; m_uniqueWindows = newWindows;
if (NULL != m_uniqueWindows) { if (NULL != m_uniqueWindows) {
@ -439,7 +443,7 @@ namespace guiAbstraction {
} }
} }
void Run(void) void X11_Run(void)
{ {
// main cycle // main cycle
while(true == m_run) { while(true == m_run) {
@ -457,7 +461,7 @@ namespace guiAbstraction {
if (NULL != m_uniqueWindows) { if (NULL != m_uniqueWindows) {
m_uniqueWindows->SysOnKill(); m_uniqueWindows->SysOnKill();
} }
Stop(); X11_Stop();
} }
} }
break; break;
@ -760,9 +764,9 @@ namespace guiAbstraction {
buf[1] = 0x00; buf[1] = 0x00;
etk::String tmpData = buf; etk::String tmpData = buf;
if(event.type == KeyPress) { if(event.type == KeyPress) {
SendKeyboardEvent(true, tmpData); guiAbstraction::SendKeyboardEvent(true, tmpData);
} else { } else {
SendKeyboardEvent(false, tmpData); guiAbstraction::SendKeyboardEvent(false, tmpData);
} }
} }
default: default:
@ -781,9 +785,9 @@ namespace guiAbstraction {
if (count>0) { if (count>0) {
etk::String tmpData = buf; etk::String tmpData = buf;
if(event.type == KeyPress) { if(event.type == KeyPress) {
SendKeyboardEvent(true, tmpData); guiAbstraction::SendKeyboardEvent(true, tmpData);
} else { } else {
SendKeyboardEvent(false, tmpData); guiAbstraction::SendKeyboardEvent(false, tmpData);
} }
} else { } else {
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode); EWOL_WARNING("Unknow event Key : " << event.xkey.keycode);
@ -794,9 +798,9 @@ namespace guiAbstraction {
if (true == find) { if (true == find) {
EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) ); EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
if(event.type == KeyPress) { if(event.type == KeyPress) {
SendKeyboardEventMove(true, keyInput); guiAbstraction::SendKeyboardEventMove(true, keyInput);
} else { } else {
SendKeyboardEventMove(false, keyInput); guiAbstraction::SendKeyboardEventMove(false, keyInput);
} }
} }
break; break;
@ -821,22 +825,22 @@ namespace guiAbstraction {
} }
}; };
void Stop(void) void X11_Stop(void)
{ {
m_run = false; m_run = false;
}; };
void ChangeSize(int32_t w, int32_t h) void X11_ChangeSize(int32_t w, int32_t h)
{ {
XResizeWindow(m_display, WindowHandle, w, h); XResizeWindow(m_display, WindowHandle, w, h);
}; };
void ChangePos(int32_t x, int32_t y) void X11_ChangePos(int32_t x, int32_t y)
{ {
XMoveWindow(m_display, WindowHandle, x, y); XMoveWindow(m_display, WindowHandle, x, y);
}; };
void GetAbsPos(int32_t & x, int32_t & y) void X11_GetAbsPos(int32_t & x, int32_t & y)
{ {
int tmp; int tmp;
unsigned int tmp2; unsigned int tmp2;
@ -844,38 +848,27 @@ namespace guiAbstraction {
XQueryPointer(m_display, WindowHandle, &fromroot, &tmpwin, &x, &y, &tmp, &tmp, &tmp2); XQueryPointer(m_display, WindowHandle, &fromroot, &tmpwin, &x, &y, &tmp, &tmp, &tmp2);
}; };
void KeyboardShow(ewol::keyboardMode_te mode) void X11_KeyboardShow(ewol::keyboardMode_te mode)
{ {
if (NULL != m_uniqueWindows) { if (NULL != m_uniqueWindows) {
m_uniqueWindows->KeyboardShow(mode); m_uniqueWindows->KeyboardShow(mode);
} }
} }
void KeyboardHide(void) void X11_KeyboardHide(void)
{ {
if (NULL != m_uniqueWindows) { if (NULL != m_uniqueWindows) {
m_uniqueWindows->KeyboardHide(); m_uniqueWindows->KeyboardHide();
} }
ForceRedrawAll(); X11_ForceRedrawAll();
} }
void ForceRedrawAll(void) void X11_ForceRedrawAll(void)
{ {
if (NULL != m_uniqueWindows) { if (NULL != m_uniqueWindows) {
m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height); m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height);
} }
}; };
bool X11_IsPressedInput(int32_t inputID)
private:
/*
int32_t m_startX;
int32_t m_startY;
int32_t m_screenOffsetX;
int32_t m_screenOffsetY;
*/
private:
bool inputIsPressed[20];
public:
bool IsPressedInput(int32_t inputID)
{ {
if( NB_MAX_INPUT > inputID if( NB_MAX_INPUT > inputID
&& 0 <= inputID) && 0 <= inputID)
@ -886,8 +879,7 @@ namespace guiAbstraction {
return false; return false;
} }
} }
};
};
@ -895,8 +887,6 @@ namespace guiAbstraction {
#define __class__ "guiAbstraction" #define __class__ "guiAbstraction"
static bool guiAbstractionIsInit = false; static bool guiAbstractionIsInit = false;
static guiAbstraction::X11systemInterface * myX11Access = NULL;
void guiAbstraction::Init(int32_t argc, char *argv[]) void guiAbstraction::Init(int32_t argc, char *argv[])
{ {
@ -904,28 +894,16 @@ void guiAbstraction::Init(int32_t argc, char *argv[])
// set the gui is init : // set the gui is init :
guiAbstractionIsInit = true; guiAbstractionIsInit = true;
EWOL_INFO("INIT for X11 environement"); EWOL_INFO("INIT for X11 environement");
myX11Access = new guiAbstraction::X11systemInterface(); X11_Init();
} else { } else {
EWOL_CRITICAL("Can not INIT X11 ==> already init before"); EWOL_CRITICAL("Can not INIT X11 ==> already init before");
} }
} }
void guiAbstraction::Run(void)
{
if (true == guiAbstractionIsInit) {
EWOL_INFO("Start Running");
myX11Access->Run();
EWOL_INFO("Stop Running");
} else {
EWOL_CRITICAL("Can not Run X11 ==> not init ... ");
}
}
void guiAbstraction::Stop(void) void guiAbstraction::Stop(void)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
myX11Access->Stop(); X11_Stop();
} else { } else {
EWOL_CRITICAL("Can not Stop X11 ==> not init ... "); EWOL_CRITICAL("Can not Stop X11 ==> not init ... ");
} }
@ -934,7 +912,7 @@ void guiAbstraction::Stop(void)
void guiAbstraction::SetDisplayOnWindows(ewol::Windows * newOne) void guiAbstraction::SetDisplayOnWindows(ewol::Windows * newOne)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
myX11Access->Setwindow(newOne); X11_Setwindow(newOne);
} else { } else {
EWOL_CRITICAL("Can not set Windows X11 ==> not init ... "); EWOL_CRITICAL("Can not set Windows X11 ==> not init ... ");
} }
@ -944,9 +922,6 @@ void guiAbstraction::UnInit(void)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
EWOL_INFO("UN-INIT for X11 environement"); EWOL_INFO("UN-INIT for X11 environement");
if (NULL != myX11Access) {
delete(myX11Access);
}
guiAbstractionIsInit = false; guiAbstractionIsInit = false;
} else { } else {
EWOL_CRITICAL("Can not Un-Init X11 ==> not init ... "); EWOL_CRITICAL("Can not Un-Init X11 ==> not init ... ");
@ -957,7 +932,7 @@ void guiAbstraction::UnInit(void)
void guiAbstraction::ChangeSize(int32_t w, int32_t h) void guiAbstraction::ChangeSize(int32_t w, int32_t h)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
myX11Access->ChangeSize(w, h); X11_ChangeSize(w, h);
} else { } else {
EWOL_CRITICAL("X11 ==> not init ... "); EWOL_CRITICAL("X11 ==> not init ... ");
} }
@ -966,7 +941,7 @@ void guiAbstraction::ChangeSize(int32_t w, int32_t h)
void guiAbstraction::ChangePos(int32_t x, int32_t y) void guiAbstraction::ChangePos(int32_t x, int32_t y)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
myX11Access->ChangePos(x, y); X11_ChangePos(x, y);
} else { } else {
EWOL_CRITICAL("X11 ==> not init ... "); EWOL_CRITICAL("X11 ==> not init ... ");
} }
@ -975,7 +950,7 @@ void guiAbstraction::ChangePos(int32_t x, int32_t y)
void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y) void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
myX11Access->GetAbsPos(x, y); X11_GetAbsPos(x, y);
} else { } else {
EWOL_CRITICAL("X11 ==> not init ... "); EWOL_CRITICAL("X11 ==> not init ... ");
} }
@ -984,7 +959,7 @@ void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
bool guiAbstraction::IsPressedInput(int32_t inputID) bool guiAbstraction::IsPressedInput(int32_t inputID)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
return myX11Access->IsPressedInput(inputID); return X11_IsPressedInput(inputID);
} else { } else {
EWOL_CRITICAL("X11 ==> not init ... "); EWOL_CRITICAL("X11 ==> not init ... ");
return false; return false;
@ -994,7 +969,7 @@ bool guiAbstraction::IsPressedInput(int32_t inputID)
void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode) void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
myX11Access->KeyboardShow(mode); X11_KeyboardShow(mode);
} else { } else {
EWOL_CRITICAL("X11 ==> not init ... "); EWOL_CRITICAL("X11 ==> not init ... ");
} }
@ -1003,7 +978,7 @@ void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode)
void guiAbstraction::KeyboardHide(void) void guiAbstraction::KeyboardHide(void)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
myX11Access->KeyboardHide(); X11_KeyboardHide();
} else { } else {
EWOL_CRITICAL("X11 ==> not init ... "); EWOL_CRITICAL("X11 ==> not init ... ");
} }
@ -1012,7 +987,7 @@ void guiAbstraction::KeyboardHide(void)
void guiAbstraction::ForceRedrawAll(void) void guiAbstraction::ForceRedrawAll(void)
{ {
if (true == guiAbstractionIsInit) { if (true == guiAbstractionIsInit) {
myX11Access->ForceRedrawAll(); X11_ForceRedrawAll();
} else { } else {
EWOL_CRITICAL("X11 ==> not init ... "); EWOL_CRITICAL("X11 ==> not init ... ");
} }
@ -1051,25 +1026,27 @@ void guiAbstraction::SendKeyboardEventMove(bool isDown, ewol::eventKbMoveType_te
int EWOL_appArgC = 0;
char **EWOL_appArgV = NULL;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
//EWOL_appArgC = argc;
//EWOL_appArgV = argv;
// start X11 thread ...
guiAbstraction::Init(argc, argv); guiAbstraction::Init(argc, argv);
// init Ewol
ewol::Init(argc, argv); //start the basic thread :
// Init Application ... EWOL_SystemStart();
APP_Init(argc, argv); // Run ...
// Start Ewol diwplay while X11_Run();
guiAbstraction::Run(); // close X11 :
// unset all windows X11_Stop();
ewol::DisplayWindows(NULL); // uninit ALL :
// call application to uninit EWOL_SystemStop();
APP_UnInit();
// basic abstraction un-init // basic abstraction un-init
guiAbstraction::UnInit(); guiAbstraction::UnInit();
// uninit Ewol
ewol::UnInit();
return 0; return 0;
} }

View File

@ -32,7 +32,6 @@
#include <ewol/Windows.h> #include <ewol/Windows.h>
namespace ewol { namespace ewol {
void Stop(void); void Stop(void);
void DisplayWindows(ewol::Windows * windows); void DisplayWindows(ewol::Windows * windows);

View File

@ -28,9 +28,9 @@
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
const char * const ewolEventButtonPressed = "ewol Button Pressed"; extern const char * const ewolEventButtonPressed = "ewol Button Pressed";
const char * const ewolEventButtonEnter = "ewol Button Enter"; extern const char * const ewolEventButtonEnter = "ewol Button Enter";
const char * const ewolEventButtonLeave = "ewol Button Leave"; extern const char * const ewolEventButtonLeave = "ewol Button Leave";

View File

@ -29,6 +29,10 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/Widget.h> #include <ewol/Widget.h>
extern const char * const ewolEventButtonPressed;
extern const char * const ewolEventButtonEnter;
extern const char * const ewolEventButtonLeave;
namespace ewol { namespace ewol {
class Button :public ewol::Widget class Button :public ewol::Widget
{ {

View File

@ -29,7 +29,7 @@
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
const char * ewolEventCheckBoxClicked = "ewol CheckBox Clicked"; extern const char * ewolEventCheckBoxClicked = "ewol CheckBox Clicked";
#undef __class__ #undef __class__
#define __class__ "ewol::CheckBox" #define __class__ "ewol::CheckBox"

View File

@ -29,6 +29,8 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/Widget.h> #include <ewol/Widget.h>
extern const char * ewolEventCheckBoxClicked;
namespace ewol { namespace ewol {
class CheckBox :public ewol::Widget class CheckBox :public ewol::Widget
{ {

View File

@ -29,8 +29,8 @@
#include <ewol/ewol.h> #include <ewol/ewol.h>
const char * const ewolEventEntryClick = "ewol Entry click"; extern const char * const ewolEventEntryClick = "ewol Entry click";
const char * const ewolEventEntryEnter = "ewol Entry Enter"; extern const char * const ewolEventEntryEnter = "ewol Entry Enter";

View File

@ -29,6 +29,9 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/Widget.h> #include <ewol/Widget.h>
extern const char * const ewolEventEntryClick;
extern const char * const ewolEventEntryEnter;
namespace ewol { namespace ewol {
class Entry :public ewol::Widget class Entry :public ewol::Widget
{ {

View File

@ -28,7 +28,7 @@
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
const char * const ewolEventLabelPressed = "ewol Label Pressed"; extern const char * const ewolEventLabelPressed = "ewol Label Pressed";

View File

@ -29,6 +29,8 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/Widget.h> #include <ewol/Widget.h>
extern const char * const ewolEventLabelPressed;
namespace ewol { namespace ewol {
class Label :public ewol::Widget class Label :public ewol::Widget
{ {

View File

@ -54,7 +54,7 @@ void SortList(etk::VectorType<etk::String *> &m_listDirectory)
const char * const ewolEventFileChooserSelectFolder = "ewol event file chooser Select Folder"; const char * const ewolEventFileChooserSelectFolder = "ewol-event-file-chooser-Select-Folder";
class FileChooserFolderList : public ewol::List class FileChooserFolderList : public ewol::List
{ {
@ -180,8 +180,8 @@ class FileChooserFolderList : public ewol::List
#undef __class__ #undef __class__
#define __class__ "ewol::FileChooser(FileList)" #define __class__ "ewol::FileChooser(FileList)"
const char * const ewolEventFileChooserSelectFile = "ewol event file chooser Select File"; const char * const ewolEventFileChooserSelectFile = "ewol-event-file-chooser-Select-File";
const char * const ewolEventFileChooserValidateFile = "ewol event file chooser Validate File"; const char * const ewolEventFileChooserValidateFile = "ewol-event-file-chooser-Validate-File";
class FileChooserFileList : public ewol::List class FileChooserFileList : public ewol::List
{ {
@ -312,8 +312,8 @@ class FileChooserFileList : public ewol::List
#define __class__ "ewol::FileChooser" #define __class__ "ewol::FileChooser"
const char * const ewolEventFileChooserCancel = "ewol event file chooser cancel"; extern const char * const ewolEventFileChooserCancel = "ewol-event-file-chooser-cancel";
const char * const ewolEventFileChooserValidate = "ewol event file chooser validate"; extern const char * const ewolEventFileChooserValidate = "ewol-event-file-chooser-validate";
ewol::FileChooser::FileChooser(void) ewol::FileChooser::FileChooser(void)
@ -365,7 +365,7 @@ ewol::FileChooser::FileChooser(void)
mySizerHori->SubWidgetAdd(mySpacer); mySizerHori->SubWidgetAdd(mySpacer);
myListFolder = new FileChooserFolderList(); myListFolder = new FileChooserFolderList();
m_widgetListFolderId = myListFolder->GetWidgetId(); m_widgetListFolderId = myListFolder->GetWidgetId();
myListFolder->ExternLinkOnEvent("ewol event file chooser Select Folder", GetWidgetId(), ewolEventFileChooserSelectFolder); myListFolder->ExternLinkOnEvent(ewolEventFileChooserSelectFolder, GetWidgetId(), ewolEventFileChooserSelectFolder);
myListFolder->SetExpendY(true); myListFolder->SetExpendY(true);
myListFolder->SetFillY(true); myListFolder->SetFillY(true);
mySizerHori->SubWidgetAdd(myListFolder); mySizerHori->SubWidgetAdd(myListFolder);
@ -374,8 +374,8 @@ ewol::FileChooser::FileChooser(void)
mySizerHori->SubWidgetAdd(mySpacer); mySizerHori->SubWidgetAdd(mySpacer);
myListFile = new FileChooserFileList(); myListFile = new FileChooserFileList();
m_widgetListFileId = myListFile->GetWidgetId(); m_widgetListFileId = myListFile->GetWidgetId();
myListFile->ExternLinkOnEvent("ewol event file chooser Select File", GetWidgetId(), ewolEventFileChooserSelectFile); myListFile->ExternLinkOnEvent(ewolEventFileChooserSelectFile, GetWidgetId(), ewolEventFileChooserSelectFile);
myListFile->ExternLinkOnEvent("ewol event file chooser Validate File", GetWidgetId(), ewolEventFileChooserValidateFile); myListFile->ExternLinkOnEvent(ewolEventFileChooserValidateFile, GetWidgetId(), ewolEventFileChooserValidateFile);
myListFile->SetExpendX(true); myListFile->SetExpendX(true);
myListFile->SetFillX(true); myListFile->SetFillX(true);
myListFile->SetExpendY(true); myListFile->SetExpendY(true);
@ -392,11 +392,11 @@ ewol::FileChooser::FileChooser(void)
mySizerHori->SubWidgetAdd(mySpacer); mySizerHori->SubWidgetAdd(mySpacer);
myButton = new ewol::Button("Open"); myButton = new ewol::Button("Open");
m_widgetValidateId = myButton->GetWidgetId(); m_widgetValidateId = myButton->GetWidgetId();
myButton->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), ewolEventFileChooserValidate); myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventFileChooserValidate);
mySizerHori->SubWidgetAdd(myButton); mySizerHori->SubWidgetAdd(myButton);
myButton = new ewol::Button("Cancel"); myButton = new ewol::Button("Cancel");
m_widgetCancelId = myButton->GetWidgetId(); m_widgetCancelId = myButton->GetWidgetId();
myButton->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), ewolEventFileChooserCancel); myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventFileChooserCancel);
mySizerHori->SubWidgetAdd(myButton); mySizerHori->SubWidgetAdd(myButton);
// set the default Folder properties: // set the default Folder properties:
@ -445,13 +445,13 @@ void ewol::FileChooser::SetFolder(etk::String folder)
bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y) bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
{ {
EWOL_INFO("Receive Event from the LIST ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << eventExternId << "\"" ); EWOL_INFO("Receive Event from the LIST ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" );
if (ewolEventFileChooserCancel == eventExternId) { if (ewolEventFileChooserCancel == generateEventId) {
//==> Auto remove ... //==> Auto remove ...
} else if (ewolEventFileChooserSelectFolder == eventExternId) { } else if (ewolEventFileChooserSelectFolder == generateEventId) {
//==> this is an internal event ... //==> this is an internal event ...
FileChooserFolderList * myListFolder = (FileChooserFolderList *)ewol::widgetManager::Get(m_widgetListFolderId); FileChooserFolderList * myListFolder = (FileChooserFolderList *)ewol::widgetManager::Get(m_widgetListFolderId);
etk::String tmpString = myListFolder->GetSelectedLine(); etk::String tmpString = myListFolder->GetSelectedLine();
@ -472,20 +472,20 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
UpdateCurrentFolder(); UpdateCurrentFolder();
m_hasSelectedFile = false; m_hasSelectedFile = false;
return true; return true;
} else if (ewolEventFileChooserSelectFile == eventExternId) { } else if (ewolEventFileChooserSelectFile == generateEventId) {
m_hasSelectedFile = true; m_hasSelectedFile = true;
FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId); FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId);
m_file = myListFile->GetSelectedLine(); m_file = myListFile->GetSelectedLine();
} else if (ewolEventFileChooserValidateFile == eventExternId) { } else if (ewolEventFileChooserValidateFile == generateEventId) {
m_hasSelectedFile = true; m_hasSelectedFile = true;
FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId); FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId);
m_file = myListFile->GetSelectedLine(); m_file = myListFile->GetSelectedLine();
// select the File ==> generate a validate // select the File ==> generate a validate
return GenEventInputExternal(ewolEventFileChooserValidate, x, y);; return GenEventInputExternal(ewolEventFileChooserValidate, x, y);;
} else if (ewolEventFileChooserValidate == eventExternId && false == m_hasSelectedFile) { } else if (ewolEventFileChooserValidate == generateEventId && false == m_hasSelectedFile) {
return false; return false;
} }
return GenEventInputExternal(eventExternId, x, y); return GenEventInputExternal(generateEventId, x, y);
}; };

View File

@ -29,13 +29,16 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/widget/PopUp.h> #include <ewol/widget/PopUp.h>
extern const char * const ewolEventFileChooserCancel;
extern const char * const ewolEventFileChooserValidate;
namespace ewol { namespace ewol {
class FileChooser : public ewol::PopUp class FileChooser : public ewol::PopUp
{ {
public: public:
FileChooser(void); FileChooser(void);
~FileChooser(void); ~FileChooser(void);
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y); virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y);
void SetTitle(etk::String label); void SetTitle(etk::String label);
void SetValidateLabel(etk::String label); void SetValidateLabel(etk::String label);
void SetCancelLabel(etk::String label); void SetCancelLabel(etk::String label);

View File

@ -46,8 +46,8 @@ extern "C" {
#define __class__ "ewol::Keyboard" #define __class__ "ewol::Keyboard"
const char * const ewolEventKeyboardHide = "ewol event Keyboard request hide"; extern const char * const ewolEventKeyboardHide = "ewol event Keyboard request hide";
const char * const ewolEventKeyEvent = "ewol event internal key event"; extern const char * const ewolEventKeyEvent = "ewol event internal key event";
ewol::Keyboard::Keyboard(void) ewol::Keyboard::Keyboard(void)

View File

@ -29,6 +29,8 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/Widget.h> #include <ewol/Widget.h>
extern const char * const ewolEventKeyboardHide;
namespace ewol { namespace ewol {
typedef enum { typedef enum {
KEYBOARD_MODE_TEXT, KEYBOARD_MODE_TEXT,

View File

@ -36,12 +36,12 @@
#define __class__ "ewol::StdPopUp" #define __class__ "ewol::StdPopUp"
const char * const ewolEventFileStdPopUpCancel = "ewol event std_pop_up cancel"; extern const char * const ewolEventFileStdPopUpCancel = "ewol event std_pop_up cancel";
const char * const ewolEventFileStdPopUpValidate = "ewol event std_pop_up validate"; extern const char * const ewolEventFileStdPopUpValidate = "ewol event std_pop_up validate";
const char * const ewolEventFileStdPopUpButton1 = "ewol event std_pop_up BT1"; extern const char * const ewolEventFileStdPopUpButton1 = "ewol event std_pop_up BT1";
const char * const ewolEventFileStdPopUpButton2 = "ewol event std_pop_up BT2"; extern const char * const ewolEventFileStdPopUpButton2 = "ewol event std_pop_up BT2";
const char * const ewolEventFileStdPopUpButton3 = "ewol event std_pop_up BT3"; extern const char * const ewolEventFileStdPopUpButton3 = "ewol event std_pop_up BT3";
const char * const ewolEventFileStdPopUpButton4 = "ewol event std_pop_up BT4"; extern const char * const ewolEventFileStdPopUpButton4 = "ewol event std_pop_up BT4";
ewol::FileChooser::FileChooser(void) ewol::FileChooser::FileChooser(void)

View File

@ -29,6 +29,13 @@
#include <ewol/Debug.h> #include <ewol/Debug.h>
#include <ewol/widget/PopUp.h> #include <ewol/widget/PopUp.h>
extern const char * const ewolEventFileStdPopUpCancel;
extern const char * const ewolEventFileStdPopUpValidate;
extern const char * const ewolEventFileStdPopUpButton1;
extern const char * const ewolEventFileStdPopUpButton2;
extern const char * const ewolEventFileStdPopUpButton3;
extern const char * const ewolEventFileStdPopUpButton4;
namespace ewol { namespace ewol {
class StdPopUp : public ewol::PopUp class StdPopUp : public ewol::PopUp
{ {

View File

@ -3,6 +3,7 @@
FILE_LIST = ewol/ewol.cpp \ FILE_LIST = ewol/ewol.cpp \
ewol/ewolInterne.cpp \ ewol/ewolInterne.cpp \
ewol/threadMsg.cpp \ ewol/threadMsg.cpp \
ewol/base/MainThread.cpp \
ewol/Debug.cpp \ ewol/Debug.cpp \
ewol/OObject.cpp \ ewol/OObject.cpp \
ewol/OObject/2DText.cpp \ ewol/OObject/2DText.cpp \
@ -14,6 +15,7 @@ FILE_LIST = ewol/ewol.cpp \
ewol/FontFreeType.cpp \ ewol/FontFreeType.cpp \
ewol/Widget.cpp \ ewol/Widget.cpp \
ewol/WidgetManager.cpp \ ewol/WidgetManager.cpp \
ewol/WidgetMessageMultiCast.cpp \
ewol/Windows.cpp \ ewol/Windows.cpp \
ewol/widget/Button.cpp \ ewol/widget/Button.cpp \
ewol/widget/Label.cpp \ ewol/widget/Label.cpp \