Commit 3569ffff authored by JP Dinger's avatar JP Dinger

Skins2: Use vlc KEY_MODIFIER_* constants for key modifier masks, simplifying...

Skins2: Use vlc KEY_MODIFIER_* constants for key modifier masks, simplifying the code. Revert from enum to static const int to not have to include vlc_keys.h through the header file.
parent 34a265ac
......@@ -23,7 +23,15 @@
*****************************************************************************/
#include "evt_input.hpp"
#include "vlc_keys.h"
const int
EvtInput::kModNone=0,
EvtInput::kModAlt=KEY_MODIFIER_ALT,
EvtInput::kModShift=KEY_MODIFIER_SHIFT,
EvtInput::kModCtrl=KEY_MODIFIER_CTRL,
EvtInput::kModMeta=KEY_MODIFIER_META,
EvtInput::kModCmd=KEY_MODIFIER_COMMAND;
EvtInput::EvtInput( intf_thread_t *pIntf, int mod )
: EvtGeneric( pIntf), m_mod( mod ) { }
......@@ -44,6 +52,10 @@ void EvtInput::addModifier( string &rEvtString ) const
m += "ctrl,";
if( m_mod & kModShift )
m += "shift,";
if( m_mod & kModMeta )
m += "meta,";
if( m_mod & kModCmd )
m += "cmd,";
// Append the result except the last ','
rEvtString.insert( rEvtString.end(), m.begin(), m.end()-1 );
}
......
......@@ -27,7 +27,6 @@
#include "evt_generic.hpp"
/// Base class for mouse and key events
class EvtInput: public EvtGeneric
{
......@@ -35,16 +34,17 @@ public:
virtual ~EvtInput() { }
/// Masks for modifier keys
enum { kModNone=0, kModAlt=1, kModCtrl=2, kModShift=4 };
static const int
kModNone, kModAlt, kModShift, kModCtrl, kModMeta, kModCmd;
/// Get the modifiers
virtual int getMod() const { return m_mod; }
int getMod() const { return m_mod; }
protected:
EvtInput( intf_thread_t *pIntf, int mod = kModNone );
/// Add the modifier to the event string
virtual void addModifier( string &rEvtString ) const;
void addModifier( string &rEvtString ) const;
private:
/// Modifiers (special key(s) pressed during the mouse event)
......
......@@ -53,14 +53,3 @@ const string EvtKey::getAsString() const
return event;
}
int EvtKey::getModKey() const {
int i = getKey();
if( getMod() & kModAlt )
i |= KEY_MODIFIER_ALT;
if( getMod() & kModCtrl )
i |= KEY_MODIFIER_CTRL;
if( getMod() & kModShift )
i |= KEY_MODIFIER_SHIFT;
}
......@@ -44,7 +44,7 @@ public:
virtual const string getAsString() const;
int getKey() const { return m_key; }
int getModKey() const;
int getModKey() const { return m_key | getMod(); }
ActionType_t getKeyState() const { return m_action; }
......
......@@ -244,7 +244,7 @@ void TopWindow::processEvent( EvtKey &rEvtKey )
rEvtKey.getModKey() );
}
// Always store the modifier, which can be needed for scroll events
// Always store the modifier, which can be needed for scroll events.
m_currModifier = rEvtKey.getMod();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment