[vlc-commits] skins2(win): fix mouse wheel ineffective on Windows
Erwan Tulou
git at videolan.org
Thu Mar 22 22:28:48 CET 2012
vlc/vlc-2.0 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Mar 22 18:27:09 2012 +0100| [db99f01eefb87c641553fd4fb764b22c3130b6b0] | committer: Jean-Baptiste Kempf
skins2(win): fix mouse wheel ineffective on Windows
This patch adds isScrollable() to a control, so that we can distinguish
controls that require mouse wheel (playtree, slider) from those that don't.
In the latter case, we can then forward events to vlc core.
this fixes #6457.
(cherry picked from commit f3afffbc05eea48ef29191b169859b17e3f4b994)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=db99f01eefb87c641553fd4fb764b22c3130b6b0
---
modules/gui/skins2/controls/ctrl_generic.hpp | 3 +++
modules/gui/skins2/controls/ctrl_list.hpp | 3 +++
modules/gui/skins2/controls/ctrl_slider.hpp | 6 ++++++
modules/gui/skins2/controls/ctrl_tree.hpp | 3 +++
modules/gui/skins2/src/top_window.cpp | 15 ++++++---------
5 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/modules/gui/skins2/controls/ctrl_generic.hpp b/modules/gui/skins2/controls/ctrl_generic.hpp
index ee7afeb..591c8e5 100644
--- a/modules/gui/skins2/controls/ctrl_generic.hpp
+++ b/modules/gui/skins2/controls/ctrl_generic.hpp
@@ -81,6 +81,9 @@ public:
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return false; }
+ /// Return true if the control can be scrollable
+ virtual bool isScrollable() const { return false; }
+
/// Return true if the control is visible
virtual bool isVisible() const;
diff --git a/modules/gui/skins2/controls/ctrl_list.hpp b/modules/gui/skins2/controls/ctrl_list.hpp
index fcfb33e..1f7e5c8 100644
--- a/modules/gui/skins2/controls/ctrl_list.hpp
+++ b/modules/gui/skins2/controls/ctrl_list.hpp
@@ -61,6 +61,9 @@ public:
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; }
+ /// Return true if the control can be scrollable
+ virtual bool isScrollable() const { return true; }
+
/// Get the type of control (custom RTTI)
virtual string getType() const { return "list"; }
diff --git a/modules/gui/skins2/controls/ctrl_slider.hpp b/modules/gui/skins2/controls/ctrl_slider.hpp
index df010a5..bae216f 100644
--- a/modules/gui/skins2/controls/ctrl_slider.hpp
+++ b/modules/gui/skins2/controls/ctrl_slider.hpp
@@ -55,6 +55,9 @@ public:
/// Handle an event
virtual void handleEvent( EvtGeneric &rEvent );
+ /// Return true if the control can be scrollable
+ virtual bool isScrollable() const { return true; }
+
/// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const;
@@ -132,6 +135,9 @@ public:
const UString &rHelp );
virtual ~CtrlSliderBg();
+ /// Return true if the control can be scrollable
+ virtual bool isScrollable() const { return true; }
+
/// Tell whether the mouse is over the control
virtual bool mouseOver( int x, int y ) const;
diff --git a/modules/gui/skins2/controls/ctrl_tree.hpp b/modules/gui/skins2/controls/ctrl_tree.hpp
index cc5972c..6044716 100644
--- a/modules/gui/skins2/controls/ctrl_tree.hpp
+++ b/modules/gui/skins2/controls/ctrl_tree.hpp
@@ -71,6 +71,9 @@ public:
/// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; }
+ /// Return true if the control can be scrollable
+ virtual bool isScrollable() const { return true; }
+
/// Get the type of control (custom RTTI)
virtual string getType() const { return "tree"; }
diff --git a/modules/gui/skins2/src/top_window.cpp b/modules/gui/skins2/src/top_window.cpp
index 8e99730..6eb639a 100644
--- a/modules/gui/skins2/src/top_window.cpp
+++ b/modules/gui/skins2/src/top_window.cpp
@@ -247,17 +247,14 @@ void TopWindow::processEvent( EvtScroll &rEvtScroll )
rEvtScroll.getYPos());
setLastHit( pNewHitControl );
- // Send a mouse event to the hit control, or to the control
- // that captured the mouse, if any
- CtrlGeneric *pActiveControl = pNewHitControl;
+ // send a mouse event to the right control when scrollable
+ // if none, send it directly to the vlc core
+ CtrlGeneric *pHitControl = m_pCapturingControl ?
+ m_pCapturingControl : pNewHitControl;
- if( m_pCapturingControl )
- {
- pActiveControl = m_pCapturingControl;
- }
- if( pActiveControl )
+ if( pHitControl && pHitControl->isScrollable() )
{
- pActiveControl->handleEvent( rEvtScroll );
+ pHitControl->handleEvent( rEvtScroll );
}
else
{
More information about the vlc-commits
mailing list