From 6ca87b6a795504a23bc248bd9694d71cb042056b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 30 Sep 2013 22:26:50 +0200 Subject: [PATCH] [DEV] sent the keyboard status with the event keyboard --- external/etk | 2 +- sources/ewol/key.cpp | 24 ++++++++---------------- sources/ewol/key.h | 18 ++++++++---------- sources/ewol/renderer/EventEntry.h | 9 ++++++++- sources/ewol/renderer/eContext.cpp | 15 ++++++++------- 5 files changed, 33 insertions(+), 35 deletions(-) diff --git a/external/etk b/external/etk index 44640896..dfcb78c0 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 44640896f5f58469ef9bce2703e9bd2b12344e9d +Subproject commit dfcb78c081c6d975cf88dcb2e4cd1b0ada289c67 diff --git a/sources/ewol/key.cpp b/sources/ewol/key.cpp index f888e0d2..6b317494 100644 --- a/sources/ewol/key.cpp +++ b/sources/ewol/key.cpp @@ -106,55 +106,47 @@ etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::t return _os; } -static ewol::SpecialKey l_LocalKeyStatus; - -ewol::SpecialKey& ewol::GetCurrentSpecialKeyStatus(void) -{ - return l_LocalKeyStatus; -} - - ewol::SpecialKey::SpecialKey(void) : value(0) { } -bool ewol::SpecialKey::IsSetCapsLock(void) +bool ewol::SpecialKey::IsSetCapsLock(void) const { return capLock; } -bool ewol::SpecialKey::IsSetShift(void) +bool ewol::SpecialKey::IsSetShift(void) const { return shift; } -bool ewol::SpecialKey::IsSetCtrl(void) +bool ewol::SpecialKey::IsSetCtrl(void) const { return ctrl; } -bool ewol::SpecialKey::IsSetMeta(void) +bool ewol::SpecialKey::IsSetMeta(void) const { return meta; } -bool ewol::SpecialKey::IsSetAlt(void) +bool ewol::SpecialKey::IsSetAlt(void) const { return alt; } -bool ewol::SpecialKey::IsSetAltGr(void) +bool ewol::SpecialKey::IsSetAltGr(void) const { return altGr; } -bool ewol::SpecialKey::IsSetNumLock(void) +bool ewol::SpecialKey::IsSetNumLock(void) const { return numLock; } -bool ewol::SpecialKey::IsSetInsert(void) +bool ewol::SpecialKey::IsSetInsert(void) const { return insert; } diff --git a/sources/ewol/key.h b/sources/ewol/key.h index 3858408e..25f2da63 100644 --- a/sources/ewol/key.h +++ b/sources/ewol/key.h @@ -127,49 +127,47 @@ namespace ewol * @brief Get the current CapLock Status * @return The status value */ - bool IsSetCapsLock(void); + bool IsSetCapsLock(void) const; /** * @brief Get the current Shift key status * @return The status value */ - bool IsSetShift(void); + bool IsSetShift(void) const; /** * @brief Get the Current Control key status * @return The status value */ - bool IsSetCtrl(void); + bool IsSetCtrl(void) const; /** * @brief Get the current Meta key status (also named windows or apple key) * @return The status value */ - bool IsSetMeta(void); + bool IsSetMeta(void) const; /** * @brief Get the current Alt key status * @return The status value */ - bool IsSetAlt(void); + bool IsSetAlt(void) const; /** * @brief Get the current Alt-Gr key status * @return The status value */ - bool IsSetAltGr(void); + bool IsSetAltGr(void) const; /** * @brief Get the current Ver-num key status * @return The status value */ - bool IsSetNumLock(void); + bool IsSetNumLock(void) const; /** * @brief Get the current Intert key status * @return The status value */ - bool IsSetInsert(void); + bool IsSetInsert(void) const; }; /** * @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/EventEntry.h b/sources/ewol/renderer/EventEntry.h index d0ce090e..89440f50 100644 --- a/sources/ewol/renderer/EventEntry.h +++ b/sources/ewol/renderer/EventEntry.h @@ -10,25 +10,31 @@ #define __EWOL_EVENT_ENTRY_H__ #include +#include namespace ewol { class EventEntry { private: ewol::keyEvent::keyboard_te m_type; //!< type of hardware event ewol::keyEvent::status_te m_status; //!< status of hardware event + ewol::SpecialKey m_specialKey; //!< input key status (prevent change in time..) uniChar_t m_unicodeData; //!< Unicode data (in some case) public: EventEntry(ewol::keyEvent::keyboard_te _type, ewol::keyEvent::status_te _status, + ewol::SpecialKey _specialKey, uniChar_t _char) : m_type(_type), m_status(_status), + m_specialKey(_specialKey), m_unicodeData(_char) { }; void SetType(ewol::keyEvent::keyboard_te _type) { m_type = _type; }; inline const ewol::keyEvent::keyboard_te& GetType(void) const { return m_type; }; void SetStatus(ewol::keyEvent::status_te _status) { m_status = _status; }; inline const ewol::keyEvent::status_te& GetStatus(void) const { return m_status; }; + void SetSpecialKey(const ewol::SpecialKey& _specialKey) { m_specialKey = _specialKey; }; + inline const ewol::SpecialKey& GetSpecialKey(void) const { return m_specialKey; }; void SetChar(uniChar_t _char) { m_unicodeData = _char; }; inline const uniChar_t& GetChar(void) const { return m_unicodeData; }; }; @@ -38,8 +44,9 @@ namespace ewol { public: EventEntrySystem(ewol::keyEvent::keyboard_te _type, ewol::keyEvent::status_te _status, + ewol::SpecialKey _specialKey, uniChar_t _char) : - m_event(_type, _status, _char) + m_event(_type, _status, _specialKey, _char) { }; ewol::EventEntry m_event; }; diff --git a/sources/ewol/renderer/eContext.cpp b/sources/ewol/renderer/eContext.cpp index 85943988..a52557ff 100644 --- a/sources/ewol/renderer/eContext.cpp +++ b/sources/ewol/renderer/eContext.cpp @@ -122,11 +122,6 @@ void ewol::eContext::ProcessEvents(void) case 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); - } if (NULL != m_windowsCurrent) { if (false==m_windowsCurrent->OnEventShortCut(data.keyboardSpecial, data.keyboardChar, @@ -147,14 +142,20 @@ void ewol::eContext::ProcessEvents(void) data.stateIsDown) ) { // generate the direct event ... if (data.TypeMessage == THREAD_KEYBORAD_KEY) { - ewol::EventEntrySystem tmpEntryEvent(ewol::keyEvent::keyboardChar, ewol::keyEvent::statusUp, data.keyboardChar); + ewol::EventEntrySystem tmpEntryEvent(ewol::keyEvent::keyboardChar, + ewol::keyEvent::statusUp, + data.keyboardSpecial, + data.keyboardChar); if(true == data.stateIsDown) { tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown); } tmpWidget->SystemEventEntry(tmpEntryEvent); } else { // THREAD_KEYBORAD_MOVE EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data.keyboardMove << " " << data.stateIsDown); - ewol::EventEntrySystem tmpEntryEvent(data.keyboardMove, ewol::keyEvent::statusUp, 0); + ewol::EventEntrySystem tmpEntryEvent(data.keyboardMove, + ewol::keyEvent::statusUp, + data.keyboardSpecial, + 0); if(true == data.stateIsDown) { tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown); }