aboutsummaryrefslogtreecommitdiff
path: root/guilib
diff options
context:
space:
mode:
authorrenniej <renniej@svn>2010-07-23 14:30:20 +0000
committerrenniej <renniej@svn>2010-07-23 14:30:20 +0000
commitefb5275426a800876c64f655d237efd3c35c0542 (patch)
tree9231e7870c49df3dc71d5aa893d34f3ed8f4c007 /guilib
parent0a50d11390b73f7d2d6cc89743878c29c95cfe66 (diff)
See http://trac.xbmc.org/ticket/9665#comment:8
Apply patch suggested by jmarshall. This is a mainly cosmetic change for consistency with the rest of the code. git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@32102 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib')
-rw-r--r--guilib/Key.cpp55
-rw-r--r--guilib/Key.h31
2 files changed, 40 insertions, 46 deletions
diff --git a/guilib/Key.cpp b/guilib/Key.cpp
index e66dde0b0f..e8b56dd01e 100644
--- a/guilib/Key.cpp
+++ b/guilib/Key.cpp
@@ -24,27 +24,16 @@
CKey::CKey(void)
{
- m_leftTrigger = 0;
- m_rightTrigger = 0;
- m_leftThumbX = 0.0f;
- m_leftThumbY = 0.0f;
- m_rightThumbX = 0.0f;
- m_rightThumbY = 0.0f;
- m_repeat = 0.0f;
- m_fromHttpApi = false;
- m_buttonCode = KEY_INVALID;
- m_VKey = 0;
- m_wUnicode = 0;
- m_cAscii = 0;
- m_Modifiers = 0;
- m_held = 0;
+ Reset();
}
CKey::~CKey(void)
{}
-CKey::CKey(uint32_t buttonCode, uint8_t leftTrigger, uint8_t rightTrigger, float leftThumbX, float leftThumbY, float rightThumbX, float rightThumbY, float repeat, uint8_t vkey, wchar_t unicode, char ascii, uint32_t modifiers, unsigned int held)
+CKey::CKey(uint32_t buttonCode, uint8_t leftTrigger, uint8_t rightTrigger, float leftThumbX, float leftThumbY, float rightThumbX, float rightThumbY, float repeat)
{
+ Reset();
+ m_buttonCode = buttonCode;
m_leftTrigger = leftTrigger;
m_rightTrigger = rightTrigger;
m_leftThumbX = leftThumbX;
@@ -52,12 +41,20 @@ CKey::CKey(uint32_t buttonCode, uint8_t leftTrigger, uint8_t rightTrigger, float
m_rightThumbX = rightThumbX;
m_rightThumbY = rightThumbY;
m_repeat = repeat;
- m_fromHttpApi = false;
- m_buttonCode = buttonCode;
- m_VKey = vkey;
- m_wUnicode = unicode;
- m_cAscii = ascii;
- m_Modifiers = modifiers;
+}
+
+CKey::CKey(uint8_t vkey, wchar_t unicode, char ascii, uint32_t modifiers, unsigned int held)
+{
+ Reset();
+ if (vkey) // FIXME: This needs cleaning up - should we always use the unicode key where available?
+ m_buttonCode = vkey | KEY_VKEY;
+ else
+ m_buttonCode = KEY_UNICODE;
+ m_buttonCode |= modifiers;
+ m_vkey = vkey;
+ m_unicode = unicode;
+ m_ascii = ascii;
+ m_modifiers = modifiers;
m_held = held;
}
@@ -77,10 +74,10 @@ void CKey::Reset()
m_repeat = 0.0f;
m_fromHttpApi = false;
m_buttonCode = KEY_INVALID;
- m_VKey = 0;
- m_wUnicode = 0;
- m_cAscii = 0;
- m_Modifiers = 0;
+ m_vkey = 0;
+ m_unicode = 0;
+ m_ascii = 0;
+ m_modifiers = 0;
m_held = 0;
}
@@ -96,10 +93,10 @@ const CKey& CKey::operator=(const CKey& key)
m_repeat = key.m_repeat;
m_fromHttpApi = key.m_fromHttpApi;
m_buttonCode = key.m_buttonCode;
- m_VKey = key.m_VKey;
- m_wUnicode = key.m_wUnicode;
- m_cAscii = key.m_cAscii;
- m_Modifiers = key.m_Modifiers;
+ m_vkey = key.m_vkey;
+ m_unicode = key.m_unicode;
+ m_ascii = key.m_ascii;
+ m_modifiers = key.m_modifiers;
m_held = key.m_held;
return *this;
}
diff --git a/guilib/Key.h b/guilib/Key.h
index 3916f5629c..2a9ceadde9 100644
--- a/guilib/Key.h
+++ b/guilib/Key.h
@@ -502,7 +502,8 @@ class CKey
{
public:
CKey(void);
- CKey(uint32_t buttonCode, uint8_t leftTrigger = 0, uint8_t rightTrigger = 0, float leftThumbX = 0.0f, float leftThumbY = 0.0f, float rightThumbX = 0.0f, float rightThumbY = 0.0f, float repeat = 0.0f, uint8_t vkey = 0, wchar_t unicode = 0, char ascii = 0, uint32_t modifiers = 0, unsigned int held = 0);
+ CKey(uint32_t buttonCode, uint8_t leftTrigger = 0, uint8_t rightTrigger = 0, float leftThumbX = 0.0f, float leftThumbY = 0.0f, float rightThumbX = 0.0f, float rightThumbY = 0.0f, float repeat = 0.0f);
+ CKey(uint8_t vkey, wchar_t unicode, char ascii, uint32_t modifiers, unsigned int held);
CKey(const CKey& key);
virtual ~CKey(void);
@@ -520,18 +521,12 @@ public:
void SetFromHttpApi(bool);
bool GetFromHttpApi() const;
- void Reset();
-
- inline uint32_t GetButtonCode() const { return m_buttonCode;};
- inline uint8_t GetVKey() const { return m_VKey;};
- inline wchar_t GetUnicode() const { return m_wUnicode;};
- inline char GetAscii() const { return m_cAscii;};
- inline bool GetCtrl() const { return (m_Modifiers & MODIFIER_CTRL) == MODIFIER_CTRL ? true : false; };
- inline bool GetShift() const { return (m_Modifiers & MODIFIER_SHIFT) == MODIFIER_SHIFT ? true : false; };
- inline bool GetAlt() const { return (m_Modifiers & MODIFIER_ALT) == MODIFIER_ALT ? true : false; };
- inline bool GetRAlt() const { return (m_Modifiers & MODIFIER_RALT) == MODIFIER_RALT ? true : false; };
- inline bool GetSuper() const { return (m_Modifiers & MODIFIER_SUPER) == MODIFIER_SUPER ? true : false; };
- inline unsigned int GetHeld() const { return m_held; };
+ inline uint32_t GetButtonCode() const { return m_buttonCode; }
+ inline uint8_t GetVKey() const { return m_vkey; }
+ inline wchar_t GetUnicode() const { return m_unicode; }
+ inline char GetAscii() const { return m_ascii; }
+ inline uint32_t GetModifiers() const { return m_modifiers; };
+ inline unsigned int GetHeld() const { return m_held; }
enum Modifier {
MODIFIER_CTRL = 0x00010000,
@@ -542,11 +537,13 @@ public:
};
private:
+ void Reset();
+
uint32_t m_buttonCode;
- uint8_t m_VKey;
- wchar_t m_wUnicode;
- char m_cAscii;
- uint32_t m_Modifiers;
+ uint8_t m_vkey;
+ wchar_t m_unicode;
+ char m_ascii;
+ uint32_t m_modifiers;
unsigned int m_held;
uint8_t m_leftTrigger;