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:
/// 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;
......
......@@ -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"; }
......
......@@ -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;
......
......@@ -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"; }
......
......@@ -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
{
......
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