Commit f3afffbc authored by Erwan Tulou's avatar Erwan Tulou

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.
parent d8a96604
...@@ -81,6 +81,9 @@ public: ...@@ -81,6 +81,9 @@ public:
/// Return true if the control can gain the focus /// Return true if the control can gain the focus
virtual bool isFocusable() const { return false; } 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 /// Return true if the control is visible
virtual bool isVisible() const; virtual bool isVisible() const;
......
...@@ -61,6 +61,9 @@ public: ...@@ -61,6 +61,9 @@ public:
/// Return true if the control can gain the focus /// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; } 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) /// Get the type of control (custom RTTI)
virtual string getType() const { return "list"; } virtual string getType() const { return "list"; }
......
...@@ -55,6 +55,9 @@ public: ...@@ -55,6 +55,9 @@ public:
/// Handle an event /// Handle an event
virtual void handleEvent( EvtGeneric &rEvent ); 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 /// Check whether coordinates are inside the control
virtual bool mouseOver( int x, int y ) const; virtual bool mouseOver( int x, int y ) const;
...@@ -132,6 +135,9 @@ public: ...@@ -132,6 +135,9 @@ public:
const UString &rHelp ); const UString &rHelp );
virtual ~CtrlSliderBg(); virtual ~CtrlSliderBg();
/// Return true if the control can be scrollable
virtual bool isScrollable() const { return true; }
/// Tell whether the mouse is over the control /// Tell whether the mouse is over the control
virtual bool mouseOver( int x, int y ) const; virtual bool mouseOver( int x, int y ) const;
......
...@@ -71,6 +71,9 @@ public: ...@@ -71,6 +71,9 @@ public:
/// Return true if the control can gain the focus /// Return true if the control can gain the focus
virtual bool isFocusable() const { return true; } 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) /// Get the type of control (custom RTTI)
virtual string getType() const { return "tree"; } virtual string getType() const { return "tree"; }
......
...@@ -247,17 +247,14 @@ void TopWindow::processEvent( EvtScroll &rEvtScroll ) ...@@ -247,17 +247,14 @@ void TopWindow::processEvent( EvtScroll &rEvtScroll )
rEvtScroll.getYPos()); rEvtScroll.getYPos());
setLastHit( pNewHitControl ); setLastHit( pNewHitControl );
// Send a mouse event to the hit control, or to the control // send a mouse event to the right control when scrollable
// that captured the mouse, if any // if none, send it directly to the vlc core
CtrlGeneric *pActiveControl = pNewHitControl; CtrlGeneric *pHitControl = m_pCapturingControl ?
m_pCapturingControl : pNewHitControl;
if( m_pCapturingControl ) if( pHitControl && pHitControl->isScrollable() )
{
pActiveControl = m_pCapturingControl;
}
if( pActiveControl )
{ {
pActiveControl->handleEvent( rEvtScroll ); pHitControl->handleEvent( rEvtScroll );
} }
else else
{ {
......
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