*****************************************************************************/
#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 ) { }
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 );
}
#include "evt_generic.hpp"
-
/// Base class for mouse and key events
class EvtInput: public EvtGeneric
{
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)
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;
-}
-
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; }
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();
}