Optimize the X11 display to only generate the display when something change, optimise x11 main thread
This commit is contained in:
parent
87380eff95
commit
ff3e92fd01
@ -217,6 +217,7 @@ void ewol::widgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool needRedraw = true;
|
||||||
|
|
||||||
void ewol::widgetManager::GetDoubleBufferFlipFlop(void)
|
void ewol::widgetManager::GetDoubleBufferFlipFlop(void)
|
||||||
{
|
{
|
||||||
@ -227,6 +228,7 @@ void ewol::widgetManager::GetDoubleBufferFlipFlop(void)
|
|||||||
m_widgetList[iii].widgetPointer->DoubleBufferFlipFlop();
|
m_widgetList[iii].widgetPointer->DoubleBufferFlipFlop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
needRedraw = true;
|
||||||
pthread_mutex_unlock(&localMutex);
|
pthread_mutex_unlock(&localMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +237,15 @@ void ewol::widgetManager::GetDoubleBufferStartDraw(void)
|
|||||||
pthread_mutex_lock(&localMutex);
|
pthread_mutex_lock(&localMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ewol::widgetManager::GetDoubleBufferNeedDraw(void)
|
||||||
|
{
|
||||||
|
if (true == needRedraw) {
|
||||||
|
needRedraw = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::GetDoubleBufferStopDraw(void)
|
void ewol::widgetManager::GetDoubleBufferStopDraw(void)
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(&localMutex);
|
pthread_mutex_unlock(&localMutex);
|
||||||
|
@ -50,6 +50,7 @@ namespace ewol {
|
|||||||
int32_t GetDoubleBufferCreate(void);
|
int32_t GetDoubleBufferCreate(void);
|
||||||
int32_t GetDoubleBufferDraw(void);
|
int32_t GetDoubleBufferDraw(void);
|
||||||
void GetDoubleBufferFlipFlop(void);
|
void GetDoubleBufferFlipFlop(void);
|
||||||
|
bool GetDoubleBufferNeedDraw(void);
|
||||||
void GetDoubleBufferStartDraw(void);
|
void GetDoubleBufferStartDraw(void);
|
||||||
void GetDoubleBufferStopDraw(void);
|
void GetDoubleBufferStopDraw(void);
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,6 @@ namespace ewol {
|
|||||||
void SysOnShow(void) {};
|
void SysOnShow(void) {};
|
||||||
void SysOnHide(void) {};
|
void SysOnHide(void) {};
|
||||||
void SysOnKill(void) {};
|
void SysOnKill(void) {};
|
||||||
void SysOnExpose(void) {};
|
|
||||||
public:
|
public:
|
||||||
virtual void OnShow(void) { };
|
virtual void OnShow(void) { };
|
||||||
virtual void OnHide(void) { };
|
virtual void OnHide(void) { };
|
||||||
|
@ -39,20 +39,17 @@ static pthread_t androidJniThread;
|
|||||||
//static pthread_attr_t androidJniThreadAttr;
|
//static pthread_attr_t androidJniThreadAttr;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
JNI_NONE,
|
THREAD_UN_INIT,
|
||||||
JNI_INIT,
|
THREAD_RESIZE,
|
||||||
JNI_UN_INIT,
|
THREAD_HIDE,
|
||||||
JNI_DONE,
|
THREAD_SHOW,
|
||||||
JNI_RESIZE,
|
|
||||||
JNI_INPUT_MOTION,
|
THREAD_INPUT_MOTION,
|
||||||
JNI_INPUT_STATE,
|
THREAD_INPUT_STATE,
|
||||||
JNI_DATA_ARCHIVE_DIR,
|
|
||||||
JNI_APP_INIT,
|
|
||||||
JNI_APP_UN_INIT,
|
|
||||||
JNI_APP_RENDERER,
|
|
||||||
|
|
||||||
THREAD_KEYBORAD_KEY,
|
THREAD_KEYBORAD_KEY,
|
||||||
THREAD_KEYBORAD_MOVE,
|
THREAD_KEYBORAD_MOVE,
|
||||||
|
THREAD_JUST_DISPLAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -86,9 +83,6 @@ typedef struct {
|
|||||||
ewol::eventKbMoveType_te move;
|
ewol::eventKbMoveType_te move;
|
||||||
} eventKeyboardMove_ts;
|
} eventKeyboardMove_ts;
|
||||||
|
|
||||||
extern int EWOL_appArgC;
|
|
||||||
extern char *EWOL_appArgV[];
|
|
||||||
|
|
||||||
void EWOL_NativeEventInputMotion(int pointerID, float x, float y );
|
void EWOL_NativeEventInputMotion(int pointerID, float x, float y );
|
||||||
void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y );
|
void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y );
|
||||||
void EWOL_NativeResize(int w, int h );
|
void EWOL_NativeResize(int w, int h );
|
||||||
@ -106,82 +100,78 @@ static void* BaseAppEntry(void* param)
|
|||||||
ewol::theme::Init();
|
ewol::theme::Init();
|
||||||
ewol::widgetManager::Init();
|
ewol::widgetManager::Init();
|
||||||
ewol::InitFont();
|
ewol::InitFont();
|
||||||
APP_Init(EWOL_appArgC, EWOL_appArgV);
|
APP_Init();
|
||||||
|
int32_t countNbEvent = 0;
|
||||||
EWOL_DEBUG("BThread Init (END)");
|
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) {
|
if (data.type != THREAD_JUST_DISPLAY) {
|
||||||
case JNI_NONE:
|
countNbEvent++;
|
||||||
EWOL_DEBUG("Receive MSG : JNI_NONE");
|
//EWOL_DEBUG("EVENT");
|
||||||
break;
|
switch (data.type) {
|
||||||
case JNI_INIT:
|
case THREAD_UN_INIT:
|
||||||
EWOL_DEBUG("Receive MSG : JNI_INIT");
|
EWOL_DEBUG("Receive MSG : THREAD_UN_INIT");
|
||||||
//Android : EWOL_NativeApplicationInit();
|
requestEndProcessing = true;
|
||||||
break;
|
break;
|
||||||
case JNI_UN_INIT:
|
case THREAD_RESIZE:
|
||||||
EWOL_DEBUG("Receive MSG : JNI_UN_INIT");
|
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||||
requestEndProcessing = true;
|
{
|
||||||
break;
|
eventResize_ts * tmpData = (eventResize_ts*)data.data;
|
||||||
case JNI_DONE:
|
EWOL_NativeResize(tmpData->w, tmpData->h);
|
||||||
EWOL_DEBUG("Receive MSG : JNI_DONE");
|
}
|
||||||
break;
|
break;
|
||||||
case JNI_RESIZE:
|
case THREAD_INPUT_MOTION:
|
||||||
EWOL_DEBUG("Receive MSG : JNI_RESIZE");
|
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
|
||||||
{
|
{
|
||||||
eventResize_ts * tmpData = (eventResize_ts*)data.data;
|
eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data;
|
||||||
EWOL_NativeResize(tmpData->w, tmpData->h);
|
EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JNI_INPUT_MOTION:
|
case THREAD_INPUT_STATE:
|
||||||
//EWOL_DEBUG("Receive MSG : JNI_INPUT_MOTION");
|
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE");
|
||||||
{
|
{
|
||||||
eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data;
|
eventInputState_ts * tmpData = (eventInputState_ts*)data.data;
|
||||||
EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y);
|
EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JNI_INPUT_STATE:
|
case THREAD_KEYBORAD_KEY:
|
||||||
//EWOL_DEBUG("Receive MSG : JNI_INPUT_STATE");
|
EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
|
||||||
{
|
{
|
||||||
eventInputState_ts * tmpData = (eventInputState_ts*)data.data;
|
eventKeyboardKey_ts * tmpData = (eventKeyboardKey_ts*)data.data;
|
||||||
EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y);
|
etk::String keyInput = "a";
|
||||||
}
|
keyInput.c_str()[0] = tmpData->myChar;
|
||||||
break;
|
guiAbstraction::SendKeyboardEvent(tmpData->isDown, keyInput);
|
||||||
case JNI_DATA_ARCHIVE_DIR:
|
}
|
||||||
EWOL_DEBUG("Receive MSG : JNI_DATA_ARCHIVE_DIR");
|
break;
|
||||||
break;
|
case THREAD_KEYBORAD_MOVE:
|
||||||
case JNI_APP_INIT:
|
EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_MOVE");
|
||||||
EWOL_DEBUG("Receive MSG : JNI_APP_INIT");
|
{
|
||||||
break;
|
eventKeyboardMove_ts * tmpData = (eventKeyboardMove_ts*)data.data;
|
||||||
case JNI_APP_UN_INIT:
|
guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
|
||||||
EWOL_DEBUG("Receive MSG : JNI_APP_UN_INIT");
|
}
|
||||||
break;
|
break;
|
||||||
case JNI_APP_RENDERER:
|
case THREAD_HIDE:
|
||||||
EWOL_DEBUG("Receive MSG : JNI_APP_RENDERER");
|
EWOL_DEBUG("Receive MSG : THREAD_HIDE");
|
||||||
break;
|
//guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
|
||||||
case THREAD_KEYBORAD_KEY:
|
//gui_uniqueWindows->SysOnHide();
|
||||||
EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
|
break;
|
||||||
{
|
case THREAD_SHOW:
|
||||||
eventKeyboardKey_ts * tmpData = (eventKeyboardKey_ts*)data.data;
|
EWOL_DEBUG("Receive MSG : THREAD_SHOW");
|
||||||
etk::String keyInput = "a";
|
//guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
|
||||||
keyInput.c_str()[0] = tmpData->myChar;
|
//gui_uniqueWindows->SysOnShow();
|
||||||
guiAbstraction::SendKeyboardEvent(tmpData->isDown, keyInput);
|
break;
|
||||||
}
|
default:
|
||||||
break;
|
EWOL_DEBUG("Receive MSG : UNKNOW");
|
||||||
case THREAD_KEYBORAD_MOVE:
|
break;
|
||||||
EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_MOVE");
|
}
|
||||||
{
|
|
||||||
eventKeyboardMove_ts * tmpData = (eventKeyboardMove_ts*)data.data;
|
|
||||||
guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
EWOL_DEBUG("Receive MSG : UNKNOW");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
// TODO : when no message in the pipe : generate the display, and after, request the flip flop
|
|
||||||
if (0 == ewol::threadMsg::WaitingMessage(androidJniMsg)) {
|
if (0 == ewol::threadMsg::WaitingMessage(androidJniMsg)) {
|
||||||
ewol::widgetManager::GetDoubleBufferFlipFlop();
|
if (countNbEvent > 0) {
|
||||||
|
// TODO : Generate the display here ... Instead of every time we call the sub-Widget ...
|
||||||
|
ewol::widgetManager::GetDoubleBufferFlipFlop();
|
||||||
|
countNbEvent = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("BThread Un-Init (START)");
|
EWOL_DEBUG("BThread Un-Init (START)");
|
||||||
@ -236,7 +226,6 @@ void EWOL_SystemStart(void)
|
|||||||
// init the thread :
|
// init the thread :
|
||||||
pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
||||||
isGlobalSystemInit = true;
|
isGlobalSystemInit = true;
|
||||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +233,7 @@ void EWOL_SystemStop(void)
|
|||||||
{
|
{
|
||||||
if (true == isGlobalSystemInit) {
|
if (true == isGlobalSystemInit) {
|
||||||
isGlobalSystemInit = false;
|
isGlobalSystemInit = false;
|
||||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_UN_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_UN_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
||||||
|
|
||||||
EWOL_DEBUG("Wait end of the thread ...");
|
EWOL_DEBUG("Wait end of the thread ...");
|
||||||
// Wait end of the thread
|
// Wait end of the thread
|
||||||
@ -260,7 +249,7 @@ void EWOL_ThreadResize(int w, int h )
|
|||||||
eventResize_ts tmpData;
|
eventResize_ts tmpData;
|
||||||
tmpData.w = w;
|
tmpData.w = w;
|
||||||
tmpData.h = h;
|
tmpData.h = h;
|
||||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_RESIZE, ewol::threadMsg::MSG_PRIO_MEDIUM, &tmpData, sizeof(eventResize_ts) );
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_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 )
|
||||||
@ -269,7 +258,7 @@ void EWOL_ThreadEventInputMotion(int pointerID, float x, float y )
|
|||||||
tmpData.pointerID = pointerID;
|
tmpData.pointerID = pointerID;
|
||||||
tmpData.x = x;
|
tmpData.x = x;
|
||||||
tmpData.y = y;
|
tmpData.y = y;
|
||||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -280,7 +269,7 @@ void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y )
|
|||||||
tmpData.state = isUp;
|
tmpData.state = isUp;
|
||||||
tmpData.x = x;
|
tmpData.x = x;
|
||||||
tmpData.y = y;
|
tmpData.y = y;
|
||||||
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EWOL_ThreadKeyboardEvent(bool isDown, etk::String &keyInput)
|
void EWOL_ThreadKeyboardEvent(bool isDown, etk::String &keyInput)
|
||||||
@ -299,4 +288,18 @@ void EWOL_ThreadKeyboardEventMove(bool isDown, ewol::eventKbMoveType_te &keyInpu
|
|||||||
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_KEYBORAD_MOVE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventKeyboardMove_ts) );
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_KEYBORAD_MOVE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventKeyboardMove_ts) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EWOL_ThreadEventHide(void)
|
||||||
|
{
|
||||||
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_HIDE, ewol::threadMsg::MSG_PRIO_LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EWOL_ThreadEventShow(void)
|
||||||
|
{
|
||||||
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_SHOW, ewol::threadMsg::MSG_PRIO_LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EWOL_ThreadEventHasJustDisplay(void)
|
||||||
|
{
|
||||||
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_JUST_DISPLAY, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@ void EWOL_ThreadKeyboardEvent(bool isDown, etk::String &keyInput);
|
|||||||
void EWOL_ThreadKeyboardEventMove(bool isDown, ewol::eventKbMoveType_te &keyInput);
|
void EWOL_ThreadKeyboardEventMove(bool isDown, ewol::eventKbMoveType_te &keyInput);
|
||||||
|
|
||||||
|
|
||||||
|
void EWOL_ThreadEventHide(void);
|
||||||
|
void EWOL_ThreadEventShow(void);
|
||||||
|
void EWOL_ThreadEventHasJustDisplay(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -130,27 +130,27 @@ void EWOL_NativeEventInputMotion(int pointerID, float x, float y )
|
|||||||
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
||||||
if(NULL != gui_uniqueWindows) {
|
if(NULL != gui_uniqueWindows) {
|
||||||
//EWOL_DEBUG("ANDROID event: bt=" << pointerID+1 << " ** = \"MotionNotify\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
//EWOL_DEBUG("ANDROID event: bt=" << pointerID+1 << " ** = \"MotionNotify\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)x, (etkFloat_t)y);
|
gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
||||||
{
|
{
|
||||||
//EWOL_INFO("Event : Input ID=" << pointerID << " [" << isUp << "] x=" << x << " y=" << y);
|
//EWOL_INFO("GUI : Input ID=" << pointerID << " [" << isUp << "] x=" << x << " y=" << y);
|
||||||
if (isUp) {
|
if (isUp) {
|
||||||
//EWOL_INFO("Event : Input ID=" << pointerID << " [DOWN] x=" << x << " y=" << y);
|
//EWOL_DEBUG("GUI : Input ID=" << pointerID << " [DOWN] x=" << x << " y=" << y);
|
||||||
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
||||||
// Send Down message
|
// Send Down message
|
||||||
if (NULL != gui_uniqueWindows) {
|
if (NULL != gui_uniqueWindows) {
|
||||||
EWOL_DEBUG("ANDROID bt=" << pointerID+1 << " event : **=\"ButtonPress\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [DOWN] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)x, (etkFloat_t)y);
|
gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
}
|
}
|
||||||
// Check double or triple click event ...
|
// Check double or triple click event ...
|
||||||
m_previousDown_x = x;
|
m_previousDown_x = x;
|
||||||
m_previousDown_y = y;
|
m_previousDown_y = y;
|
||||||
if (m_previousBouttonId != pointerID+1) {
|
if (m_previousBouttonId != pointerID) {
|
||||||
m_previousBouttonId = pointerID+1;
|
m_previousBouttonId = pointerID;
|
||||||
m_previous_x = -1;
|
m_previous_x = -1;
|
||||||
m_previous_y = -1;
|
m_previous_y = -1;
|
||||||
m_previousTime = 0;
|
m_previousTime = 0;
|
||||||
@ -169,14 +169,14 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//EWOL_INFO("Event : Input ID=" << pointerID << " [UP] x=" << x << " y=" << y);
|
//EWOL_DEBUG("Event : Input ID=" << pointerID << " [UP] x=" << x << " y=" << y);
|
||||||
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
||||||
// Send Down message
|
// Send Down message
|
||||||
if (NULL != gui_uniqueWindows) {
|
if (NULL != gui_uniqueWindows) {
|
||||||
EWOL_DEBUG("ANDROID bt=" << pointerID+1 << " event : **=\"ButtonRelease\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [UP] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)x, (etkFloat_t)y);
|
gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
}
|
}
|
||||||
if (m_previousBouttonId != pointerID+1) {
|
if (m_previousBouttonId != pointerID) {
|
||||||
m_previousDown_x = -1;
|
m_previousDown_x = -1;
|
||||||
m_previousDown_y = -1;
|
m_previousDown_y = -1;
|
||||||
m_previousBouttonId = 0;
|
m_previousBouttonId = 0;
|
||||||
@ -185,16 +185,16 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
|||||||
m_previousTime = 0;
|
m_previousTime = 0;
|
||||||
m_previousDouble = false;
|
m_previousDouble = false;
|
||||||
} else {
|
} else {
|
||||||
int64_t currentTime = GetCurrentTime(); // return the tic in 10ms
|
int64_t currentTime = GetCurrentTime(); // return the tic in 1ms
|
||||||
//EWOL_DEBUG("time is : " << (int)currentTime << " "<< (int)(currentTime/100) <<"s " << (int)((currentTime%100)*10) << "ms");
|
EWOL_DEBUG("time is : " << (int)currentTime << " "<< (int)(currentTime/1000) <<"s " << (int)((currentTime%100)*10) << "ms delta : " << (currentTime - m_previousTime) << "<" << separateClickTime );
|
||||||
if (currentTime - m_previousTime >= separateClickTime) {
|
if (currentTime - m_previousTime >= separateClickTime) {
|
||||||
//check if the same area click :
|
//check if the same area click :
|
||||||
if( abs(m_previousDown_x - x) < offsetMoveClicked
|
if( abs(m_previousDown_x - x) < offsetMoveClicked
|
||||||
&& abs(m_previousDown_y - y) < offsetMoveClicked )
|
&& abs(m_previousDown_y - y) < offsetMoveClicked )
|
||||||
{
|
{
|
||||||
// might generate an sigle event :
|
// might generate an sigle event :
|
||||||
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedSingle\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [SINGLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)x, (etkFloat_t)y);
|
gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
m_previous_x = m_previousDown_x;
|
m_previous_x = m_previousDown_x;
|
||||||
m_previous_y = m_previousDown_y;
|
m_previous_y = m_previousDown_y;
|
||||||
m_previousTime = currentTime;
|
m_previousTime = currentTime;
|
||||||
@ -216,13 +216,13 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
|||||||
{
|
{
|
||||||
// might generate an sigle event :
|
// might generate an sigle event :
|
||||||
if (false == m_previousDouble) {
|
if (false == m_previousDouble) {
|
||||||
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedDouble\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [DOUBLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_DOUBLE, (etkFloat_t)x, (etkFloat_t)y);
|
gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_DOUBLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
m_previousTime = currentTime;
|
m_previousTime = currentTime;
|
||||||
m_previousDouble = true;
|
m_previousDouble = true;
|
||||||
} else {
|
} else {
|
||||||
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedTriple\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [TRIPLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)x, (etkFloat_t)y);
|
gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||||
// reset values ...
|
// reset values ...
|
||||||
m_previousDown_x = -1;
|
m_previousDown_x = -1;
|
||||||
m_previousDown_y = -1;
|
m_previousDown_y = -1;
|
||||||
@ -248,10 +248,37 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int64_t startTime = -1;
|
||||||
|
static int64_t nbCallTime = 0;
|
||||||
|
static int64_t nbDisplayTime = 0;
|
||||||
|
#define DISPLAY_PERIODE_MS (1000)
|
||||||
|
|
||||||
|
|
||||||
void EWOL_GenericDraw(void)
|
void EWOL_GenericDraw(void)
|
||||||
{
|
{
|
||||||
|
bool display = false;
|
||||||
|
nbCallTime++;
|
||||||
|
if (startTime<0) {
|
||||||
|
startTime = GetCurrentTime();
|
||||||
|
}
|
||||||
|
int64_t currentTime = GetCurrentTime();
|
||||||
|
//EWOL_DEBUG("current : " << currentTime << "time diff : " << (currentTime - startTime));
|
||||||
|
if ( (currentTime - startTime) > DISPLAY_PERIODE_MS) {
|
||||||
|
display = true;
|
||||||
|
}
|
||||||
ewol::widgetManager::GetDoubleBufferStartDraw();
|
ewol::widgetManager::GetDoubleBufferStartDraw();
|
||||||
gui_uniqueWindows->SysDraw();
|
if (true == ewol::widgetManager::GetDoubleBufferNeedDraw()) {
|
||||||
|
nbDisplayTime++;
|
||||||
|
gui_uniqueWindows->SysDraw();
|
||||||
|
}
|
||||||
ewol::widgetManager::GetDoubleBufferStopDraw();
|
ewol::widgetManager::GetDoubleBufferStopDraw();
|
||||||
|
// send Message that we just finished a display ...
|
||||||
|
EWOL_ThreadEventHasJustDisplay();
|
||||||
|
|
||||||
|
if (true == display) {
|
||||||
|
EWOL_DEBUG("display property : " << (int32_t)((double)nbDisplayTime/(double)DISPLAY_PERIODE_MS*(double)1000) << "/" << (int32_t)((double)nbCallTime/(double)DISPLAY_PERIODE_MS*(double)1000) << "fps");
|
||||||
|
nbCallTime = 0;
|
||||||
|
nbDisplayTime = 0;
|
||||||
|
startTime = -1;
|
||||||
|
}
|
||||||
}
|
}
|
@ -51,7 +51,7 @@ namespace guiAbstraction
|
|||||||
int64_t GetCurrentTime(void);
|
int64_t GetCurrentTime(void);
|
||||||
|
|
||||||
//!< must be define in CPP by the application ...
|
//!< must be define in CPP by the application ...
|
||||||
void APP_Init(int argc, char *argv[]);
|
void APP_Init(void);
|
||||||
void APP_UnInit(void);
|
void APP_UnInit(void);
|
||||||
|
|
||||||
#define NB_MAX_INPUT (20)
|
#define NB_MAX_INPUT (20)
|
||||||
|
@ -41,9 +41,7 @@
|
|||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "AndroidJNI"
|
#define __class__ "AndroidJNI"
|
||||||
int EWOL_appArgC = 0;
|
int32_t separateClickTime = 200;
|
||||||
char **EWOL_appArgV = NULL;
|
|
||||||
int32_t separateClickTime = 20;
|
|
||||||
int32_t offsetMoveClicked = 40;
|
int32_t offsetMoveClicked = 40;
|
||||||
int32_t offsetMoveClickedDouble = 300;
|
int32_t offsetMoveClickedDouble = 300;
|
||||||
|
|
||||||
@ -254,3 +252,14 @@ void glOrtho(GLfloat left,
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <ewol/ewol.h>
|
||||||
|
int32_t ewol::CmdLineNb(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
etk::String ewol::CmdLineGet(int32_t id)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
@ -46,7 +46,15 @@
|
|||||||
|
|
||||||
int64_t GetCurrentTime(void)
|
int64_t GetCurrentTime(void)
|
||||||
{
|
{
|
||||||
return times(NULL);
|
struct timespec now;
|
||||||
|
int ret = clock_gettime(CLOCK_REALTIME, &now);
|
||||||
|
if (ret != 0) {
|
||||||
|
// Error to get the time ...
|
||||||
|
now.tv_sec = time(NULL);
|
||||||
|
now.tv_nsec = 0;
|
||||||
|
}
|
||||||
|
//EWOL_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us");
|
||||||
|
return (int64_t)((int64_t)now.tv_sec*(int64_t)1000 + (int64_t)now.tv_nsec/(int64_t)1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
@ -117,7 +125,7 @@ extern ewol::Windows* gui_uniqueWindows;
|
|||||||
extern etkFloat_t gui_width;
|
extern etkFloat_t gui_width;
|
||||||
extern etkFloat_t gui_height;
|
extern etkFloat_t gui_height;
|
||||||
|
|
||||||
int32_t separateClickTime = 30;
|
int32_t separateClickTime = 300;
|
||||||
int32_t offsetMoveClicked = 10;
|
int32_t offsetMoveClicked = 10;
|
||||||
int32_t offsetMoveClickedDouble = 20;
|
int32_t offsetMoveClickedDouble = 20;
|
||||||
|
|
||||||
@ -381,9 +389,9 @@ void X11_Run(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
EWOL_NativeResize(event.xconfigure.width, event.xconfigure.height);
|
|
||||||
m_originX = event.xconfigure.x;
|
m_originX = event.xconfigure.x;
|
||||||
m_originY = event.xconfigure.y;
|
m_originY = event.xconfigure.y;
|
||||||
|
EWOL_ThreadResize(event.xconfigure.width, event.xconfigure.height);
|
||||||
break;
|
break;
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
m_cursorEventX = event.xbutton.x;
|
m_cursorEventX = event.xbutton.x;
|
||||||
@ -391,6 +399,7 @@ void X11_Run(void)
|
|||||||
if (event.xbutton.button < NB_MAX_INPUT) {
|
if (event.xbutton.button < NB_MAX_INPUT) {
|
||||||
inputIsPressed[event.xbutton.button] = true;
|
inputIsPressed[event.xbutton.button] = true;
|
||||||
}
|
}
|
||||||
|
EWOL_ThreadEventInputState(event.xbutton.button, true, (float)event.xbutton.x, (float)event.xbutton.y);
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
m_cursorEventX = event.xbutton.x;
|
m_cursorEventX = event.xbutton.x;
|
||||||
@ -398,245 +407,214 @@ void X11_Run(void)
|
|||||||
if (event.xbutton.button < NB_MAX_INPUT) {
|
if (event.xbutton.button < NB_MAX_INPUT) {
|
||||||
inputIsPressed[event.xbutton.button] = false;
|
inputIsPressed[event.xbutton.button] = false;
|
||||||
}
|
}
|
||||||
|
EWOL_ThreadEventInputState(event.xbutton.button, false, (float)event.xbutton.x, (float)event.xbutton.y);
|
||||||
break;
|
break;
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
|
m_cursorEventX = event.xcrossing.x;
|
||||||
|
m_cursorEventY = event.xcrossing.y;
|
||||||
|
//EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
||||||
|
//gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
|
||||||
|
break;
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
m_cursorEventX = event.xcrossing.x;
|
m_cursorEventX = event.xcrossing.x;
|
||||||
m_cursorEventY = event.xcrossing.y;
|
m_cursorEventY = event.xcrossing.y;
|
||||||
|
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
m_cursorEventX = event.xmotion.x;
|
m_cursorEventX = event.xmotion.x;
|
||||||
m_cursorEventY = event.xmotion.y;
|
m_cursorEventY = event.xmotion.y;
|
||||||
break;
|
{
|
||||||
}
|
// For compatibility of the Android system :
|
||||||
// parse event
|
bool findOne = false;
|
||||||
if(NULL == gui_uniqueWindows) {
|
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
|
||||||
EWOL_DEBUG("Has No Windows set...");
|
if (true == inputIsPressed[iii]) {
|
||||||
} else {
|
EWOL_VERBOSE("X11 event: bt=" << iii+1 << " " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")");
|
||||||
switch (event.type)
|
EWOL_ThreadEventInputMotion(iii+1, (float)event.xmotion.x, (float)event.xmotion.y);
|
||||||
{
|
findOne = true;
|
||||||
case ConfigureNotify:
|
|
||||||
//EWOL_VERBOSE("X11 event : " << event.type << " = \"ConfigureNotify\" Origin(" << event.xconfigure.x << "," << event.xconfigure.y << ") Size(" << event.xconfigure.width << "," << event.xconfigure.height << ")");
|
|
||||||
//gui_uniqueWindows->CalculateSize((etkFloat_t)event.xconfigure.width, (etkFloat_t)event.xconfigure.height);
|
|
||||||
//gui_uniqueWindows->SetOrigin(event.xconfigure.x, event.xconfigure.y);
|
|
||||||
break;
|
|
||||||
case Expose:
|
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"Expose\"");
|
|
||||||
gui_uniqueWindows->SysOnExpose();
|
|
||||||
break;
|
|
||||||
case ButtonPress:
|
|
||||||
EWOL_ThreadEventInputState(event.xbutton.button-1, true, (float)event.xbutton.x, (float)event.xbutton.y);
|
|
||||||
break;
|
|
||||||
case ButtonRelease:
|
|
||||||
EWOL_ThreadEventInputState(event.xbutton.button-1, false, (float)event.xbutton.x, (float)event.xbutton.y);
|
|
||||||
break;
|
|
||||||
case EnterNotify:
|
|
||||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
|
||||||
//gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
|
|
||||||
break;
|
|
||||||
case MotionNotify:
|
|
||||||
{
|
|
||||||
// For compatibility of the Android system :
|
|
||||||
bool findOne = false;
|
|
||||||
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
|
|
||||||
if (true == inputIsPressed[iii]) {
|
|
||||||
EWOL_VERBOSE("X11 event: bt=" << iii+1 << " " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")");
|
|
||||||
//gui_uniqueWindows->GenEventInput(iii+1, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)event.xmotion.x, (etkFloat_t)event.xmotion.y);
|
|
||||||
EWOL_ThreadEventInputMotion(iii+1, (float)event.xmotion.x, (float)event.xmotion.y);
|
|
||||||
findOne = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (false == findOne) {
|
|
||||||
EWOL_VERBOSE("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")");
|
|
||||||
//gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)event.xmotion.x, (etkFloat_t)event.xmotion.y);
|
|
||||||
EWOL_ThreadEventInputMotion(0, (float)event.xmotion.x, (float)event.xmotion.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
if (false == findOne) {
|
||||||
case LeaveNotify:
|
EWOL_VERBOSE("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")");
|
||||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
EWOL_ThreadEventInputMotion(0, (float)event.xmotion.x, (float)event.xmotion.y);
|
||||||
//gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_LEAVE, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
|
}
|
||||||
break;
|
}
|
||||||
case FocusIn:
|
break;
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusIn\"");
|
case FocusIn:
|
||||||
//gui_uniqueWindows->SetFocus();
|
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusIn\"");
|
||||||
break;
|
break;
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusOut\"");
|
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusOut\"");
|
||||||
//gui_uniqueWindows->RmFocus();
|
break;
|
||||||
break;
|
case KeyPress:
|
||||||
case KeyPress:
|
case KeyRelease:
|
||||||
case KeyRelease:
|
//EWOL_DEBUG("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
|
||||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
|
{
|
||||||
{
|
EWOL_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
|
||||||
EWOL_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
|
if (event.xkey.state & (1<<0) ) {
|
||||||
if (event.xkey.state & (1<<0) ) {
|
//EWOL_DEBUG(" Special Key : SHIFT");
|
||||||
//EWOL_DEBUG(" Special Key : SHIFT");
|
guiKeyBoardMode_Shift = true;
|
||||||
guiKeyBoardMode_Shift = true;
|
} else {
|
||||||
} else {
|
guiKeyBoardMode_Shift = false;
|
||||||
guiKeyBoardMode_Shift = false;
|
}
|
||||||
}
|
if (event.xkey.state & (1<<1) ) {
|
||||||
if (event.xkey.state & (1<<1) ) {
|
//EWOL_DEBUG(" Special Key : CAPS_LOCK");
|
||||||
//EWOL_DEBUG(" Special Key : CAPS_LOCK");
|
guiKeyBoardMode_CapLock = true;
|
||||||
guiKeyBoardMode_CapLock = true;
|
} else {
|
||||||
} else {
|
guiKeyBoardMode_CapLock = false;
|
||||||
guiKeyBoardMode_CapLock = false;
|
}
|
||||||
}
|
if (event.xkey.state & (1<<2) ) {
|
||||||
if (event.xkey.state & (1<<2) ) {
|
//EWOL_DEBUG(" Special Key : Ctrl");
|
||||||
//EWOL_DEBUG(" Special Key : Ctrl");
|
guiKeyBoardMode_Ctrl = true;
|
||||||
guiKeyBoardMode_Ctrl = true;
|
} else {
|
||||||
} else {
|
guiKeyBoardMode_Ctrl = false;
|
||||||
guiKeyBoardMode_Ctrl = false;
|
}
|
||||||
}
|
if (event.xkey.state & (1<<3) ) {
|
||||||
if (event.xkey.state & (1<<3) ) {
|
//EWOL_DEBUG(" Special Key : Alt");
|
||||||
//EWOL_DEBUG(" Special Key : Alt");
|
guiKeyBoardMode_Alt = true;
|
||||||
guiKeyBoardMode_Alt = true;
|
} else {
|
||||||
} else {
|
guiKeyBoardMode_Alt = false;
|
||||||
guiKeyBoardMode_Alt = false;
|
}
|
||||||
}
|
if (event.xkey.state & (1<<4) ) {
|
||||||
if (event.xkey.state & (1<<4) ) {
|
//EWOL_DEBUG(" Special Key : VER_num");
|
||||||
//EWOL_DEBUG(" Special Key : VER_num");
|
guiKeyBoardMode_VerNum = true;
|
||||||
guiKeyBoardMode_VerNum = true;
|
} else {
|
||||||
} else {
|
guiKeyBoardMode_VerNum = false;
|
||||||
guiKeyBoardMode_VerNum = false;
|
}
|
||||||
}
|
if (event.xkey.state & (1<<5) ) {
|
||||||
if (event.xkey.state & (1<<5) ) {
|
EWOL_DEBUG(" Special Key : MOD");
|
||||||
EWOL_DEBUG(" Special Key : MOD");
|
}
|
||||||
}
|
if (event.xkey.state & (1<<6) ) {
|
||||||
if (event.xkey.state & (1<<6) ) {
|
//EWOL_DEBUG(" Special Key : META");
|
||||||
//EWOL_DEBUG(" Special Key : META");
|
guiKeyBoardMode_Meta = true;
|
||||||
guiKeyBoardMode_Meta = true;
|
} else {
|
||||||
} else {
|
guiKeyBoardMode_Meta = false;
|
||||||
guiKeyBoardMode_Meta = false;
|
}
|
||||||
}
|
if (event.xkey.state & (1<<7) ) {
|
||||||
if (event.xkey.state & (1<<7) ) {
|
//EWOL_DEBUG(" Special Key : ALT_GR");
|
||||||
//EWOL_DEBUG(" Special Key : ALT_GR");
|
guiKeyBoardMode_AltGr = true;
|
||||||
guiKeyBoardMode_AltGr = true;
|
} else {
|
||||||
} else {
|
guiKeyBoardMode_AltGr = false;
|
||||||
guiKeyBoardMode_AltGr = false;
|
}
|
||||||
}
|
bool find = true;
|
||||||
bool find = true;
|
ewol::eventKbMoveType_te keyInput;
|
||||||
ewol::eventKbMoveType_te keyInput;
|
switch (event.xkey.keycode) {
|
||||||
switch (event.xkey.keycode) {
|
//case 80: // keypad
|
||||||
//case 80: // keypad
|
case 111: keyInput = ewol::EVENT_KB_MOVE_TYPE_UP; break;
|
||||||
case 111: keyInput = ewol::EVENT_KB_MOVE_TYPE_UP; break;
|
//case 83: // keypad
|
||||||
//case 83: // keypad
|
case 113: keyInput = ewol::EVENT_KB_MOVE_TYPE_LEFT; break;
|
||||||
case 113: keyInput = ewol::EVENT_KB_MOVE_TYPE_LEFT; break;
|
//case 85: // keypad
|
||||||
//case 85: // keypad
|
case 114: keyInput = ewol::EVENT_KB_MOVE_TYPE_RIGHT; break;
|
||||||
case 114: keyInput = ewol::EVENT_KB_MOVE_TYPE_RIGHT; break;
|
//case 88: // keypad
|
||||||
//case 88: // keypad
|
case 116: keyInput = ewol::EVENT_KB_MOVE_TYPE_DOWN; break;
|
||||||
case 116: keyInput = ewol::EVENT_KB_MOVE_TYPE_DOWN; break;
|
//case 81: // keypad
|
||||||
//case 81: // keypad
|
case 112: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_UP; break;
|
||||||
case 112: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_UP; break;
|
//case 89: // keypad
|
||||||
//case 89: // keypad
|
case 117: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_DOWN; break;
|
||||||
case 117: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_DOWN; break;
|
//case 79: // keypad
|
||||||
//case 79: // keypad
|
case 110: keyInput = ewol::EVENT_KB_MOVE_TYPE_START; break;
|
||||||
case 110: keyInput = ewol::EVENT_KB_MOVE_TYPE_START; break;
|
//case 87: // keypad
|
||||||
//case 87: // keypad
|
case 115: keyInput = ewol::EVENT_KB_MOVE_TYPE_END; break;
|
||||||
case 115: keyInput = ewol::EVENT_KB_MOVE_TYPE_END; break;
|
case 78: keyInput = ewol::EVENT_KB_MOVE_TYPE_ARRET_DEFIL; break;
|
||||||
case 78: keyInput = ewol::EVENT_KB_MOVE_TYPE_ARRET_DEFIL; break;
|
case 127: keyInput = ewol::EVENT_KB_MOVE_TYPE_WAIT; break;
|
||||||
case 127: keyInput = ewol::EVENT_KB_MOVE_TYPE_WAIT; break;
|
//case 90: // keypad
|
||||||
//case 90: // keypad
|
case 118:
|
||||||
case 118:
|
keyInput = ewol::EVENT_KB_MOVE_TYPE_INSERT;
|
||||||
keyInput = ewol::EVENT_KB_MOVE_TYPE_INSERT;
|
if(event.type == KeyRelease) {
|
||||||
if(event.type == KeyRelease) {
|
if (true == guiKeyBoardMode_Insert) {
|
||||||
if (true == guiKeyBoardMode_Insert) {
|
guiKeyBoardMode_Insert = false;
|
||||||
guiKeyBoardMode_Insert = false;
|
} else {
|
||||||
} else {
|
guiKeyBoardMode_Insert = true;
|
||||||
guiKeyBoardMode_Insert = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
//case 84: keyInput = ewol::EVENT_KB_MOVE_TYPE_CENTER; break; // Keypad
|
break;
|
||||||
case 67: keyInput = ewol::EVENT_KB_MOVE_TYPE_F1; break;
|
//case 84: keyInput = ewol::EVENT_KB_MOVE_TYPE_CENTER; break; // Keypad
|
||||||
case 68: keyInput = ewol::EVENT_KB_MOVE_TYPE_F2; break;
|
case 67: keyInput = ewol::EVENT_KB_MOVE_TYPE_F1; break;
|
||||||
case 69: keyInput = ewol::EVENT_KB_MOVE_TYPE_F3; break;
|
case 68: keyInput = ewol::EVENT_KB_MOVE_TYPE_F2; break;
|
||||||
case 70: keyInput = ewol::EVENT_KB_MOVE_TYPE_F4; break;
|
case 69: keyInput = ewol::EVENT_KB_MOVE_TYPE_F3; break;
|
||||||
case 71: keyInput = ewol::EVENT_KB_MOVE_TYPE_F5; break;
|
case 70: keyInput = ewol::EVENT_KB_MOVE_TYPE_F4; break;
|
||||||
case 72: keyInput = ewol::EVENT_KB_MOVE_TYPE_F6; break;
|
case 71: keyInput = ewol::EVENT_KB_MOVE_TYPE_F5; break;
|
||||||
case 73: keyInput = ewol::EVENT_KB_MOVE_TYPE_F7; break;
|
case 72: keyInput = ewol::EVENT_KB_MOVE_TYPE_F6; break;
|
||||||
case 74: keyInput = ewol::EVENT_KB_MOVE_TYPE_F8; break;
|
case 73: keyInput = ewol::EVENT_KB_MOVE_TYPE_F7; break;
|
||||||
case 75: keyInput = ewol::EVENT_KB_MOVE_TYPE_F9; break;
|
case 74: keyInput = ewol::EVENT_KB_MOVE_TYPE_F8; break;
|
||||||
case 76: keyInput = ewol::EVENT_KB_MOVE_TYPE_F10; break;
|
case 75: keyInput = ewol::EVENT_KB_MOVE_TYPE_F9; break;
|
||||||
case 95: keyInput = ewol::EVENT_KB_MOVE_TYPE_F11; break;
|
case 76: keyInput = ewol::EVENT_KB_MOVE_TYPE_F10; break;
|
||||||
case 96: keyInput = ewol::EVENT_KB_MOVE_TYPE_F12; break;
|
case 95: keyInput = ewol::EVENT_KB_MOVE_TYPE_F11; break;
|
||||||
case 66: keyInput = ewol::EVENT_KB_MOVE_TYPE_CAPLOCK; break;
|
case 96: keyInput = ewol::EVENT_KB_MOVE_TYPE_F12; break;
|
||||||
case 50: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_LEFT; break;
|
case 66: keyInput = ewol::EVENT_KB_MOVE_TYPE_CAPLOCK; break;
|
||||||
case 62: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_RIGHT; break;
|
case 50: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_LEFT; break;
|
||||||
case 37: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_LEFT; break;
|
case 62: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_RIGHT; break;
|
||||||
case 105: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_RIGHT; break;
|
case 37: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_LEFT; break;
|
||||||
case 133: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_LEFT; break;
|
case 105: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_RIGHT; break;
|
||||||
case 134: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_RIGHT; break;
|
case 133: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_LEFT; break;
|
||||||
case 64: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT; break;
|
case 134: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_RIGHT; break;
|
||||||
case 108: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT_GR; break;
|
case 64: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT; break;
|
||||||
case 135: keyInput = ewol::EVENT_KB_MOVE_TYPE_CONTEXT_MENU; break;
|
case 108: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT_GR; break;
|
||||||
case 77: keyInput = ewol::EVENT_KB_MOVE_TYPE_VER_NUM; break;
|
case 135: keyInput = ewol::EVENT_KB_MOVE_TYPE_CONTEXT_MENU; break;
|
||||||
case 91: // Suppr on keypad
|
case 77: keyInput = ewol::EVENT_KB_MOVE_TYPE_VER_NUM; break;
|
||||||
find = false;
|
case 91: // Suppr on keypad
|
||||||
{
|
find = false;
|
||||||
char buf[2];
|
{
|
||||||
buf[0] = 0x7F;
|
char buf[2];
|
||||||
buf[1] = 0x00;
|
buf[0] = 0x7F;
|
||||||
|
buf[1] = 0x00;
|
||||||
|
etk::String tmpData = buf;
|
||||||
|
if(event.type == KeyPress) {
|
||||||
|
EWOL_ThreadKeyboardEvent(true, tmpData);
|
||||||
|
} else {
|
||||||
|
EWOL_ThreadKeyboardEvent(false, tmpData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
find = false;
|
||||||
|
{
|
||||||
|
char buf[11];
|
||||||
|
KeySym keysym;
|
||||||
|
XComposeStatus status;
|
||||||
|
int count = XLookupString(&event.xkey, buf, 10, &keysym, &status);
|
||||||
|
buf[count] = '\0';
|
||||||
|
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode << " char=" << (int32_t)buf[0]);
|
||||||
|
if (buf[0] == '\r') {
|
||||||
|
buf[0] = '\n';
|
||||||
|
buf[1] = '\0';
|
||||||
|
}
|
||||||
|
if (count>0) {
|
||||||
etk::String tmpData = buf;
|
etk::String tmpData = buf;
|
||||||
if(event.type == KeyPress) {
|
if(event.type == KeyPress) {
|
||||||
EWOL_ThreadKeyboardEvent(true, tmpData);
|
EWOL_ThreadKeyboardEvent(true, tmpData);
|
||||||
} else {
|
} else {
|
||||||
EWOL_ThreadKeyboardEvent(false, tmpData);
|
EWOL_ThreadKeyboardEvent(false, tmpData);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode);
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
find = false;
|
|
||||||
{
|
|
||||||
char buf[11];
|
|
||||||
KeySym keysym;
|
|
||||||
XComposeStatus status;
|
|
||||||
int count = XLookupString(&event.xkey, buf, 10, &keysym, &status);
|
|
||||||
buf[count] = '\0';
|
|
||||||
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode << " char=" << (int32_t)buf[0]);
|
|
||||||
if (buf[0] == '\r') {
|
|
||||||
buf[0] = '\n';
|
|
||||||
buf[1] = '\0';
|
|
||||||
}
|
|
||||||
if (count>0) {
|
|
||||||
etk::String tmpData = buf;
|
|
||||||
if(event.type == KeyPress) {
|
|
||||||
EWOL_ThreadKeyboardEvent(true, tmpData);
|
|
||||||
} else {
|
|
||||||
EWOL_ThreadKeyboardEvent(false, tmpData);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (true == find) {
|
|
||||||
EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
|
|
||||||
if(event.type == KeyPress) {
|
|
||||||
EWOL_ThreadKeyboardEventMove(true, keyInput);
|
|
||||||
} else {
|
|
||||||
EWOL_ThreadKeyboardEventMove(false, keyInput);
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
}
|
||||||
|
if (true == find) {
|
||||||
|
EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
|
||||||
|
if(event.type == KeyPress) {
|
||||||
|
EWOL_ThreadKeyboardEventMove(true, keyInput);
|
||||||
|
} else {
|
||||||
|
EWOL_ThreadKeyboardEventMove(false, keyInput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//case DestroyNotify:
|
|
||||||
// break;
|
|
||||||
case MapNotify:
|
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"MapNotify\"");
|
|
||||||
gui_uniqueWindows->SysOnShow();
|
|
||||||
break;
|
break;
|
||||||
case UnmapNotify:
|
}
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"UnmapNotify\"");
|
//case DestroyNotify:
|
||||||
gui_uniqueWindows->SysOnHide();
|
// break;
|
||||||
break;
|
case MapNotify:
|
||||||
default:
|
EWOL_VERBOSE("X11 event : " << event.type << " = \"MapNotify\"");
|
||||||
EWOL_DEBUG("X11 event : " << event.type << " = \"???\"");
|
EWOL_ThreadEventShow();
|
||||||
}
|
break;
|
||||||
|
case UnmapNotify:
|
||||||
|
EWOL_VERBOSE("X11 event : " << event.type << " = \"UnmapNotify\"");
|
||||||
|
EWOL_ThreadEventHide();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
EWOL_DEBUG("X11 event : " << event.type << " = \"???\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_NativeRender();
|
EWOL_NativeRender();
|
||||||
//usleep( 100000 );
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -703,15 +681,34 @@ bool guiAbstraction::IsPressedInput(int32_t inputID)
|
|||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
|
static etk::VectorType<etk::String*> listArgs;
|
||||||
|
|
||||||
|
int32_t ewol::CmdLineNb(void)
|
||||||
|
{
|
||||||
|
return listArgs.Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
etk::String ewol::CmdLineGet(int32_t id)
|
||||||
|
{
|
||||||
|
if (id<0 && id>=listArgs.Size()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (NULL == listArgs[id]) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return *listArgs[id];
|
||||||
|
}
|
||||||
|
|
||||||
int EWOL_appArgC = 0;
|
|
||||||
char **EWOL_appArgV = NULL;
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
//EWOL_appArgC = argc;
|
for( int32_t i=1 ; i<argc; i++) {
|
||||||
//EWOL_appArgV = argv;
|
EWOL_INFO("CmdLine : \"" << argv[i] << "\"" );
|
||||||
|
etk::String* tmpString = new etk::String(argv[i]);
|
||||||
|
if (NULL != tmpString) {
|
||||||
|
listArgs.PushBack(tmpString);
|
||||||
|
}
|
||||||
|
}
|
||||||
// start X11 thread ...
|
// start X11 thread ...
|
||||||
X11_Init();
|
X11_Init();
|
||||||
//start the basic thread :
|
//start the basic thread :
|
||||||
@ -722,7 +719,13 @@ int main(int argc, char *argv[])
|
|||||||
guiAbstraction::Stop();
|
guiAbstraction::Stop();
|
||||||
// uninit ALL :
|
// uninit ALL :
|
||||||
EWOL_SystemStop();
|
EWOL_SystemStop();
|
||||||
|
for (int32_t iii=0; iii<listArgs.Size(); iii++) {
|
||||||
|
if (NULL != listArgs[iii]) {
|
||||||
|
delete listArgs[iii];
|
||||||
|
listArgs[iii] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listArgs.Clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ namespace ewol {
|
|||||||
void KeyboardShow(ewol::keyboardMode_te mode);
|
void KeyboardShow(ewol::keyboardMode_te mode);
|
||||||
void KeyboardHide(void);
|
void KeyboardHide(void);
|
||||||
void ForceRedrawAll(void);
|
void ForceRedrawAll(void);
|
||||||
|
int32_t CmdLineNb(void);
|
||||||
|
etk::String CmdLineGet(int32_t id);
|
||||||
|
|
||||||
bool IsSetCapsLock(void);
|
bool IsSetCapsLock(void);
|
||||||
bool IsSetShift(void);
|
bool IsSetShift(void);
|
||||||
|
@ -165,3 +165,5 @@ int32_t ewol::threadMsg::WaitingMessage(threadMsg_ts& messageData)
|
|||||||
pthread_mutex_unlock(&messageData.mutex);
|
pthread_mutex_unlock(&messageData.mutex);
|
||||||
return nbMessage;
|
return nbMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ namespace ewol {
|
|||||||
pthread_cond_t condition;
|
pthread_cond_t condition;
|
||||||
threadMsgContent_ts listOfMessages[MSG_PRIO_NUMBER][NUMBER_OF_ELEMENT_IN_THE_FIFO];
|
threadMsgContent_ts listOfMessages[MSG_PRIO_NUMBER][NUMBER_OF_ELEMENT_IN_THE_FIFO];
|
||||||
int32_t nbMessages[MSG_PRIO_NUMBER];
|
int32_t nbMessages[MSG_PRIO_NUMBER];
|
||||||
|
bool displayHasDone;
|
||||||
} threadMsg_ts;
|
} threadMsg_ts;
|
||||||
|
|
||||||
void Init(threadMsg_ts& messageData);
|
void Init(threadMsg_ts& messageData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user