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)
|
||||
{
|
||||
@ -227,6 +228,7 @@ void ewol::widgetManager::GetDoubleBufferFlipFlop(void)
|
||||
m_widgetList[iii].widgetPointer->DoubleBufferFlipFlop();
|
||||
}
|
||||
}
|
||||
needRedraw = true;
|
||||
pthread_mutex_unlock(&localMutex);
|
||||
}
|
||||
|
||||
@ -235,6 +237,15 @@ void ewol::widgetManager::GetDoubleBufferStartDraw(void)
|
||||
pthread_mutex_lock(&localMutex);
|
||||
}
|
||||
|
||||
bool ewol::widgetManager::GetDoubleBufferNeedDraw(void)
|
||||
{
|
||||
if (true == needRedraw) {
|
||||
needRedraw = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ewol::widgetManager::GetDoubleBufferStopDraw(void)
|
||||
{
|
||||
pthread_mutex_unlock(&localMutex);
|
||||
|
@ -50,6 +50,7 @@ namespace ewol {
|
||||
int32_t GetDoubleBufferCreate(void);
|
||||
int32_t GetDoubleBufferDraw(void);
|
||||
void GetDoubleBufferFlipFlop(void);
|
||||
bool GetDoubleBufferNeedDraw(void);
|
||||
void GetDoubleBufferStartDraw(void);
|
||||
void GetDoubleBufferStopDraw(void);
|
||||
};
|
||||
|
@ -45,7 +45,6 @@ namespace ewol {
|
||||
void SysOnShow(void) {};
|
||||
void SysOnHide(void) {};
|
||||
void SysOnKill(void) {};
|
||||
void SysOnExpose(void) {};
|
||||
public:
|
||||
virtual void OnShow(void) { };
|
||||
virtual void OnHide(void) { };
|
||||
|
@ -39,20 +39,17 @@ static pthread_t androidJniThread;
|
||||
//static pthread_attr_t androidJniThreadAttr;
|
||||
|
||||
enum {
|
||||
JNI_NONE,
|
||||
JNI_INIT,
|
||||
JNI_UN_INIT,
|
||||
JNI_DONE,
|
||||
JNI_RESIZE,
|
||||
JNI_INPUT_MOTION,
|
||||
JNI_INPUT_STATE,
|
||||
JNI_DATA_ARCHIVE_DIR,
|
||||
JNI_APP_INIT,
|
||||
JNI_APP_UN_INIT,
|
||||
JNI_APP_RENDERER,
|
||||
THREAD_UN_INIT,
|
||||
THREAD_RESIZE,
|
||||
THREAD_HIDE,
|
||||
THREAD_SHOW,
|
||||
|
||||
THREAD_INPUT_MOTION,
|
||||
THREAD_INPUT_STATE,
|
||||
|
||||
THREAD_KEYBORAD_KEY,
|
||||
THREAD_KEYBORAD_MOVE,
|
||||
THREAD_JUST_DISPLAY,
|
||||
};
|
||||
|
||||
|
||||
@ -86,9 +83,6 @@ typedef struct {
|
||||
ewol::eventKbMoveType_te move;
|
||||
} eventKeyboardMove_ts;
|
||||
|
||||
extern int EWOL_appArgC;
|
||||
extern char *EWOL_appArgV[];
|
||||
|
||||
void EWOL_NativeEventInputMotion(int pointerID, float x, float y );
|
||||
void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y );
|
||||
void EWOL_NativeResize(int w, int h );
|
||||
@ -106,82 +100,78 @@ static void* BaseAppEntry(void* param)
|
||||
ewol::theme::Init();
|
||||
ewol::widgetManager::Init();
|
||||
ewol::InitFont();
|
||||
APP_Init(EWOL_appArgC, EWOL_appArgV);
|
||||
APP_Init();
|
||||
int32_t countNbEvent = 0;
|
||||
EWOL_DEBUG("BThread Init (END)");
|
||||
while(false == requestEndProcessing) {
|
||||
ewol::threadMsg::threadMsgContent_ts data;
|
||||
ewol::threadMsg::WaitMessage(androidJniMsg, data);
|
||||
switch (data.type) {
|
||||
case JNI_NONE:
|
||||
EWOL_DEBUG("Receive MSG : JNI_NONE");
|
||||
break;
|
||||
case JNI_INIT:
|
||||
EWOL_DEBUG("Receive MSG : JNI_INIT");
|
||||
//Android : EWOL_NativeApplicationInit();
|
||||
break;
|
||||
case JNI_UN_INIT:
|
||||
EWOL_DEBUG("Receive MSG : JNI_UN_INIT");
|
||||
requestEndProcessing = true;
|
||||
break;
|
||||
case JNI_DONE:
|
||||
EWOL_DEBUG("Receive MSG : JNI_DONE");
|
||||
break;
|
||||
case JNI_RESIZE:
|
||||
EWOL_DEBUG("Receive MSG : JNI_RESIZE");
|
||||
{
|
||||
eventResize_ts * tmpData = (eventResize_ts*)data.data;
|
||||
EWOL_NativeResize(tmpData->w, tmpData->h);
|
||||
}
|
||||
break;
|
||||
case JNI_INPUT_MOTION:
|
||||
//EWOL_DEBUG("Receive MSG : JNI_INPUT_MOTION");
|
||||
{
|
||||
eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data;
|
||||
EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y);
|
||||
}
|
||||
break;
|
||||
case JNI_INPUT_STATE:
|
||||
//EWOL_DEBUG("Receive MSG : JNI_INPUT_STATE");
|
||||
{
|
||||
eventInputState_ts * tmpData = (eventInputState_ts*)data.data;
|
||||
EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y);
|
||||
}
|
||||
break;
|
||||
case JNI_DATA_ARCHIVE_DIR:
|
||||
EWOL_DEBUG("Receive MSG : JNI_DATA_ARCHIVE_DIR");
|
||||
break;
|
||||
case JNI_APP_INIT:
|
||||
EWOL_DEBUG("Receive MSG : JNI_APP_INIT");
|
||||
break;
|
||||
case JNI_APP_UN_INIT:
|
||||
EWOL_DEBUG("Receive MSG : JNI_APP_UN_INIT");
|
||||
break;
|
||||
case JNI_APP_RENDERER:
|
||||
EWOL_DEBUG("Receive MSG : JNI_APP_RENDERER");
|
||||
break;
|
||||
case THREAD_KEYBORAD_KEY:
|
||||
EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
|
||||
{
|
||||
eventKeyboardKey_ts * tmpData = (eventKeyboardKey_ts*)data.data;
|
||||
etk::String keyInput = "a";
|
||||
keyInput.c_str()[0] = tmpData->myChar;
|
||||
guiAbstraction::SendKeyboardEvent(tmpData->isDown, keyInput);
|
||||
}
|
||||
break;
|
||||
case THREAD_KEYBORAD_MOVE:
|
||||
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;
|
||||
if (data.type != THREAD_JUST_DISPLAY) {
|
||||
countNbEvent++;
|
||||
//EWOL_DEBUG("EVENT");
|
||||
switch (data.type) {
|
||||
case THREAD_UN_INIT:
|
||||
EWOL_DEBUG("Receive MSG : THREAD_UN_INIT");
|
||||
requestEndProcessing = true;
|
||||
break;
|
||||
case THREAD_RESIZE:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||
{
|
||||
eventResize_ts * tmpData = (eventResize_ts*)data.data;
|
||||
EWOL_NativeResize(tmpData->w, tmpData->h);
|
||||
}
|
||||
break;
|
||||
case THREAD_INPUT_MOTION:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
|
||||
{
|
||||
eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data;
|
||||
EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y);
|
||||
}
|
||||
break;
|
||||
case THREAD_INPUT_STATE:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE");
|
||||
{
|
||||
eventInputState_ts * tmpData = (eventInputState_ts*)data.data;
|
||||
EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y);
|
||||
}
|
||||
break;
|
||||
case THREAD_KEYBORAD_KEY:
|
||||
EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
|
||||
{
|
||||
eventKeyboardKey_ts * tmpData = (eventKeyboardKey_ts*)data.data;
|
||||
etk::String keyInput = "a";
|
||||
keyInput.c_str()[0] = tmpData->myChar;
|
||||
guiAbstraction::SendKeyboardEvent(tmpData->isDown, keyInput);
|
||||
}
|
||||
break;
|
||||
case THREAD_KEYBORAD_MOVE:
|
||||
EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_MOVE");
|
||||
{
|
||||
eventKeyboardMove_ts * tmpData = (eventKeyboardMove_ts*)data.data;
|
||||
guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
|
||||
}
|
||||
break;
|
||||
case THREAD_HIDE:
|
||||
EWOL_DEBUG("Receive MSG : THREAD_HIDE");
|
||||
//guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
|
||||
//gui_uniqueWindows->SysOnHide();
|
||||
break;
|
||||
case THREAD_SHOW:
|
||||
EWOL_DEBUG("Receive MSG : THREAD_SHOW");
|
||||
//guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
|
||||
//gui_uniqueWindows->SysOnShow();
|
||||
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)) {
|
||||
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)");
|
||||
@ -236,7 +226,6 @@ void EWOL_SystemStart(void)
|
||||
// init the thread :
|
||||
pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
||||
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) {
|
||||
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 ...");
|
||||
// Wait end of the thread
|
||||
@ -260,7 +249,7 @@ 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) );
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_RESIZE, ewol::threadMsg::MSG_PRIO_MEDIUM, &tmpData, sizeof(eventResize_ts) );
|
||||
}
|
||||
|
||||
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.x = x;
|
||||
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.x = x;
|
||||
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)
|
||||
@ -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) );
|
||||
}
|
||||
|
||||
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_ThreadEventHide(void);
|
||||
void EWOL_ThreadEventShow(void);
|
||||
void EWOL_ThreadEventHasJustDisplay(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -130,27 +130,27 @@ void EWOL_NativeEventInputMotion(int pointerID, float x, float y )
|
||||
if(0<=pointerID && pointerID < NB_MAX_INPUT ) {
|
||||
if(NULL != gui_uniqueWindows) {
|
||||
//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 )
|
||||
{
|
||||
//EWOL_INFO("Event : Input ID=" << pointerID << " [" << isUp << "] x=" << x << " y=" << y);
|
||||
//EWOL_INFO("GUI : Input ID=" << pointerID << " [" << isUp << "] x=" << x << " y=" << y);
|
||||
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 ) {
|
||||
// Send Down message
|
||||
if (NULL != gui_uniqueWindows) {
|
||||
EWOL_DEBUG("ANDROID bt=" << pointerID+1 << " event : **=\"ButtonPress\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)x, (etkFloat_t)y);
|
||||
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [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 ...
|
||||
m_previousDown_x = x;
|
||||
m_previousDown_y = y;
|
||||
if (m_previousBouttonId != pointerID+1) {
|
||||
m_previousBouttonId = pointerID+1;
|
||||
if (m_previousBouttonId != pointerID) {
|
||||
m_previousBouttonId = pointerID;
|
||||
m_previous_x = -1;
|
||||
m_previous_y = -1;
|
||||
m_previousTime = 0;
|
||||
@ -169,14 +169,14 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
||||
}
|
||||
}
|
||||
} 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 ) {
|
||||
// Send Down message
|
||||
if (NULL != gui_uniqueWindows) {
|
||||
EWOL_DEBUG("ANDROID bt=" << pointerID+1 << " event : **=\"ButtonRelease\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)x, (etkFloat_t)y);
|
||||
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [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_y = -1;
|
||||
m_previousBouttonId = 0;
|
||||
@ -185,16 +185,16 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
||||
m_previousTime = 0;
|
||||
m_previousDouble = false;
|
||||
} else {
|
||||
int64_t currentTime = GetCurrentTime(); // return the tic in 10ms
|
||||
//EWOL_DEBUG("time is : " << (int)currentTime << " "<< (int)(currentTime/100) <<"s " << (int)((currentTime%100)*10) << "ms");
|
||||
int64_t currentTime = GetCurrentTime(); // return the tic in 1ms
|
||||
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) {
|
||||
//check if the same area click :
|
||||
if( abs(m_previousDown_x - x) < offsetMoveClicked
|
||||
&& abs(m_previousDown_y - y) < offsetMoveClicked )
|
||||
{
|
||||
// might generate an sigle event :
|
||||
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedSingle\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [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_y = m_previousDown_y;
|
||||
m_previousTime = currentTime;
|
||||
@ -216,13 +216,13 @@ void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y )
|
||||
{
|
||||
// might generate an sigle event :
|
||||
if (false == m_previousDouble) {
|
||||
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedDouble\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_DOUBLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [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_previousDouble = true;
|
||||
} else {
|
||||
EWOL_DEBUG("ANDROID event : ** = \"ButtonClickedTriple\" (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||
gui_uniqueWindows->GenEventInput(pointerID+1, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||
EWOL_DEBUG("GUI : Input ID=" << pointerID << " [TRIPLE] (" << (etkFloat_t)x << "," << (etkFloat_t)y << ")");
|
||||
gui_uniqueWindows->GenEventInput(pointerID, ewol::EVENT_INPUT_TYPE_TRIPLE, (etkFloat_t)x, (etkFloat_t)y);
|
||||
// reset values ...
|
||||
m_previousDown_x = -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)
|
||||
{
|
||||
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();
|
||||
gui_uniqueWindows->SysDraw();
|
||||
if (true == ewol::widgetManager::GetDoubleBufferNeedDraw()) {
|
||||
nbDisplayTime++;
|
||||
gui_uniqueWindows->SysDraw();
|
||||
}
|
||||
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);
|
||||
|
||||
//!< must be define in CPP by the application ...
|
||||
void APP_Init(int argc, char *argv[]);
|
||||
void APP_Init(void);
|
||||
void APP_UnInit(void);
|
||||
|
||||
#define NB_MAX_INPUT (20)
|
||||
|
@ -41,9 +41,7 @@
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "AndroidJNI"
|
||||
int EWOL_appArgC = 0;
|
||||
char **EWOL_appArgV = NULL;
|
||||
int32_t separateClickTime = 20;
|
||||
int32_t separateClickTime = 200;
|
||||
int32_t offsetMoveClicked = 40;
|
||||
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)
|
||||
{
|
||||
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__
|
||||
@ -117,7 +125,7 @@ extern ewol::Windows* gui_uniqueWindows;
|
||||
extern etkFloat_t gui_width;
|
||||
extern etkFloat_t gui_height;
|
||||
|
||||
int32_t separateClickTime = 30;
|
||||
int32_t separateClickTime = 300;
|
||||
int32_t offsetMoveClicked = 10;
|
||||
int32_t offsetMoveClickedDouble = 20;
|
||||
|
||||
@ -381,9 +389,9 @@ void X11_Run(void)
|
||||
}
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
EWOL_NativeResize(event.xconfigure.width, event.xconfigure.height);
|
||||
m_originX = event.xconfigure.x;
|
||||
m_originY = event.xconfigure.y;
|
||||
EWOL_ThreadResize(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case ButtonPress:
|
||||
m_cursorEventX = event.xbutton.x;
|
||||
@ -391,6 +399,7 @@ void X11_Run(void)
|
||||
if (event.xbutton.button < NB_MAX_INPUT) {
|
||||
inputIsPressed[event.xbutton.button] = true;
|
||||
}
|
||||
EWOL_ThreadEventInputState(event.xbutton.button, true, (float)event.xbutton.x, (float)event.xbutton.y);
|
||||
break;
|
||||
case ButtonRelease:
|
||||
m_cursorEventX = event.xbutton.x;
|
||||
@ -398,245 +407,214 @@ void X11_Run(void)
|
||||
if (event.xbutton.button < NB_MAX_INPUT) {
|
||||
inputIsPressed[event.xbutton.button] = false;
|
||||
}
|
||||
EWOL_ThreadEventInputState(event.xbutton.button, false, (float)event.xbutton.x, (float)event.xbutton.y);
|
||||
break;
|
||||
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:
|
||||
m_cursorEventX = event.xcrossing.x;
|
||||
m_cursorEventY = event.xcrossing.y;
|
||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
||||
break;
|
||||
case MotionNotify:
|
||||
m_cursorEventX = event.xmotion.x;
|
||||
m_cursorEventY = event.xmotion.y;
|
||||
break;
|
||||
}
|
||||
// parse event
|
||||
if(NULL == gui_uniqueWindows) {
|
||||
EWOL_DEBUG("Has No Windows set...");
|
||||
} else {
|
||||
switch (event.type)
|
||||
{
|
||||
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);
|
||||
{
|
||||
// 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 << ")");
|
||||
EWOL_ThreadEventInputMotion(iii+1, (float)event.xmotion.x, (float)event.xmotion.y);
|
||||
findOne = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LeaveNotify:
|
||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
||||
//gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_LEAVE, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
|
||||
break;
|
||||
case FocusIn:
|
||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusIn\"");
|
||||
//gui_uniqueWindows->SetFocus();
|
||||
break;
|
||||
case FocusOut:
|
||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusOut\"");
|
||||
//gui_uniqueWindows->RmFocus();
|
||||
break;
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
|
||||
{
|
||||
EWOL_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
|
||||
if (event.xkey.state & (1<<0) ) {
|
||||
//EWOL_DEBUG(" Special Key : SHIFT");
|
||||
guiKeyBoardMode_Shift = true;
|
||||
} else {
|
||||
guiKeyBoardMode_Shift = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<1) ) {
|
||||
//EWOL_DEBUG(" Special Key : CAPS_LOCK");
|
||||
guiKeyBoardMode_CapLock = true;
|
||||
} else {
|
||||
guiKeyBoardMode_CapLock = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<2) ) {
|
||||
//EWOL_DEBUG(" Special Key : Ctrl");
|
||||
guiKeyBoardMode_Ctrl = true;
|
||||
} else {
|
||||
guiKeyBoardMode_Ctrl = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<3) ) {
|
||||
//EWOL_DEBUG(" Special Key : Alt");
|
||||
guiKeyBoardMode_Alt = true;
|
||||
} else {
|
||||
guiKeyBoardMode_Alt = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<4) ) {
|
||||
//EWOL_DEBUG(" Special Key : VER_num");
|
||||
guiKeyBoardMode_VerNum = true;
|
||||
} else {
|
||||
guiKeyBoardMode_VerNum = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<5) ) {
|
||||
EWOL_DEBUG(" Special Key : MOD");
|
||||
}
|
||||
if (event.xkey.state & (1<<6) ) {
|
||||
//EWOL_DEBUG(" Special Key : META");
|
||||
guiKeyBoardMode_Meta = true;
|
||||
} else {
|
||||
guiKeyBoardMode_Meta = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<7) ) {
|
||||
//EWOL_DEBUG(" Special Key : ALT_GR");
|
||||
guiKeyBoardMode_AltGr = true;
|
||||
} else {
|
||||
guiKeyBoardMode_AltGr = false;
|
||||
}
|
||||
bool find = true;
|
||||
ewol::eventKbMoveType_te keyInput;
|
||||
switch (event.xkey.keycode) {
|
||||
//case 80: // keypad
|
||||
case 111: keyInput = ewol::EVENT_KB_MOVE_TYPE_UP; break;
|
||||
//case 83: // keypad
|
||||
case 113: keyInput = ewol::EVENT_KB_MOVE_TYPE_LEFT; break;
|
||||
//case 85: // keypad
|
||||
case 114: keyInput = ewol::EVENT_KB_MOVE_TYPE_RIGHT; break;
|
||||
//case 88: // keypad
|
||||
case 116: keyInput = ewol::EVENT_KB_MOVE_TYPE_DOWN; break;
|
||||
//case 81: // keypad
|
||||
case 112: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_UP; break;
|
||||
//case 89: // keypad
|
||||
case 117: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_DOWN; break;
|
||||
//case 79: // keypad
|
||||
case 110: keyInput = ewol::EVENT_KB_MOVE_TYPE_START; break;
|
||||
//case 87: // keypad
|
||||
case 115: keyInput = ewol::EVENT_KB_MOVE_TYPE_END; break;
|
||||
case 78: keyInput = ewol::EVENT_KB_MOVE_TYPE_ARRET_DEFIL; break;
|
||||
case 127: keyInput = ewol::EVENT_KB_MOVE_TYPE_WAIT; break;
|
||||
//case 90: // keypad
|
||||
case 118:
|
||||
keyInput = ewol::EVENT_KB_MOVE_TYPE_INSERT;
|
||||
if(event.type == KeyRelease) {
|
||||
if (true == guiKeyBoardMode_Insert) {
|
||||
guiKeyBoardMode_Insert = false;
|
||||
} else {
|
||||
guiKeyBoardMode_Insert = true;
|
||||
}
|
||||
if (false == findOne) {
|
||||
EWOL_VERBOSE("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")");
|
||||
EWOL_ThreadEventInputMotion(0, (float)event.xmotion.x, (float)event.xmotion.y);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FocusIn:
|
||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusIn\"");
|
||||
break;
|
||||
case FocusOut:
|
||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusOut\"");
|
||||
break;
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
|
||||
{
|
||||
EWOL_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
|
||||
if (event.xkey.state & (1<<0) ) {
|
||||
//EWOL_DEBUG(" Special Key : SHIFT");
|
||||
guiKeyBoardMode_Shift = true;
|
||||
} else {
|
||||
guiKeyBoardMode_Shift = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<1) ) {
|
||||
//EWOL_DEBUG(" Special Key : CAPS_LOCK");
|
||||
guiKeyBoardMode_CapLock = true;
|
||||
} else {
|
||||
guiKeyBoardMode_CapLock = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<2) ) {
|
||||
//EWOL_DEBUG(" Special Key : Ctrl");
|
||||
guiKeyBoardMode_Ctrl = true;
|
||||
} else {
|
||||
guiKeyBoardMode_Ctrl = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<3) ) {
|
||||
//EWOL_DEBUG(" Special Key : Alt");
|
||||
guiKeyBoardMode_Alt = true;
|
||||
} else {
|
||||
guiKeyBoardMode_Alt = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<4) ) {
|
||||
//EWOL_DEBUG(" Special Key : VER_num");
|
||||
guiKeyBoardMode_VerNum = true;
|
||||
} else {
|
||||
guiKeyBoardMode_VerNum = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<5) ) {
|
||||
EWOL_DEBUG(" Special Key : MOD");
|
||||
}
|
||||
if (event.xkey.state & (1<<6) ) {
|
||||
//EWOL_DEBUG(" Special Key : META");
|
||||
guiKeyBoardMode_Meta = true;
|
||||
} else {
|
||||
guiKeyBoardMode_Meta = false;
|
||||
}
|
||||
if (event.xkey.state & (1<<7) ) {
|
||||
//EWOL_DEBUG(" Special Key : ALT_GR");
|
||||
guiKeyBoardMode_AltGr = true;
|
||||
} else {
|
||||
guiKeyBoardMode_AltGr = false;
|
||||
}
|
||||
bool find = true;
|
||||
ewol::eventKbMoveType_te keyInput;
|
||||
switch (event.xkey.keycode) {
|
||||
//case 80: // keypad
|
||||
case 111: keyInput = ewol::EVENT_KB_MOVE_TYPE_UP; break;
|
||||
//case 83: // keypad
|
||||
case 113: keyInput = ewol::EVENT_KB_MOVE_TYPE_LEFT; break;
|
||||
//case 85: // keypad
|
||||
case 114: keyInput = ewol::EVENT_KB_MOVE_TYPE_RIGHT; break;
|
||||
//case 88: // keypad
|
||||
case 116: keyInput = ewol::EVENT_KB_MOVE_TYPE_DOWN; break;
|
||||
//case 81: // keypad
|
||||
case 112: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_UP; break;
|
||||
//case 89: // keypad
|
||||
case 117: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_DOWN; break;
|
||||
//case 79: // keypad
|
||||
case 110: keyInput = ewol::EVENT_KB_MOVE_TYPE_START; break;
|
||||
//case 87: // keypad
|
||||
case 115: keyInput = ewol::EVENT_KB_MOVE_TYPE_END; break;
|
||||
case 78: keyInput = ewol::EVENT_KB_MOVE_TYPE_ARRET_DEFIL; break;
|
||||
case 127: keyInput = ewol::EVENT_KB_MOVE_TYPE_WAIT; break;
|
||||
//case 90: // keypad
|
||||
case 118:
|
||||
keyInput = ewol::EVENT_KB_MOVE_TYPE_INSERT;
|
||||
if(event.type == KeyRelease) {
|
||||
if (true == guiKeyBoardMode_Insert) {
|
||||
guiKeyBoardMode_Insert = false;
|
||||
} else {
|
||||
guiKeyBoardMode_Insert = true;
|
||||
}
|
||||
break;
|
||||
//case 84: keyInput = ewol::EVENT_KB_MOVE_TYPE_CENTER; break; // Keypad
|
||||
case 67: keyInput = ewol::EVENT_KB_MOVE_TYPE_F1; break;
|
||||
case 68: keyInput = ewol::EVENT_KB_MOVE_TYPE_F2; break;
|
||||
case 69: keyInput = ewol::EVENT_KB_MOVE_TYPE_F3; break;
|
||||
case 70: keyInput = ewol::EVENT_KB_MOVE_TYPE_F4; break;
|
||||
case 71: keyInput = ewol::EVENT_KB_MOVE_TYPE_F5; break;
|
||||
case 72: keyInput = ewol::EVENT_KB_MOVE_TYPE_F6; break;
|
||||
case 73: keyInput = ewol::EVENT_KB_MOVE_TYPE_F7; break;
|
||||
case 74: keyInput = ewol::EVENT_KB_MOVE_TYPE_F8; break;
|
||||
case 75: keyInput = ewol::EVENT_KB_MOVE_TYPE_F9; break;
|
||||
case 76: keyInput = ewol::EVENT_KB_MOVE_TYPE_F10; break;
|
||||
case 95: keyInput = ewol::EVENT_KB_MOVE_TYPE_F11; break;
|
||||
case 96: keyInput = ewol::EVENT_KB_MOVE_TYPE_F12; break;
|
||||
case 66: keyInput = ewol::EVENT_KB_MOVE_TYPE_CAPLOCK; break;
|
||||
case 50: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_LEFT; break;
|
||||
case 62: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_RIGHT; break;
|
||||
case 37: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_LEFT; break;
|
||||
case 105: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_RIGHT; break;
|
||||
case 133: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_LEFT; break;
|
||||
case 134: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_RIGHT; break;
|
||||
case 64: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT; break;
|
||||
case 108: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT_GR; break;
|
||||
case 135: keyInput = ewol::EVENT_KB_MOVE_TYPE_CONTEXT_MENU; break;
|
||||
case 77: keyInput = ewol::EVENT_KB_MOVE_TYPE_VER_NUM; break;
|
||||
case 91: // Suppr on keypad
|
||||
find = false;
|
||||
{
|
||||
char buf[2];
|
||||
buf[0] = 0x7F;
|
||||
buf[1] = 0x00;
|
||||
}
|
||||
break;
|
||||
//case 84: keyInput = ewol::EVENT_KB_MOVE_TYPE_CENTER; break; // Keypad
|
||||
case 67: keyInput = ewol::EVENT_KB_MOVE_TYPE_F1; break;
|
||||
case 68: keyInput = ewol::EVENT_KB_MOVE_TYPE_F2; break;
|
||||
case 69: keyInput = ewol::EVENT_KB_MOVE_TYPE_F3; break;
|
||||
case 70: keyInput = ewol::EVENT_KB_MOVE_TYPE_F4; break;
|
||||
case 71: keyInput = ewol::EVENT_KB_MOVE_TYPE_F5; break;
|
||||
case 72: keyInput = ewol::EVENT_KB_MOVE_TYPE_F6; break;
|
||||
case 73: keyInput = ewol::EVENT_KB_MOVE_TYPE_F7; break;
|
||||
case 74: keyInput = ewol::EVENT_KB_MOVE_TYPE_F8; break;
|
||||
case 75: keyInput = ewol::EVENT_KB_MOVE_TYPE_F9; break;
|
||||
case 76: keyInput = ewol::EVENT_KB_MOVE_TYPE_F10; break;
|
||||
case 95: keyInput = ewol::EVENT_KB_MOVE_TYPE_F11; break;
|
||||
case 96: keyInput = ewol::EVENT_KB_MOVE_TYPE_F12; break;
|
||||
case 66: keyInput = ewol::EVENT_KB_MOVE_TYPE_CAPLOCK; break;
|
||||
case 50: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_LEFT; break;
|
||||
case 62: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_RIGHT; break;
|
||||
case 37: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_LEFT; break;
|
||||
case 105: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_RIGHT; break;
|
||||
case 133: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_LEFT; break;
|
||||
case 134: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_RIGHT; break;
|
||||
case 64: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT; break;
|
||||
case 108: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT_GR; break;
|
||||
case 135: keyInput = ewol::EVENT_KB_MOVE_TYPE_CONTEXT_MENU; break;
|
||||
case 77: keyInput = ewol::EVENT_KB_MOVE_TYPE_VER_NUM; break;
|
||||
case 91: // Suppr on keypad
|
||||
find = false;
|
||||
{
|
||||
char buf[2];
|
||||
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;
|
||||
if(event.type == KeyPress) {
|
||||
EWOL_ThreadKeyboardEvent(true, tmpData);
|
||||
} else {
|
||||
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;
|
||||
case UnmapNotify:
|
||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"UnmapNotify\"");
|
||||
gui_uniqueWindows->SysOnHide();
|
||||
break;
|
||||
default:
|
||||
EWOL_DEBUG("X11 event : " << event.type << " = \"???\"");
|
||||
}
|
||||
}
|
||||
//case DestroyNotify:
|
||||
// break;
|
||||
case MapNotify:
|
||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"MapNotify\"");
|
||||
EWOL_ThreadEventShow();
|
||||
break;
|
||||
case UnmapNotify:
|
||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"UnmapNotify\"");
|
||||
EWOL_ThreadEventHide();
|
||||
break;
|
||||
default:
|
||||
EWOL_DEBUG("X11 event : " << event.type << " = \"???\"");
|
||||
}
|
||||
}
|
||||
EWOL_NativeRender();
|
||||
//usleep( 100000 );
|
||||
}
|
||||
};
|
||||
|
||||
@ -703,15 +681,34 @@ bool guiAbstraction::IsPressedInput(int32_t inputID)
|
||||
|
||||
#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[])
|
||||
{
|
||||
//EWOL_appArgC = argc;
|
||||
//EWOL_appArgV = argv;
|
||||
for( int32_t i=1 ; i<argc; i++) {
|
||||
EWOL_INFO("CmdLine : \"" << argv[i] << "\"" );
|
||||
etk::String* tmpString = new etk::String(argv[i]);
|
||||
if (NULL != tmpString) {
|
||||
listArgs.PushBack(tmpString);
|
||||
}
|
||||
}
|
||||
// start X11 thread ...
|
||||
X11_Init();
|
||||
//start the basic thread :
|
||||
@ -722,7 +719,13 @@ int main(int argc, char *argv[])
|
||||
guiAbstraction::Stop();
|
||||
// uninit ALL :
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,8 @@ namespace ewol {
|
||||
void KeyboardShow(ewol::keyboardMode_te mode);
|
||||
void KeyboardHide(void);
|
||||
void ForceRedrawAll(void);
|
||||
int32_t CmdLineNb(void);
|
||||
etk::String CmdLineGet(int32_t id);
|
||||
|
||||
bool IsSetCapsLock(void);
|
||||
bool IsSetShift(void);
|
||||
|
@ -165,3 +165,5 @@ int32_t ewol::threadMsg::WaitingMessage(threadMsg_ts& messageData)
|
||||
pthread_mutex_unlock(&messageData.mutex);
|
||||
return nbMessage;
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,6 +55,7 @@ namespace ewol {
|
||||
pthread_cond_t condition;
|
||||
threadMsgContent_ts listOfMessages[MSG_PRIO_NUMBER][NUMBER_OF_ELEMENT_IN_THE_FIFO];
|
||||
int32_t nbMessages[MSG_PRIO_NUMBER];
|
||||
bool displayHasDone;
|
||||
} threadMsg_ts;
|
||||
|
||||
void Init(threadMsg_ts& messageData);
|
||||
|
Loading…
x
Reference in New Issue
Block a user