diff --git a/build b/build index b1cbee3b..e46e6add 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit b1cbee3b4b65bacad8abbbbdc99cdf9e472b76e4 +Subproject commit e46e6add5ecf90b8bbe0436628936d774b8b3f85 diff --git a/external/etk b/external/etk index 3db45106..311346dc 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 3db451068b0a00411a9a89301986fcd99cab5115 +Subproject commit 311346dce226ae70133dd3d68b27c0c1eb22f525 diff --git a/sources/ewol/context/Windows/Context.cpp b/sources/ewol/context/Windows/Context.cpp index 54b6e97d..6a207824 100644 --- a/sources/ewol/context/Windows/Context.cpp +++ b/sources/ewol/context/Windows/Context.cpp @@ -9,15 +9,15 @@ #include #include +#include +#include #include #include -#include -#include #include -#include -#include +#include +#include #include #include @@ -39,16 +39,16 @@ int64_t ewol::getTime() { #define __class__ "ContextWindows" -class WindowsContext : public ewol::eContext { +class WindowsContext : public ewol::Context { private: int32_t m_currentHeight = 0; bool m_inputIsPressed[MAX_MANAGE_INPUT]; - ewol::SpecialKey m_guiKeyBoardMode; + ewol::key::Special m_guiKeyBoardMode; bool m_run = true; bool m_clipBoardOwnerStd = false; public: - WindowsContext(ewol::context::Application* _application, int32_t _argc, char* _argv[]) : - ewol::eContext(_application, _argc, _argv) { + WindowsContext(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) : + ewol::Context(_application, _argc, _argv) { for (int32_t iii=0; iiiWndProcReal(_hWnd, _message, _wParam, _lParam); + // TODO : return classPointer->WndProcReal(_hWnd, _message, _wParam, _lParam); + return 0; } LRESULT CALLBACK WndProcReal(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) { @@ -221,8 +220,7 @@ class WindowsContext : public ewol::eContext { int32_t mouseButtonId = 0; ivec2 pos; // to know all _message : http://wiki.winehq.org/List_Of_Windows__messages - switch (_message) - { + switch (_message) { /* ************************************************************************** * Gui event * **************************************************************************/ @@ -259,10 +257,10 @@ class WindowsContext : public ewol::eContext { if (nullptr != tmpVal) { //EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")"); // in windows system, we need to remove the size of the border elements : - int border_thickness = getSystemMetrics(SM_CXSIZEFRAME); - int title_size = getSystemMetrics(SM_CYCAPTION); + int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); + int title_size = GetSystemMetrics(SM_CYCAPTION); m_currentHeight = tmpVal->cy - 2*border_thickness - title_size; - OS_Resize(tmpVal->cx-2*border_thickness, m_currentHeight); + OS_Resize(vec2(tmpVal->cx-2*border_thickness, m_currentHeight)); } return 0; } @@ -301,7 +299,7 @@ class WindowsContext : public ewol::eContext { //case 90: // keypad case VK_INSERT: keyInput = ewol::key::keyboardInsert; - guiKeyBoardMode.insert = buttonIsDown; + m_guiKeyBoardMode.setInsert(buttonIsDown); break; case VK_F1: keyInput = ewol::key::keyboardF1; break; case VK_F2: keyInput = ewol::key::keyboardF2; break; @@ -327,33 +325,59 @@ class WindowsContext : public ewol::eContext { case VK_F22: case VK_F23: case VK_F24: keyInput = ewol::key::keyboardF12; break; - case VK_CAPITAL: keyInput = ewol::key::keyboardCapLock; guiKeyBoardMode.capLock = buttonIsDown; break; - + case VK_CAPITAL: + keyInput = ewol::key::keyboardCapLock; + m_guiKeyBoardMode.setCapsLock(buttonIsDown); + break; case VK_SHIFT: - case VK_LSHIFT: keyInput = ewol::key::keyboardShiftLeft; guiKeyBoardMode.shift = buttonIsDown; break; - case VK_RSHIFT: keyInput = ewol::key::keyboardShiftRight; guiKeyBoardMode.shift = buttonIsDown; break; - + case VK_LSHIFT: + keyInput = ewol::key::keyboardShiftLeft; + m_guiKeyBoardMode.setShift(buttonIsDown); + break; + case VK_RSHIFT: + keyInput = ewol::key::keyboardShiftRight; + m_guiKeyBoardMode.setShift(buttonIsDown); + break; case VK_CONTROL: - case VK_LCONTROL: keyInput = ewol::key::keyboardCtrlLeft; guiKeyBoardMode.ctrl = buttonIsDown; break; - case VK_RCONTROL: keyInput = ewol::key::keyboardCtrlRight; guiKeyBoardMode.ctrl = buttonIsDown; break; - - case VK_LWIN: keyInput = ewol::key::keyboardMetaLeft; guiKeyBoardMode.meta = buttonIsDown; break; - case VK_RWIN: keyInput = ewol::key::keyboardMetaRight; guiKeyBoardMode.meta = buttonIsDown; break; - + case VK_LCONTROL: + keyInput = ewol::key::keyboardCtrlLeft; + m_guiKeyBoardMode.setCtrl(buttonIsDown); + break; + case VK_RCONTROL: + keyInput = ewol::key::keyboardCtrlRight; + m_guiKeyBoardMode.setCtrl(buttonIsDown); + break; + case VK_LWIN: + keyInput = ewol::key::keyboardMetaLeft; + m_guiKeyBoardMode.setMeta(buttonIsDown); + break; + case VK_RWIN: + keyInput = ewol::key::keyboardMetaRight; + m_guiKeyBoardMode.setMeta(buttonIsDown); + break; case VK_MENU: - case VK_LMENU: keyInput = ewol::key::keyboardAlt; guiKeyBoardMode.alt = buttonIsDown; break; - case VK_RMENU: keyInput = ewol::key::keyboardAltGr; guiKeyBoardMode.altGr = buttonIsDown; break; + case VK_LMENU: + keyInput = ewol::key::keyboardAlt; + m_guiKeyBoardMode.setAlt(buttonIsDown); + break; + case VK_RMENU: + keyInput = ewol::key::keyboardAltGr; + m_guiKeyBoardMode.setAltGr(buttonIsDown); + break; //case : keyInput = ewol::key::keyboardContextMenu; break; - case VK_NUMLOCK: keyInput = ewol::key::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break; + case VK_NUMLOCK: + keyInput = ewol::key::keyboardNumLock; + m_guiKeyBoardMode.setNumLock(buttonIsDown); + break; case VK_BACK: // DEL - tmpChar.set(0x08); + tmpChar = 0x08; break; // TODO : Really strang, need to understand why ... case 46: // Suppr - tmpChar.set(0x7F); + tmpChar = 0x7F; break; case VK_TAB: // special case for TAB - tmpChar.set(0x09); + tmpChar = 0x09; break; case VK_RETURN: // special case for TAB tmpChar = '\n'; @@ -361,21 +385,21 @@ class WindowsContext : public ewol::eContext { default: { BYTE kbd[256]; - getKeyboardState(kbd); + GetKeyboardState(kbd); const int BUFFER_LENGTH = 8; //Length of the buffer WCHAR chars[BUFFER_LENGTH]; - ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0); - tmpChar.setUtf8((char*)chars); + ToUnicode(_wParam, _lParam, kbd, chars,BUFFER_LENGTH,0); + tmpChar = utf8::convertChar32((char*)chars); } break; } EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam); if (tmpChar == 0) { //EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) ); - OS_SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown); + OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, buttonIsDown); } else { - OS_SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown); + OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, buttonIsDown); } return 0; } @@ -388,8 +412,8 @@ class WindowsContext : public ewol::eContext { mouseButtonId = 1; pos.setValue(GET_X_LPARAM(_lParam), m_currentHeight-GET_Y_LPARAM(_lParam)); - inputIsPressed[mouseButtonId] = buttonIsDown; - OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); + m_inputIsPressed[mouseButtonId] = buttonIsDown; + OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y())); return 0; case WM_MBUTTONUP: @@ -398,8 +422,8 @@ class WindowsContext : public ewol::eContext { mouseButtonId = 2; pos.setValue(GET_X_LPARAM(_lParam), m_currentHeight-GET_Y_LPARAM(_lParam)); - inputIsPressed[mouseButtonId] = buttonIsDown; - OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); + m_inputIsPressed[mouseButtonId] = buttonIsDown; + OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y())); return 0; case WM_RBUTTONUP: @@ -408,71 +432,71 @@ class WindowsContext : public ewol::eContext { mouseButtonId = 3; pos.setValue(GET_X_LPARAM(_lParam), m_currentHeight-GET_Y_LPARAM(_lParam)); - inputIsPressed[mouseButtonId] = buttonIsDown; - OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); + m_inputIsPressed[mouseButtonId] = buttonIsDown; + OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y())); return 0; case WM_MOUSEWHEEL: - if (wParam & 0x200000) { + if (_wParam & 0x200000) { EWOL_DEBUG("event SCROOL UP"); mouseButtonId = 4; - } else{ + } else { EWOL_DEBUG("event SCROOL DOWN"); mouseButtonId = 5; } pos.setValue(GET_X_LPARAM(_lParam), m_currentHeight-GET_Y_LPARAM(_lParam)); - OS_SetMouseState(mouseButtonId, true, (float)pos.x(), (float)pos.y()); - OS_SetMouseState(mouseButtonId, false, (float)pos.x(), (float)pos.y()); + OS_SetMouseState(mouseButtonId, true, vec2(pos.x(),pos.y())); + OS_SetMouseState(mouseButtonId, false, vec2(pos.x(),pos.y())); return 0; case WM_MOUSEHOVER: case WM_MOUSEMOVE: pos.setValue(GET_X_LPARAM(_lParam), m_currentHeight-GET_Y_LPARAM(_lParam)); - for (int32_t iii=0; iiiRun(); - delete(interface); - interface = nullptr; + int32_t retValue = localInterface->run(); + delete(localInterface); + localInterface = nullptr; return retValue; } diff --git a/sources/ewol/context/X11/Context.cpp b/sources/ewol/context/X11/Context.cpp index 5250b813..d6ad1c47 100644 --- a/sources/ewol/context/X11/Context.cpp +++ b/sources/ewol/context/X11/Context.cpp @@ -1346,7 +1346,7 @@ class X11Interface : public ewol::Context { int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) { etk::setArgZero(_argv[0]); X11Interface* interface = new X11Interface(_application, _argc, _argv); - if (nullptr == interface) { + if (interface == nullptr) { EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); return -2; }