Windows abstarction run now nearly corectly

This commit is contained in:
Edouard DUPIN 2012-08-16 18:21:04 +02:00
parent 69993f8c59
commit af8c2a8313
11 changed files with 265 additions and 84 deletions

2
Build

@ -1 +1 @@
Subproject commit d51a211876127e44d0618683d0aeff154f87d64f
Subproject commit d54c52656490040b3d79c2d9bd9cd17ecedb855b

View File

@ -414,7 +414,7 @@ extern "C"
void Java_org_ewol_interfaceJNI_RenderDraw( JNIEnv* env )
{
guiSystem::Draw();
guiSystem::Draw(true);
}
void Java_org_ewol_interfaceJNI_IOAudioPlayback(JNIEnv* env, void* reserved, jshortArray location, jint frameRate, jint nbChannels)

View File

@ -105,14 +105,20 @@ namespace etk{
};
CCout& operator << (CHex t) {
hex = true;
return *this;
}
CCout& operator << (int t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%d", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (unsigned int t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%u", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
/*
@ -123,38 +129,55 @@ namespace etk{
}
*/
CCout& operator << (long t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%ld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
if (true == hex) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "0x%08X", (unsigned int)t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
} else {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%ld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
}
return *this;
}
CCout& operator << (long long t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%lld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
if (true == hex) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "0x%08X%08X", (unsigned int)(t>>32), (unsigned int)(t));
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
} else {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%lld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
}
return *this;
}
CCout& operator << (double t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%f", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (float t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%f", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (char * t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (const char * t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (char t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%c", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (bool t) {
@ -169,26 +192,31 @@ namespace etk{
CCout& operator << (Vector2D<float> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f)", t.x, t.y);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (Vector2D<int32_t> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%i,%i)", t.x, t.y);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (Vector3D<float> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f,%f)", t.x, t.y, t.z);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (Vector3D<int32_t> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%i,%i,%i)", t.x, t.y, t.z);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (clipping_ts t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (CStart ccc) {

View File

@ -357,18 +357,19 @@ void guiSystem::event::Show(void)
}
}
void guiSystem::Draw(void)
bool guiSystem::Draw(bool displayEveryTime)
{
if (true == isGlobalSystemInit) {
ewolProcessEvents();
int64_t localTime = GetCurrentTime();
int64_t localTime = ewol::GetTime();
ewol::widgetManager::PeriodicCall(localTime);
EWOL_NativeRegenerateDisplay();
ewol::texture::UpdateContext();
EWOL_NativeRender();
EWOL_GenericDraw(true);
}
return true;
}

View File

@ -75,8 +75,8 @@ namespace guiSystem
void Hide(void);
void Show(void);
};
void Draw(void);
// return true if a flush is needed
bool Draw(bool displayEveryTime);
};
#endif

View File

@ -182,7 +182,8 @@ static int32_t localGetDestinationId(ewol::inputType_te type, ewol::Widget* dest
return realInputId;
}
#define EVENT_DEBUG EWOL_VERBOSE
//#define EVENT_DEBUG EWOL_DEBUG
// defined by the platform specific file :
extern int32_t separateClickTime;
@ -221,7 +222,7 @@ void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, Vector2D<f
|| (eventTable[pointerID].origin.x + eventTable[pointerID].size.x) < pos.x
|| (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) < pos.y) ) ) {
eventTable[pointerID].isInside = false;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos);
}
if (false == eventTable[pointerID].isInside) {
@ -241,10 +242,10 @@ void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, Vector2D<f
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->GetSize();
}
eventTable[pointerID].destinationInputId = 0;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos);
}
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos);
} else if (true == eventTable[pointerID].isUsed) {
if (true == eventTable[pointerID].isInside) {
@ -253,7 +254,7 @@ void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, Vector2D<f
|| (eventTable[pointerID].origin.x + eventTable[pointerID].size.x) < pos.x
|| (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) < pos.y) {
eventTable[pointerID].isInside = false;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos);
}
} else {
@ -262,11 +263,11 @@ void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, Vector2D<f
&& ( eventTable[pointerID].origin.y <= pos.y
&& (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) >= pos.y ) ) {
eventTable[pointerID].isInside = true;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos);
}
}
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos);
}
}
@ -290,7 +291,7 @@ void ewol::eventInput::State(ewol::inputType_te type, int pointerID, bool isDown
return;
}
// get the curent time ...
int64_t currentTime = GetCurrentTime();
int64_t currentTime = ewol::GetTime();
if (true == isDown) {
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
@ -307,7 +308,7 @@ void ewol::eventInput::State(ewol::inputType_te type, int pointerID, bool isDown
// save start time
eventTable[pointerID].lastTimeEvent = currentTime;
// generate DOWN Event
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos);
} else {
// Mark it used :
@ -332,7 +333,7 @@ void ewol::eventInput::State(ewol::inputType_te type, int pointerID, bool isDown
eventTable[pointerID].destinationInputId = -1;
}
// generate DOWN Event
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos);
}
} else {
@ -346,7 +347,7 @@ void ewol::eventInput::State(ewol::inputType_te type, int pointerID, bool isDown
eventTable[pointerID].curentWidgetEvent = NULL;
} else {
// generate UP Event
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_UP, pos);
// generate event (single)
if( abs(eventTable[pointerID].downStart.x - pos.x) < offsetMoveClicked
@ -365,7 +366,7 @@ void ewol::eventInput::State(ewol::inputType_te type, int pointerID, bool isDown
if(eventTable[pointerID].nbClickEvent < nbClickMax) {
// generate event SINGLE :
eventTable[pointerID].nbClickEvent++;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [SINGLE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [" << eventTable[pointerID].nbClickEvent << "] " << pos);
localEventInput(type,
eventTable[pointerID].curentWidgetEvent,
eventTable[pointerID].destinationInputId,

View File

@ -246,14 +246,14 @@ void EWOL_GenericDraw(bool everyTime)
bool display = false;
nbCallTime++;
if (startTime<0) {
startTime = GetCurrentTime();
startTime = ewol::GetTime();
}
int64_t currentTime = GetCurrentTime();
int64_t currentTime = ewol::GetTime();
//EWOL_DEBUG("current : " << currentTime << "time diff : " << (currentTime - startTime));
if ( (currentTime - startTime) > DISPLAY_PERIODE_US) {
display = true;
}
int64_t currentTime3 = GetCurrentTime();
int64_t currentTime3 = ewol::GetTime();
// check if the regenerate is needed ...
if( true == ewol::widgetManager::IsDrawingNeeded()
|| true == everyTime) {
@ -263,7 +263,7 @@ void EWOL_GenericDraw(bool everyTime)
}
// send Message that we just finished a display ...
//EWOL_ThreadEventHasJustDisplay();
int64_t currentTime2 = GetCurrentTime();
int64_t currentTime2 = ewol::GetTime();
int64_t processTimeLocal = (currentTime2 - currentTime);
min = etk_min(min, processTimeLocal);
max = etk_max(max, processTimeLocal);
@ -292,6 +292,7 @@ void EWOL_GenericDraw(bool everyTime)
startTime = -1;
}
}
glFlush();
}
void EWOL_NativeGLDestroy(void)

View File

@ -49,7 +49,7 @@ extern float gui_width;
extern float gui_height;
extern ewol::Windows* gui_uniqueWindows;
int64_t GetCurrentTime(void)
int64_t ewol::GetTime(void)
{
struct timeval now;
gettimeofday(&now, NULL);
@ -79,14 +79,6 @@ static etk::UString l_clipBoardStd(""); // local copy of the clipboard
void EWOL_NativeRender(void)
{
EWOL_GenericDraw(true);
glFlush();
}
void ewol::SetTitle(etk::UString title)
{
// can not set the title in Android ...

View File

@ -37,6 +37,16 @@
#include <ewol/threadMsg.h>
#include <ewol/importgl.h>
#include <sys/time.h>
int64_t ewol::GetTime(void)
{
struct timeval now;
gettimeofday(&now, NULL);
//EWOL_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us");
return (int64_t)((int64_t)now.tv_sec*(int64_t)1000000 + (int64_t)now.tv_usec);
}
int32_t separateClickTime = 300000;
int32_t offsetMoveClicked = 10000;
@ -44,6 +54,8 @@ int32_t offsetMoveClickedDouble = 20000;
bool inputIsPressed[20];
static guiSystem::event::specialKey_ts guiKeyBoardMode;
void ewol::SetTitle(etk::UString title)
{
@ -51,16 +63,6 @@ void ewol::SetTitle(etk::UString title)
}
void EWOL_NativeRender(void)
{
EWOL_GenericDraw(true);
glFlush();
}
static etk::Vector<etk::UString*> listArgs;
int32_t ewol::CmdLineNb(void)
@ -88,6 +90,8 @@ bool m_run = true;
void guiAbstraction::Stop(void)
{
m_run = false;
// To exit program ...
PostQuitMessage(0);
}
@ -227,6 +231,14 @@ int main(int argc, char *argv[])
for (int32_t iii=0; iii<NB_MAX_INPUT; iii++) {
inputIsPressed[iii] = false;
}
guiKeyBoardMode.capLock = false;
guiKeyBoardMode.shift = false;
guiKeyBoardMode.ctrl = false;
guiKeyBoardMode.meta = false;
guiKeyBoardMode.alt = false;
guiKeyBoardMode.altGr = false;
guiKeyBoardMode.verNum = false;
guiKeyBoardMode.insert = false;
// start X11 thread ...
// TODO : ...
@ -302,8 +314,7 @@ int plop(void)
DispatchMessage( &msg );
}
} else {
EWOL_DEBUG("DRAW ... ");
guiSystem::Draw();
(void)guiSystem::Draw(true);
SwapBuffers( hDC );
}
}
@ -321,9 +332,10 @@ int plop(void)
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
bool mouseButtonIsDown = true;
bool buttonIsDown = true;
int32_t mouseButtonId = 0;
Vector2D<int32_t> pos;
// to know all message : http://wiki.winehq.org/List_Of_Windows_Messages
switch (message)
{
/* **************************************************************************
@ -344,53 +356,197 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return 0;
case WM_SIZE:
EWOL_DEBUG("WM_SIZE");
return 0;
/*
case WM_GETMINMAXINFO:
{
MINMAXINFO* tmpVal = (MINMAXINFO*)lParam;
EWOL_DEBUG("WM_GETMINMAXINFO : ");
EWOL_DEBUG(" ptMaxSize : " << tmpVal->ptMaxSize.x << "," << tmpVal->ptMaxSize.y << ")");
EWOL_DEBUG(" ptMaxPosition : " << tmpVal->ptMaxPosition.x << "," << tmpVal->ptMaxPosition.y << ")");
EWOL_DEBUG(" ptMinTrackSize : " << tmpVal->ptMinTrackSize.x << "," << tmpVal->ptMinTrackSize.y << ")");
EWOL_DEBUG(" ptMaxTrackSize : " << tmpVal->ptMaxTrackSize.x << "," << tmpVal->ptMaxTrackSize.y << ")");
}
return 0;
*/
case WM_WINDOWPOSCHANGING:
{
WINDOWPOS* tmpVal = (WINDOWPOS*)lParam;
if (NULL != tmpVal) {
//EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")");
guiSystem::event::Resize(tmpVal->cx-8, tmpVal->cy - 28);
}
}
return 0;
// these message are not parse by us ...
case WM_SETCURSOR: // Call the windows if we want the mouse event :
case WM_NCHITTEST: // inform the application the position of the mouse is moving
return DefWindowProc( hWnd, message, wParam, lParam );
/* **************************************************************************
* Keyboard management
* **************************************************************************/
case WM_KEYUP:
buttonIsDown = false;
case WM_KEYDOWN:
EWOL_DEBUG("WM_KEYDOWN");
switch ( wParam ) {
case VK_ESCAPE:
PostQuitMessage(0);
return 0;
{
uniChar_t tmpChar = 0;
ewol::eventKbMoveType_te keyInput;
switch (wParam) {
//case 80: // keypad
case VK_UP: keyInput = ewol::EVENT_KB_MOVE_TYPE_UP; break;
//case 83: // keypad
case VK_LEFT: keyInput = ewol::EVENT_KB_MOVE_TYPE_LEFT; break;
//case 85: // keypad
case VK_RIGHT: keyInput = ewol::EVENT_KB_MOVE_TYPE_RIGHT; break;
//case 88: // keypad
case VK_DOWN: keyInput = ewol::EVENT_KB_MOVE_TYPE_DOWN; break;
//case 81: // keypad
case VK_PRIOR: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_UP; break;
//case 89: // keypad
case VK_NEXT: keyInput = ewol::EVENT_KB_MOVE_TYPE_PAGE_DOWN; break;
//case 79: // keypad
case VK_HOME: keyInput = ewol::EVENT_KB_MOVE_TYPE_START; break;
//case 87: // keypad
case VK_END: keyInput = ewol::EVENT_KB_MOVE_TYPE_END; break;
//case VK_: keyInput = ewol::EVENT_KB_MOVE_TYPE_ARRET_DEFIL; break;
case VK_PAUSE: keyInput = ewol::EVENT_KB_MOVE_TYPE_WAIT; break;
//case 90: // keypad
case VK_INSERT:
keyInput = ewol::EVENT_KB_MOVE_TYPE_INSERT;
guiKeyBoardMode.insert = buttonIsDown;
break;
case VK_F1: keyInput = ewol::EVENT_KB_MOVE_TYPE_F1; break;
case VK_F2: keyInput = ewol::EVENT_KB_MOVE_TYPE_F2; break;
case VK_F3: keyInput = ewol::EVENT_KB_MOVE_TYPE_F3; break;
case VK_F4: keyInput = ewol::EVENT_KB_MOVE_TYPE_F4; break;
case VK_F5: keyInput = ewol::EVENT_KB_MOVE_TYPE_F5; break;
case VK_F6: keyInput = ewol::EVENT_KB_MOVE_TYPE_F6; break;
case VK_F7: keyInput = ewol::EVENT_KB_MOVE_TYPE_F7; break;
case VK_F8: keyInput = ewol::EVENT_KB_MOVE_TYPE_F8; break;
case VK_F9: keyInput = ewol::EVENT_KB_MOVE_TYPE_F9; break;
case VK_F10: keyInput = ewol::EVENT_KB_MOVE_TYPE_F10; break;
case VK_F11: keyInput = ewol::EVENT_KB_MOVE_TYPE_F11; break;
case VK_F12:
case VK_F13:
case VK_F14:
case VK_F15:
case VK_F16:
case VK_F17:
case VK_F18:
case VK_F19:
case VK_F20:
case VK_F21:
case VK_F22:
case VK_F23:
case VK_F24: keyInput = ewol::EVENT_KB_MOVE_TYPE_F12; break;
case VK_CAPITAL: keyInput = ewol::EVENT_KB_MOVE_TYPE_CAPLOCK; guiKeyBoardMode.capLock = buttonIsDown; break;
case VK_SHIFT:
case VK_LSHIFT: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_LEFT; guiKeyBoardMode.shift = buttonIsDown; break;
case VK_RSHIFT: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_RIGHT; guiKeyBoardMode.shift = buttonIsDown; break;
case VK_CONTROL:
case VK_LCONTROL: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_LEFT; guiKeyBoardMode.ctrl = buttonIsDown; break;
case VK_RCONTROL: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_RIGHT; guiKeyBoardMode.ctrl = buttonIsDown; break;
case VK_LWIN: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_LEFT; guiKeyBoardMode.meta = buttonIsDown; break;
case VK_RWIN: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_RIGHT; guiKeyBoardMode.meta = buttonIsDown; break;
case VK_MENU:
case VK_LMENU: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT; guiKeyBoardMode.alt = buttonIsDown; break;
case VK_RMENU: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT_GR; guiKeyBoardMode.altGr = buttonIsDown; break;
//case : keyInput = ewol::EVENT_KB_MOVE_TYPE_CONTEXT_MENU; break;
case VK_NUMLOCK: keyInput = ewol::EVENT_KB_MOVE_TYPE_VER_NUM; guiKeyBoardMode.verNum = buttonIsDown; break;
case VK_BACK: // DEL
tmpChar = 0x00000008;
break;
// TODO : Really strang, need to understand why ...
case 46: // Suppr
tmpChar = 0x0000007F;
break;
case VK_TAB: // special case for TAB
tmpChar = 0x00000009;
break;
case VK_RETURN: // special case for TAB
tmpChar = '\n';
break;
default:
{
BYTE kbd[256];
GetKeyboardState(kbd);
const int BUFFER_LENGTH = 8; //Length of the buffer
WCHAR chars[BUFFER_LENGTH];
ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0);
unicode::convertUtf8ToUnicode((char*)chars, tmpChar);
}
break;
}
EWOL_DEBUG("kjhkjhkjhkjhkj = " << wParam);
if (tmpChar == 0) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
guiSystem::event::keyboardMove_ts specialEvent;
specialEvent.special = guiKeyBoardMode;
specialEvent.move = keyInput;
specialEvent.isDown = buttonIsDown;
guiSystem::event::SetKeyboardMove(specialEvent);
} else {
guiSystem::event::keyboardKey_ts specialEvent;
specialEvent.special = guiKeyBoardMode;
specialEvent.myChar = tmpChar;
specialEvent.isDown = buttonIsDown;
guiSystem::event::SetKeyboard(specialEvent);
}
}
return 0;
/* **************************************************************************
* Mouse management
* **************************************************************************/
case WM_LBUTTONUP:
mouseButtonIsDown = false;
buttonIsDown = false;
case WM_LBUTTONDOWN:
mouseButtonId = 1;
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
inputIsPressed[mouseButtonId] = mouseButtonIsDown;
guiSystem::event::SetMouseState(mouseButtonId, mouseButtonIsDown, (float)pos.x, (float)pos.y);
inputIsPressed[mouseButtonId] = buttonIsDown;
guiSystem::event::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y);
return 0;
case WM_MBUTTONUP:
mouseButtonIsDown = false;
buttonIsDown = false;
case WM_MBUTTONDOWN:
mouseButtonId = 2;
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
inputIsPressed[mouseButtonId] = mouseButtonIsDown;
guiSystem::event::SetMouseState(mouseButtonId, mouseButtonIsDown, (float)pos.x, (float)pos.y);
inputIsPressed[mouseButtonId] = buttonIsDown;
guiSystem::event::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y);
return 0;
case WM_RBUTTONUP:
mouseButtonIsDown = false;
buttonIsDown = false;
case WM_RBUTTONDOWN:
mouseButtonId = 3;
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
inputIsPressed[mouseButtonId] = mouseButtonIsDown;
guiSystem::event::SetMouseState(mouseButtonId, mouseButtonIsDown, (float)pos.x, (float)pos.y);
inputIsPressed[mouseButtonId] = buttonIsDown;
guiSystem::event::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y);
return 0;
// TODO : Set the other bt ...
case WM_MOUSEWHEEL:
if (wParam & 0x200000) {
EWOL_DEBUG("event SCROOL UP");
mouseButtonId = 4;
} else{
EWOL_DEBUG("event SCROOL DOWN");
mouseButtonId = 5;
}
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
guiSystem::event::SetMouseState(mouseButtonId, true, (float)pos.x, (float)pos.y);
guiSystem::event::SetMouseState(mouseButtonId, false, (float)pos.x, (float)pos.y);
return 0;
case WM_MOUSEHOVER:
case WM_MOUSEMOVE:
pos.x = GET_X_LPARAM(lParam);
@ -405,8 +561,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
EWOL_VERBOSE("Windows event: bt=" << 0 << " " << message << " = \"WM_MOUSEMOVE\" " << pos );
guiSystem::event::SetMouseMotion(0, (float)pos.x, (float)pos.y);
return 0;
default:
EWOL_VERBOSE("event ..." << message );
EWOL_DEBUG("event ..." << message );
return DefWindowProc( hWnd, message, wParam, lParam );
}

View File

@ -50,7 +50,7 @@
//#define DEBUG_X11_EVENT
int64_t GetCurrentTime(void)
int64_t ewol::GetTime(void)
{
struct timespec now;
int ret = clock_gettime(CLOCK_REALTIME, &now);
@ -422,15 +422,6 @@ bool CreateOGlContext(void)
return true;
}
void EWOL_NativeRender(void)
{
EWOL_GenericDraw(false);
glFlush();
if (m_doubleBuffered) {
glXSwapBuffers(m_display, WindowHandle);
}
}
void X11_Init(void)
{
#ifdef DEBUG_X11_EVENT
@ -996,7 +987,10 @@ void X11_Run(void)
}
}
if(true == m_run) {
guiSystem::Draw();
(void)guiSystem::Draw(false);
if (m_doubleBuffered) {
glXSwapBuffers(m_display, WindowHandle);
}
}
#ifdef DEBUG_X11_EVENT
EWOL_INFO("X11 endEvent --- ");
@ -1231,6 +1225,14 @@ int main(int argc, char *argv[])
for (int32_t iii=0; iii<NB_MAX_INPUT; iii++) {
inputIsPressed[iii] = false;
}
guiKeyBoardMode.capLock = false;
guiKeyBoardMode.shift = false;
guiKeyBoardMode.ctrl = false;
guiKeyBoardMode.meta = false;
guiKeyBoardMode.alt = false;
guiKeyBoardMode.altGr = false;
guiKeyBoardMode.verNum = false;
guiKeyBoardMode.insert = false;
// start X11 thread ...
X11_Init();

View File

@ -79,11 +79,10 @@ namespace ewol {
void RequestUpdateSize(void);
etk::UString GetVersion(void);
// get current time in ms...
int64_t GetTime(void);
};
// get current time in ms...
#ifndef __TARGET_OS__Windows
int64_t GetCurrentTime(void);
#endif
#else