]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/controls/ctrl_video.cpp
skins2(win): fix mouse wheel ineffective on Windows
[vlc] / modules / gui / skins2 / controls / ctrl_video.cpp
index dc2e3192b803cf3cf355cef6ea15aa8e4d1128a4..2ed026bdee14a3055fe3a546d56e209c02564d91 100644 (file)
@@ -36,8 +36,8 @@ CtrlVideo::CtrlVideo( intf_thread_t *pIntf, GenericLayout &rLayout,
                       bool autoResize, const UString &rHelp,
                       VarBool *pVisible ):
     CtrlGeneric( pIntf, rHelp, pVisible ), m_rLayout( rLayout ),
-    m_xShift( 0 ), m_yShift( 0 ), m_bAutoResize( autoResize ),
-    m_pVoutWindow( NULL ), m_bIsUseable( false )
+    m_bAutoResize( autoResize), m_xShift( 0 ), m_yShift( 0 ),
+    m_bIsUseable( false), m_pVoutWindow( NULL )
 {
     VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
     rFullscreen.addObserver( this );
@@ -57,11 +57,13 @@ CtrlVideo::~CtrlVideo()
 
 void CtrlVideo::handleEvent( EvtGeneric &rEvent )
 {
+    (void)rEvent;
 }
 
 
 bool CtrlVideo::mouseOver( int x, int y ) const
 {
+    (void)x; (void)y;
     return false;
 }
 
@@ -85,14 +87,23 @@ void CtrlVideo::onPositionChange()
 }
 
 
-void CtrlVideo::draw( OSGraphics &rImage, int xDest, int yDest )
+void CtrlVideo::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h)
 {
     const Position *pPos = getPosition();
-    if( pPos )
+    rect region( pPos->getLeft(), pPos->getTop(),
+                 pPos->getWidth(), pPos->getHeight() );
+    rect clip( xDest, yDest, w, h );
+    rect inter;
+
+    if( rect::intersect( region, clip, &inter ) )
     {
         // Draw a black rectangle under the video to avoid transparency
-        rImage.fillRect( pPos->getLeft(), pPos->getTop(), pPos->getWidth(),
-                         pPos->getHeight(), 0 );
+        rImage.fillRect( inter.x, inter.y, inter.width, inter.height, 0 );
+    }
+
+    if( m_pVoutWindow )
+    {
+        m_pVoutWindow->show();
     }
 }
 
@@ -122,6 +133,9 @@ void CtrlVideo::unsetLayout()
 
 void CtrlVideo::resizeControl( int width, int height )
 {
+    if( !m_bAutoResize )
+        return;
+
     WindowManager &rWindowManager =
         getIntf()->p_sys->p_theme->getWindowManager();
 
@@ -149,11 +163,14 @@ void CtrlVideo::resizeControl( int width, int height )
 
 void CtrlVideo::onUpdate( Subject<VarBool> &rVariable, void *arg  )
 {
+    (void)arg;
+
     // Visibility changed
     if( &rVariable == m_pVisible )
     {
         msg_Dbg( getIntf(), "VideoCtrl : Visibility changed (visible=%d)",
                                   isVisible() );
+        notifyLayout();
     }
 
     // Active Layout changed