From 6de53cf3f24dfb6400816f1b3b838d6be5d9174e Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 4 Dec 2012 23:27:08 +0100 Subject: [PATCH] [DEBUG] corection of some error in the X11 abstraction and key event french name --- build | 2 +- external/etk | 2 +- sources/ewol/key.cpp | 65 +++++++++- sources/ewol/key.h | 178 ++++++++++++++------------- sources/ewol/renderer/os/eSystem.cpp | 6 +- sources/ewol/renderer/os/gui.X11.cpp | 20 ++- sources/ewol/widget/Button.h | 30 ++--- sources/ewol/widget/Widget.cpp | 8 +- sources/ewol/widget/Widget.h | 12 +- 9 files changed, 189 insertions(+), 134 deletions(-) diff --git a/build b/build index a4e1c141..0e65c531 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit a4e1c141f04e96da02edfa64644a85ab332eadad +Subproject commit 0e65c531e58f33dbacc59ebeb4d41dd279cafc90 diff --git a/external/etk b/external/etk index a44667d4..1d4c27e7 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit a44667d4566066767a7961dde989a661c932943e +Subproject commit 1d4c27e7fd68cb9cbf11a89068c4b1d10744555c diff --git a/sources/ewol/key.cpp b/sources/ewol/key.cpp index 6a6475d8..5c741729 100644 --- a/sources/ewol/key.cpp +++ b/sources/ewol/key.cpp @@ -46,7 +46,7 @@ static const char* keyboardDescriptionString[ewol::keyEvent::keyboardCount+1] = "keyboardPageDown", "keyboardStart", "keyboardEnd", - "keyboardCenter", + "keyboardPrint", "keyboardStopDefil", "keyboardWait", "keyboardInsert", @@ -72,7 +72,7 @@ static const char* keyboardDescriptionString[ewol::keyEvent::keyboardCount+1] = "keyboardAlt", "keyboardAltGr", "keyboardContextMenu", - "keyboardVerNum", + "keyboardNumLock", "keyboardCount" }; @@ -111,3 +111,64 @@ ewol::SpecialKey& ewol::GetCurrentSpecialKeyStatus(void) { return l_LocalKeyStatus; } + + +ewol::SpecialKey::SpecialKey(void) : + value(0) +{ + +} + +bool ewol::SpecialKey::IsSetCapsLock(void) +{ + return capLock; +} + +bool ewol::SpecialKey::IsSetShift(void) +{ + return shift; +} + +bool ewol::SpecialKey::IsSetCtrl(void) +{ + return ctrl; +} + +bool ewol::SpecialKey::IsSetMeta(void) +{ + return meta; +} + +bool ewol::SpecialKey::IsSetAlt(void) +{ + return alt; +} + +bool ewol::SpecialKey::IsSetAltGr(void) +{ + return altGr; +} + +bool ewol::SpecialKey::IsSetNumLock(void) +{ + return numLock; +} +bool ewol::SpecialKey::IsSetInsert(void) +{ + return insert; +} + + + +etk::CCout& ewol::operator <<(etk::CCout &os, const ewol::SpecialKey obj) +{ + os << " capLock=" << obj.capLock; + os << " shift=" << obj.shift; + os << " ctrl=" << obj.ctrl; + os << " meta=" << obj.meta; + os << " alt=" << obj.alt; + os << " altGr=" << obj.altGr; + os << " verNum=" << obj.numLock; + os << " insert=" << obj.insert; + return os; +} diff --git a/sources/ewol/key.h b/sources/ewol/key.h index 39b94615..ae396b04 100644 --- a/sources/ewol/key.h +++ b/sources/ewol/key.h @@ -20,11 +20,11 @@ namespace ewol * @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different */ typedef enum { - typeUnknow = 0, - typeMouse, - typeFinger, - typeStylet, - typeCount + typeUnknow = 0, //!< Unknow input Type + typeMouse, //!< Mouse type + typeFinger, //!< Finger type + typeStylet, //!< Stylet type + typeCount //!< number of types } type_te; /** * @brief Debug operator To display the curent element in a Human redeable information @@ -57,43 +57,43 @@ namespace ewol * @brief Keybord event or joyestick event */ typedef enum { - keyboardUnknow = 0, - keyboardLeft, - keyboardRight, - keyboardUp, - keyboardDown, - keyboardPageUp, - keyboardPageDown, - keyboardStart, - keyboardEnd, - keyboardCenter, - keyboardStopDefil, - keyboardWait, - keyboardInsert, - keyboardF1, - keyboardF2, - keyboardF3, - keyboardF4, - keyboardF5, - keyboardF6, - keyboardF7, - keyboardF8, - keyboardF9, - keyboardF10, - keyboardF11, - keyboardF12, - keyboardCapLock, - keyboardShiftLeft, - keyboardShiftRight, - keyboardCtrlLeft, - keyboardCtrlRight, - keyboardMetaLeft, - keyboardMetaRight, - keyboardAlt, - keyboardAltGr, - keyboardContextMenu, - keyboardVerNum, - keyboardCount + keyboardUnknow = 0, //!< Unknown keyboard key + keyboardLeft, //!< Left key <-- + keyboardRight, //!< Right key --> + keyboardUp, //!< Up key ^ + keyboardDown, //!< Down key \/ + keyboardPageUp, //!< Page Up key + keyboardPageDown, //!< page down key + keyboardStart, //!< Start key + keyboardEnd, //!< End key + keyboardPrint, //!< Print screen key. + keyboardStopDefil, //!< Stop display key. + keyboardWait, //!< Wait key. + keyboardInsert, //!< Insert key. + keyboardF1, //!< F1 key. + keyboardF2, //!< F2 key. + keyboardF3, //!< F3 key. + keyboardF4, //!< F4 key. + keyboardF5, //!< F5 key. + keyboardF6, //!< F6 key. + keyboardF7, //!< F7 key. + keyboardF8, //!< F8 key. + keyboardF9, //!< F9 key. + keyboardF10, //!< F10 key. + keyboardF11, //!< F11 key. + keyboardF12, //!< F12 key. + keyboardCapLock, //!< Capital Letter Lock key. + keyboardShiftLeft, //!< Shift left key. + keyboardShiftRight, //!< Shift right key. + keyboardCtrlLeft, //!< Control left key. + keyboardCtrlRight, //!< Control right key. + keyboardMetaLeft, //!< Meta left key (apple key or windows key). + keyboardMetaRight, //!< Meta right key (apple key or windows key). + keyboardAlt, //!< Alt key. + keyboardAltGr, //!< Alt ground key. + keyboardContextMenu, //!< Contextual menu key. + keyboardNumLock, //!< Numerical Lock key. + keyboardCount //!< number of posible key } keyboard_te; /** * @brief Debug operator To display the curent element in a Human redeable information @@ -113,54 +113,60 @@ namespace ewol unsigned meta : 1; unsigned alt : 1; unsigned altGr : 1; - unsigned verNum : 1; + unsigned numLock : 1; unsigned insert : 1; }; }; - SpecialKey(void) : - value(0) - { - - } - bool IsSetCapsLock(void) - { - return capLock; - } - - bool IsSetShift(void) - { - return shift; - } - - bool IsSetCtrl(void) - { - return ctrl; - } - - bool IsSetMeta(void) - { - return meta; - } - - bool IsSetAlt(void) - { - return alt; - } - - bool IsSetAltGr(void) - { - return altGr; - } - - bool IsSetVerNum(void) - { - return verNum; - } - bool IsSetInsert(void) - { - return insert; - } + public: + /** + * @brief Main constructor + */ + SpecialKey(void); + /** + * @brief Get the current CapLock Status + * @return The status value + */ + bool IsSetCapsLock(void); + /** + * @brief Get the current Shift key status + * @return The status value + */ + bool IsSetShift(void); + /** + * @brief Get the Current Control key status + * @return The status value + */ + bool IsSetCtrl(void); + /** + * @brief Get the current Meta key status (also named windows or apple key) + * @return The status value + */ + bool IsSetMeta(void); + /** + * @brief Get the current Alt key status + * @return The status value + */ + bool IsSetAlt(void); + /** + * @brief Get the current Alt-Gr key status + * @return The status value + */ + bool IsSetAltGr(void); + /** + * @brief Get the current Ver-num key status + * @return The status value + */ + bool IsSetNumLock(void); + /** + * @brief Get the current Intert key status + * @return The status value + */ + bool IsSetInsert(void); }; + /** + * @brief Debug operator To display the curent element in a Human redeable information + */ + etk::CCout& operator <<(etk::CCout &os, const ewol::SpecialKey obj); SpecialKey& GetCurrentSpecialKeyStatus(void); }; diff --git a/sources/ewol/renderer/os/eSystem.cpp b/sources/ewol/renderer/os/eSystem.cpp index 9f5df0f4..8a611c5b 100644 --- a/sources/ewol/renderer/os/eSystem.cpp +++ b/sources/ewol/renderer/os/eSystem.cpp @@ -129,13 +129,13 @@ void ewolProcessEvents(void) l_managementInput.State(data.inputType, data.inputId, data.stateIsDown, data.dimention); break; case THREAD_KEYBORAD_KEY: - //EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); + case THREAD_KEYBORAD_MOVE: + EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); { ewol::SpecialKey& specialCurrentKey = ewol::GetCurrentSpecialKeyStatus(); specialCurrentKey = data.keyboardSpecial; + EWOL_DEBUG("newStatus Key" << specialCurrentKey); } - // no break ... (normal case ...) - case THREAD_KEYBORAD_MOVE: if (NULL != windowsCurrent) { if (false==windowsCurrent->OnEventShortCut(data.keyboardSpecial, data.keyboardChar, diff --git a/sources/ewol/renderer/os/gui.X11.cpp b/sources/ewol/renderer/os/gui.X11.cpp index 960e904e..6e376b51 100644 --- a/sources/ewol/renderer/os/gui.X11.cpp +++ b/sources/ewol/renderer/os/gui.X11.cpp @@ -790,9 +790,9 @@ void X11_Run(void) } if (event.xkey.state & (1<<4) ) { //EWOL_DEBUG(" Special Key : VER_num"); - guiKeyBoardMode.verNum = true; + guiKeyBoardMode.numLock = true; } else { - guiKeyBoardMode.verNum = false; + guiKeyBoardMode.numLock = false; } if (event.xkey.state & (1<<5) ) { EWOL_DEBUG(" Special Key : MOD"); @@ -864,10 +864,14 @@ void X11_Run(void) case 64: keyInput = ewol::keyEvent::keyboardAlt; guiKeyBoardMode.alt = (event.type == KeyPress) ? true : false; break; case 108: keyInput = ewol::keyEvent::keyboardAltGr; guiKeyBoardMode.altGr = (event.type == KeyPress) ? true : false; break; case 135: keyInput = ewol::keyEvent::keyboardContextMenu; break; - case 77: keyInput = ewol::keyEvent::keyboardVerNum; guiKeyBoardMode.verNum = (event.type == KeyPress) ? true : false; break; + case 77: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = (event.type == KeyPress) ? true : false; break; case 91: // Suppr on keypad find = false; - eSystem::SetKeyboard(guiKeyBoardMode, 0x7F, (event.type==KeyPress)); + if(guiKeyBoardMode.numLock==true){ + eSystem::SetKeyboard(guiKeyBoardMode, '.', (event.type==KeyPress)); + } else { + eSystem::SetKeyboard(guiKeyBoardMode, 0x7F, (event.type==KeyPress)); + } break; case 23: // special case for TAB find = false; @@ -1084,14 +1088,6 @@ int guiInterface::main(int argc, const char *argv[]) for (int32_t iii=0; iiikeyboardMoveValue = ewol::keyEvent::keyboardStart; } else if(NULL != strstr(descriptiveString, "END") ) { tmpElement->keyboardMoveValue = ewol::keyEvent::keyboardEnd; - } else if(NULL != strstr(descriptiveString, "CENTER") ) { - tmpElement->keyboardMoveValue = ewol::keyEvent::keyboardCenter; + } else if(NULL != strstr(descriptiveString, "PRINT") ) { + tmpElement->keyboardMoveValue = ewol::keyEvent::keyboardPrint; } else if(NULL != strstr(descriptiveString, "ARRET_DEFIL") ) { tmpElement->keyboardMoveValue = ewol::keyEvent::keyboardStopDefil; } else if(NULL != strstr(descriptiveString, "WAIT") ) { @@ -388,8 +388,8 @@ void ewol::Widget::ShortCutAdd(const char * descriptiveString, const char * gene tmpElement->keyboardMoveValue = ewol::keyEvent::keyboardCapLock; } else if(NULL != strstr(descriptiveString, "CONTEXT_MENU") ) { tmpElement->keyboardMoveValue = ewol::keyEvent::keyboardContextMenu; - } else if(NULL != strstr(descriptiveString, "VER_NUM") ) { - tmpElement->keyboardMoveValue = ewol::keyEvent::keyboardVerNum; + } else if(NULL != strstr(descriptiveString, "NUM_LOCK") ) { + tmpElement->keyboardMoveValue = ewol::keyEvent::keyboardNumLock; } else { tmpElement->unicodeValue = descriptiveString[strlen(descriptiveString) -1]; } diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index eb572f68..7735b46c 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -42,14 +42,6 @@ namespace ewol { broadcastEvent = false; generateEventId = NULL; eventData = ""; - specialKey.capLock = false; - specialKey.shift = false; - specialKey.ctrl = false; - specialKey.meta = false; - specialKey.alt = false; - specialKey.altGr = false; - specialKey.verNum = false; - specialKey.insert = false; unicodeValue = 0; keyboardMoveValue = ewol::keyEvent::keyboardUnknow; }; @@ -89,8 +81,8 @@ namespace ewol { vec2 m_minSize; //!< user define the minimum size of the widget // user configuaration vec2 m_userMinSize; //!< user define the minimum size of the widget - bvec2 m_userExpend; - bvec2 m_userFill; + bvec2 m_userExpend; + bvec2 m_userFill; public: /** * @brief Set the zoom property of the widget