[vlc-commits] skins2: add support for the new key accelerator feature.
Erwan Tulou
git at videolan.org
Sun Jul 13 13:56:37 CEST 2014
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Fri Jul 11 17:58:12 2014 +0200| [74c73be30b81a95948b4b92cbb716a1aa33536d3] | committer: Erwan Tulou
skins2: add support for the new key accelerator feature.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74c73be30b81a95948b4b92cbb716a1aa33536d3
---
modules/gui/skins2/src/dialogs.cpp | 9 +++++++++
modules/gui/skins2/src/dialogs.hpp | 3 +++
modules/gui/skins2/src/top_window.cpp | 5 ++---
modules/gui/skins2/src/vout_manager.hpp | 5 ++---
modules/gui/skins2/src/vout_window.cpp | 3 +--
modules/gui/skins2/src/vout_window.hpp | 1 +
6 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/modules/gui/skins2/src/dialogs.cpp b/modules/gui/skins2/src/dialogs.cpp
index fc4db08..0067b57 100644
--- a/modules/gui/skins2/src/dialogs.cpp
+++ b/modules/gui/skins2/src/dialogs.cpp
@@ -344,3 +344,12 @@ void Dialogs::showInteraction( interaction_dialog_t *p_dialog )
0, p_arg );
}
}
+
+void Dialogs::sendKey( int key )
+{
+ if( m_pProvider && m_pProvider->pf_show_dialog )
+ {
+ m_pProvider->pf_show_dialog( m_pProvider, INTF_DIALOG_SENDKEY,
+ key, NULL );
+ }
+}
diff --git a/modules/gui/skins2/src/dialogs.hpp b/modules/gui/skins2/src/dialogs.hpp
index 0e3cebf..a2bb90a 100644
--- a/modules/gui/skins2/src/dialogs.hpp
+++ b/modules/gui/skins2/src/dialogs.hpp
@@ -95,6 +95,9 @@ public:
/// Show an interaction dialog
void showInteraction( interaction_dialog_t * );
+ /// Send hotkeys (key accelerators)
+ void sendKey( int key );
+
private:
// Private because it's a singleton
Dialogs( intf_thread_t *pIntf );
diff --git a/modules/gui/skins2/src/top_window.cpp b/modules/gui/skins2/src/top_window.cpp
index d65a80e..e7b79df 100644
--- a/modules/gui/skins2/src/top_window.cpp
+++ b/modules/gui/skins2/src/top_window.cpp
@@ -227,8 +227,7 @@ void TopWindow::processEvent( EvtKey &rEvtKey )
return;
}
- var_SetInteger( getIntf()->p_libvlc, "key-pressed",
- rEvtKey.getModKey() );
+ getIntf()->p_sys->p_dialogs->sendKey( rEvtKey.getModKey() );
}
// Always store the modifier, which can be needed for scroll events.
@@ -260,7 +259,7 @@ void TopWindow::processEvent( EvtScroll &rEvtScroll )
int i = (rEvtScroll.getDirection() == EvtScroll::kUp ?
KEY_MOUSEWHEELUP : KEY_MOUSEWHEELDOWN) | m_currModifier;
- var_SetInteger( getIntf()->p_libvlc, "key-pressed", i );
+ getIntf()->p_sys->p_dialogs->sendKey( i );
}
}
diff --git a/modules/gui/skins2/src/vout_manager.hpp b/modules/gui/skins2/src/vout_manager.hpp
index 6d01ca0..9ddabe8 100644
--- a/modules/gui/skins2/src/vout_manager.hpp
+++ b/modules/gui/skins2/src/vout_manager.hpp
@@ -77,8 +77,7 @@ public:
{
// Only do the action when the key is down
if( rEvtKey.getKeyState() == EvtKey::kDown )
- var_SetInteger( getIntf()->p_libvlc, "key-pressed",
- rEvtKey.getModKey() );
+ getIntf()->p_sys->p_dialogs->sendKey( rEvtKey.getModKey() );
}
virtual void processEvent( EvtScroll &rEvtScroll )
@@ -89,7 +88,7 @@ public:
i_vlck |= ( rEvtScroll.getDirection() == EvtScroll::kUp ) ?
KEY_MOUSEWHEELUP : KEY_MOUSEWHEELDOWN;
- var_SetInteger( getIntf()->p_libvlc, "key-pressed", i_vlck );
+ getIntf()->p_sys->p_dialogs->sendKey( i_vlck );
}
#endif
diff --git a/modules/gui/skins2/src/vout_window.cpp b/modules/gui/skins2/src/vout_window.cpp
index e209363..33da4cb 100644
--- a/modules/gui/skins2/src/vout_window.cpp
+++ b/modules/gui/skins2/src/vout_window.cpp
@@ -100,7 +100,6 @@ void VoutWindow::processEvent( EvtKey &rEvtKey )
{
// Only do the action when the key is down
if( rEvtKey.getKeyState() == EvtKey::kDown )
- var_SetInteger( getIntf()->p_libvlc, "key-pressed",
- rEvtKey.getModKey() );
+ getIntf()->p_sys->p_dialogs->sendKey( rEvtKey.getModKey() );
}
diff --git a/modules/gui/skins2/src/vout_window.hpp b/modules/gui/skins2/src/vout_window.hpp
index bdd2fe6..c2f306d 100644
--- a/modules/gui/skins2/src/vout_window.hpp
+++ b/modules/gui/skins2/src/vout_window.hpp
@@ -25,6 +25,7 @@
#define VOUT_WINDOW_HPP
#include "generic_window.hpp"
+#include "dialogs.hpp"
#include <vlc_vout_window.h>
class OSGraphics;
More information about the vlc-commits
mailing list