[DEV] sent the keyboard status with the event keyboard

This commit is contained in:
Edouard DUPIN 2013-09-30 22:26:50 +02:00
parent fa2ecb4237
commit 6ca87b6a79
5 changed files with 33 additions and 35 deletions

2
external/etk vendored

@ -1 +1 @@
Subproject commit 44640896f5f58469ef9bce2703e9bd2b12344e9d Subproject commit dfcb78c081c6d975cf88dcb2e4cd1b0ada289c67

View File

@ -106,55 +106,47 @@ etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::t
return _os; return _os;
} }
static ewol::SpecialKey l_LocalKeyStatus;
ewol::SpecialKey& ewol::GetCurrentSpecialKeyStatus(void)
{
return l_LocalKeyStatus;
}
ewol::SpecialKey::SpecialKey(void) : ewol::SpecialKey::SpecialKey(void) :
value(0) value(0)
{ {
} }
bool ewol::SpecialKey::IsSetCapsLock(void) bool ewol::SpecialKey::IsSetCapsLock(void) const
{ {
return capLock; return capLock;
} }
bool ewol::SpecialKey::IsSetShift(void) bool ewol::SpecialKey::IsSetShift(void) const
{ {
return shift; return shift;
} }
bool ewol::SpecialKey::IsSetCtrl(void) bool ewol::SpecialKey::IsSetCtrl(void) const
{ {
return ctrl; return ctrl;
} }
bool ewol::SpecialKey::IsSetMeta(void) bool ewol::SpecialKey::IsSetMeta(void) const
{ {
return meta; return meta;
} }
bool ewol::SpecialKey::IsSetAlt(void) bool ewol::SpecialKey::IsSetAlt(void) const
{ {
return alt; return alt;
} }
bool ewol::SpecialKey::IsSetAltGr(void) bool ewol::SpecialKey::IsSetAltGr(void) const
{ {
return altGr; return altGr;
} }
bool ewol::SpecialKey::IsSetNumLock(void) bool ewol::SpecialKey::IsSetNumLock(void) const
{ {
return numLock; return numLock;
} }
bool ewol::SpecialKey::IsSetInsert(void) bool ewol::SpecialKey::IsSetInsert(void) const
{ {
return insert; return insert;
} }

View File

@ -127,49 +127,47 @@ namespace ewol
* @brief Get the current CapLock Status * @brief Get the current CapLock Status
* @return The status value * @return The status value
*/ */
bool IsSetCapsLock(void); bool IsSetCapsLock(void) const;
/** /**
* @brief Get the current Shift key status * @brief Get the current Shift key status
* @return The status value * @return The status value
*/ */
bool IsSetShift(void); bool IsSetShift(void) const;
/** /**
* @brief Get the Current Control key status * @brief Get the Current Control key status
* @return The status value * @return The status value
*/ */
bool IsSetCtrl(void); bool IsSetCtrl(void) const;
/** /**
* @brief Get the current Meta key status (also named windows or apple key) * @brief Get the current Meta key status (also named windows or apple key)
* @return The status value * @return The status value
*/ */
bool IsSetMeta(void); bool IsSetMeta(void) const;
/** /**
* @brief Get the current Alt key status * @brief Get the current Alt key status
* @return The status value * @return The status value
*/ */
bool IsSetAlt(void); bool IsSetAlt(void) const;
/** /**
* @brief Get the current Alt-Gr key status * @brief Get the current Alt-Gr key status
* @return The status value * @return The status value
*/ */
bool IsSetAltGr(void); bool IsSetAltGr(void) const;
/** /**
* @brief Get the current Ver-num key status * @brief Get the current Ver-num key status
* @return The status value * @return The status value
*/ */
bool IsSetNumLock(void); bool IsSetNumLock(void) const;
/** /**
* @brief Get the current Intert key status * @brief Get the current Intert key status
* @return The status value * @return The status value
*/ */
bool IsSetInsert(void); bool IsSetInsert(void) const;
}; };
/** /**
* @brief Debug operator To display the curent element in a Human redeable information * @brief Debug operator To display the curent element in a Human redeable information
*/ */
etk::CCout& operator <<(etk::CCout& _os, const ewol::SpecialKey _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::SpecialKey _obj);
SpecialKey& GetCurrentSpecialKeyStatus(void);
}; };

View File

@ -10,25 +10,31 @@
#define __EWOL_EVENT_ENTRY_H__ #define __EWOL_EVENT_ENTRY_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/key.h>
namespace ewol { namespace ewol {
class EventEntry { class EventEntry {
private: private:
ewol::keyEvent::keyboard_te m_type; //!< type of hardware event ewol::keyEvent::keyboard_te m_type; //!< type of hardware event
ewol::keyEvent::status_te m_status; //!< status 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) uniChar_t m_unicodeData; //!< Unicode data (in some case)
public: public:
EventEntry(ewol::keyEvent::keyboard_te _type, EventEntry(ewol::keyEvent::keyboard_te _type,
ewol::keyEvent::status_te _status, ewol::keyEvent::status_te _status,
ewol::SpecialKey _specialKey,
uniChar_t _char) : uniChar_t _char) :
m_type(_type), m_type(_type),
m_status(_status), m_status(_status),
m_specialKey(_specialKey),
m_unicodeData(_char) m_unicodeData(_char)
{ }; { };
void SetType(ewol::keyEvent::keyboard_te _type) { m_type = _type; }; void SetType(ewol::keyEvent::keyboard_te _type) { m_type = _type; };
inline const ewol::keyEvent::keyboard_te& GetType(void) const { return m_type; }; inline const ewol::keyEvent::keyboard_te& GetType(void) const { return m_type; };
void SetStatus(ewol::keyEvent::status_te _status) { m_status = _status; }; void SetStatus(ewol::keyEvent::status_te _status) { m_status = _status; };
inline const ewol::keyEvent::status_te& GetStatus(void) const { return m_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; }; void SetChar(uniChar_t _char) { m_unicodeData = _char; };
inline const uniChar_t& GetChar(void) const { return m_unicodeData; }; inline const uniChar_t& GetChar(void) const { return m_unicodeData; };
}; };
@ -38,8 +44,9 @@ namespace ewol {
public: public:
EventEntrySystem(ewol::keyEvent::keyboard_te _type, EventEntrySystem(ewol::keyEvent::keyboard_te _type,
ewol::keyEvent::status_te _status, ewol::keyEvent::status_te _status,
ewol::SpecialKey _specialKey,
uniChar_t _char) : uniChar_t _char) :
m_event(_type, _status, _char) m_event(_type, _status, _specialKey, _char)
{ }; { };
ewol::EventEntry m_event; ewol::EventEntry m_event;
}; };

View File

@ -122,11 +122,6 @@ void ewol::eContext::ProcessEvents(void)
case THREAD_KEYBORAD_KEY: case THREAD_KEYBORAD_KEY:
case THREAD_KEYBORAD_MOVE: case THREAD_KEYBORAD_MOVE:
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); //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 (NULL != m_windowsCurrent) {
if (false==m_windowsCurrent->OnEventShortCut(data.keyboardSpecial, if (false==m_windowsCurrent->OnEventShortCut(data.keyboardSpecial,
data.keyboardChar, data.keyboardChar,
@ -147,14 +142,20 @@ void ewol::eContext::ProcessEvents(void)
data.stateIsDown) ) { data.stateIsDown) ) {
// generate the direct event ... // generate the direct event ...
if (data.TypeMessage == THREAD_KEYBORAD_KEY) { 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) { if(true == data.stateIsDown) {
tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown); tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown);
} }
tmpWidget->SystemEventEntry(tmpEntryEvent); tmpWidget->SystemEventEntry(tmpEntryEvent);
} else { // THREAD_KEYBORAD_MOVE } else { // THREAD_KEYBORAD_MOVE
EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data.keyboardMove << " " << data.stateIsDown); 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) { if(true == data.stateIsDown) {
tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown); tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown);
} }