]> git.sesse.net Git - vlc/commitdiff
Skins2: Use vlc KEY_MODIFIER_* constants for key modifier masks, simplifying the...
authorJP Dinger <jpd@videolan.org>
Mon, 16 Nov 2009 12:51:30 +0000 (13:51 +0100)
committerJP Dinger <jpd@videolan.org>
Sat, 5 Dec 2009 21:25:41 +0000 (22:25 +0100)
modules/gui/skins2/events/evt_input.cpp
modules/gui/skins2/events/evt_input.hpp
modules/gui/skins2/events/evt_key.cpp
modules/gui/skins2/events/evt_key.hpp
modules/gui/skins2/src/top_window.cpp

index d56d45e86f0f31f64cb474a14a02ac6169cc2693..8b947762c51b4d2f397bf8de98739d0fcf3bc082 100644 (file)
  *****************************************************************************/
 
 #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 );
     }
index a001c0e70c1a5c75e0874859d9d96aca4f8b7687..2ae83d61515617ade4b24bd53e5ca2c0ff9ca15c 100644 (file)
@@ -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)
index 7bb3a3241e7ffb2b3465a9488ab5890b4326d318..9cf34675e5a49ffbed5191e2c4ca66abc719fe3e 100644 (file)
@@ -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;
-}
-
index 28d04cba376c416defb0f8515c4306e286833cfa..29c64578d2c9906481197aa371f69bf2c8809f7e 100644 (file)
@@ -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; }
 
index 279a28fbcb12765ddde46d60f26790fb6c202d05..e184c2816d368ca863b05dfcb100d3ecef92c57d 100644 (file)
@@ -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();
 }