]> git.sesse.net Git - vlc/commitdiff
* skins2: Do not paint on the embedded video output, when a video is
authorOlivier Teulière <ipkiss@videolan.org>
Fri, 17 Dec 2004 23:39:34 +0000 (23:39 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Fri, 17 Dec 2004 23:39:34 +0000 (23:39 +0000)
   being played in it

18 files changed:
modules/gui/skins2/controls/ctrl_button.hpp
modules/gui/skins2/controls/ctrl_checkbox.hpp
modules/gui/skins2/controls/ctrl_generic.hpp
modules/gui/skins2/controls/ctrl_image.hpp
modules/gui/skins2/controls/ctrl_list.hpp
modules/gui/skins2/controls/ctrl_move.hpp
modules/gui/skins2/controls/ctrl_radialslider.hpp
modules/gui/skins2/controls/ctrl_resize.hpp
modules/gui/skins2/controls/ctrl_slider.hpp
modules/gui/skins2/controls/ctrl_text.hpp
modules/gui/skins2/controls/ctrl_video.hpp
modules/gui/skins2/src/generic_layout.cpp
modules/gui/skins2/src/generic_layout.hpp
modules/gui/skins2/src/top_window.cpp
modules/gui/skins2/src/top_window.hpp
modules/gui/skins2/src/vlcproc.hpp
modules/gui/skins2/src/vout_window.cpp
modules/gui/skins2/win32/win32_loop.cpp

index 3b819b0dc80aa43723fbf00a8db884e7cbc85db6..2ca13187195fc86d6807bfbe584a0b0ba4163b9b 100644 (file)
@@ -58,6 +58,9 @@ class CtrlButton: public CtrlGeneric
         /// Get the text of the tooltip
         virtual UString getTooltipText() const { return m_tooltip; }
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "button"; }
+
     private:
         /// Finite state machine of the control
         FSM m_fsm;
index ec827b5aadf9100c5b523e815a41ddda55f0736f..71611a6b78b6f0f4bc7914f059e1c706d5f23fc7 100644 (file)
@@ -2,7 +2,7 @@
  * ctrl_checkbox.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: ctrl_checkbox.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -65,6 +65,9 @@ class CtrlCheckbox: public CtrlGeneric
         /// Get the text of the tooltip XXX
         virtual UString getTooltipText() const { return *m_pTooltip; }
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "checkbox"; }
+
     private:
         /// Finite state machine of the control
         FSM m_fsm;
index a68a796581eecb4a2f77a23756820912a6d2001a..b7dc693bbf6710ad965acf4cd49bfb62f63eb820 100644 (file)
@@ -78,6 +78,9 @@ class CtrlGeneric: public SkinObject, public Observer<VarBool>
         /// Return true if the control is visible
         virtual bool isVisible() const;
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return ""; }
+
     protected:
         // If pVisible is NULL, the control is always visible
         CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
index a3301bde1e59f36ddb53a5fa1aab1098d51f7ab8..8c3c2ad7baa7e811f1d809e63fb49fa813758e30 100644 (file)
@@ -2,7 +2,7 @@
  * ctrl_image.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: ctrl_image.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -50,6 +50,9 @@ class CtrlImage: public CtrlFlat
         /// Draw the control on the given graphics
         virtual void draw( OSGraphics &rImage, int xDest, int yDest );
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "image"; }
+
     private:
         /// Bitmap
         const GenericBitmap &m_rBitmap;
index 8d552d07413e9dab41f78cf95b00e9edff7f6163..d2b6b5996252ca09d98874ed089343a291313f53 100644 (file)
@@ -59,6 +59,9 @@ class CtrlList: public CtrlGeneric, public Observer<VarList>,
         /// Return true if the control can gain the focus
         virtual bool isFocusable() const { return true; }
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "list"; }
+
     private:
         /// List associated to the control
         VarList &m_rList;
index 7da7fc07ba6d98fc8f52b5d246873212fadd9246..340aa92a682af93b3344d149da5360ce646c45ca 100644 (file)
@@ -62,6 +62,9 @@ class CtrlMove: public CtrlFlat
         static void transStillMoving( SkinObject *pCtrl );
         static void transMovingStill( SkinObject *pCtrl );
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return m_rCtrl.getType(); }
+
     private:
         FSM m_fsm;
         /// Window manager
index b71f4dc3a38aa4e4097094d3e80d4995ea255f4b..0f606714271cb9a06546ec0abd99328efc689148 100644 (file)
@@ -2,7 +2,7 @@
  * ctrl_radialslider.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: ctrl_radialslider.hpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -57,6 +57,9 @@ class CtrlRadialSlider: public CtrlGeneric, public Observer<VarPercent>
         /// Draw the control on the given graphics
         virtual void draw( OSGraphics &rImage, int xDest, int yDest );
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "radial_slider"; }
+
     private:
         /// Finite state machine of the control
         FSM m_fsm;
index fff8cac15a926a84079f79d8205dc486a616a9ce..db8545f36e37b4522ee54dd5a9af2512e018cb1a 100644 (file)
@@ -64,6 +64,9 @@ class CtrlResize: public CtrlFlat
         static void transResizeStill( SkinObject *pCtrl );
         static void transResizeResize( SkinObject *pCtrl );
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return m_rCtrl.getType(); }
+
     private:
         FSM m_fsm;
         /// Decorated CtrlFlat
index a0962165f20c0017e96a6c90da097df63363425b..6c8873fa9caa511c999d414aa7eb00a163dbe6f8 100755 (executable)
@@ -2,7 +2,7 @@
  * ctrl_slider.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: ctrl_slider.hpp,v 1.4 2004/03/02 21:45:15 ipkiss Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -63,6 +63,9 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>
         /// Get the text of the tooltip
         virtual UString getTooltipText() const { return m_tooltip; }
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "slider_cursor"; }
+
     private:
         /// Finite state machine of the control
         FSM m_fsm;
@@ -125,6 +128,9 @@ class CtrlSliderBg: public CtrlGeneric
         /// Handle an event
         virtual void handleEvent( EvtGeneric &rEvent );
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "slider_bg"; }
+
     private:
         /// Cursor of the slider
         CtrlSliderCursor &m_rCursor;
index 2df56db536867161e55fc287578efd4fdd9f99b8..3cfc571ff587dad3be189009e3f27d1d294017b9 100644 (file)
@@ -2,7 +2,7 @@
  * ctrl_text.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: ctrl_text.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -60,6 +60,9 @@ class CtrlText: public CtrlGeneric, public Observer<VarText>
         /// This takes effect immediatly
         void setText( const UString &rText, uint32_t color = 0xFFFFFFFF );
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "text"; }
+
     private:
         /// Finite state machine of the control
         FSM m_fsm;
index 1764e6f8cea93282ef1ebd6856ac842f624c66dd..5124fc46d0bb1c98f8ad64aaa564dc696198dc32 100644 (file)
@@ -48,6 +48,9 @@ class CtrlVideo: public CtrlGeneric
         /// Draw the control on the given graphics
         virtual void draw( OSGraphics &rImage, int xDest, int yDest );
 
+        /// Get the type of control (custom RTTI)
+        virtual string getType() const { return "video"; }
+
     private:
         /// Vout window
         VoutWindow *m_pVout;
index 03768bea6c3b8fc0dae59721be8d7c3aa1bb333b..b08f0de3fd468d64ecf3d0d570ab7a700954014d 100644 (file)
@@ -200,6 +200,7 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
 {
     // Draw all the controls of the layout
     list<LayeredControl>::const_iterator iter;
+    list<LayeredControl>::const_iterator iterVideo = m_controlList.end();
     for( iter = m_controlList.begin(); iter != m_controlList.end(); iter++ )
     {
         CtrlGeneric *pCtrl = (*iter).m_pControl;
@@ -207,6 +208,10 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
         if( pCtrl->isVisible() && pPos )
         {
             pCtrl->draw( *m_pImage, pPos->getLeft(), pPos->getTop() );
+            // Remember the video control (we assume there is at most one video
+            // control per layout)
+            if( pCtrl->getType() == "video" && pCtrl->getPosition() )
+                iterVideo = iter;
         }
     }
 
@@ -224,7 +229,40 @@ void GenericLayout::refreshRect( int x, int y, int width, int height )
         if( y + height > m_height )
             height = m_height - y;
 
-        pWindow->refresh( x, y, width, height );
+        // Refresh the window... but do not paint on a video control!
+        if( iterVideo == m_controlList.end() )
+        {
+            // No video control, we can safely repain the rectangle
+            pWindow->refresh( x, y, width, height );
+        }
+        else
+        {
+            // Bad luck, there is a video control somewhere (not necessarily
+            // in the repainting zone, btw).
+            // We will divide the repainting into 4 regions (top, left, bottom
+            // and right). The overlapping parts (i.e. the corners) of these
+            // regions will be painted twice, because otherwise the algorithm
+            // becomes a real mess :)
+
+            // Use short variable names for convenience
+            int xx = iterVideo->m_pControl->getPosition()->getLeft();
+            int yy = iterVideo->m_pControl->getPosition()->getTop();
+            int ww = iterVideo->m_pControl->getPosition()->getWidth();
+            int hh = iterVideo->m_pControl->getPosition()->getHeight();
+
+            // Top part:
+            if( y < yy )
+                pWindow->refresh( x, y, width, yy - y );
+            // Left part:
+            if( x < xx )
+                pWindow->refresh( x, y, xx - x, height );
+            // Bottom part
+            if( y + height > yy + hh )
+                pWindow->refresh( x, yy + hh, width, y + height - (yy + hh) );
+            // Right part
+            if( x + width > xx + ww )
+                pWindow->refresh( xx + ww, y, x + width - (xx + ww), height );
+        }
     }
 }
 
index 07be198388283aa4fb5a00724eb3751303047f21..41daec7be57c4c4ccc5c94224402d4901b505d90 100644 (file)
@@ -75,6 +75,9 @@ class GenericLayout: public SkinObject, public Box
         /// Refresh the window
         virtual void refreshAll();
 
+        /// Refresh a rectangular portion of the window
+        virtual void refreshRect( int x, int y, int width, int height );
+
         /// Get the image of the layout
         virtual OSGraphics *getImage() const { return m_pImage; }
 
@@ -119,9 +122,6 @@ class GenericLayout: public SkinObject, public Box
         virtual void addAnchor( Anchor *pAnchor );
 
     private:
-        /// Refresh a rectangular portion of the window
-        void GenericLayout::refreshRect( int x, int y, int width, int height );
-
         /// Parent window of the layout
         TopWindow *m_pWindow;
         /// Layout size
index f1627c90004c225c0b4683fdf9f2c7e10dd3e97e..f5f2e6076c577795a386d521d224a0deaa32cbfc 100644 (file)
@@ -32,6 +32,7 @@
 #include "../commands/cmd_on_top.hpp"
 #include "../commands/cmd_dialogs.hpp"
 #include "../controls/ctrl_generic.hpp"
+#include "../events/evt_refresh.hpp"
 #include "../events/evt_enter.hpp"
 #include "../events/evt_focus.hpp"
 #include "../events/evt_leave.hpp"
@@ -67,6 +68,24 @@ TopWindow::~TopWindow()
 }
 
 
+void TopWindow::processEvent( EvtRefresh &rEvtRefresh )
+{
+    // We override the behaviour defined in GenericWindow, because we don't
+    // want to draw on a video control!
+    if( m_pActiveLayout == NULL )
+    {
+        GenericWindow::processEvent( rEvtRefresh );
+    }
+    else
+    {
+        m_pActiveLayout->refreshRect( rEvtRefresh.getXStart(),
+                                      rEvtRefresh.getYStart(),
+                                      rEvtRefresh.getWidth(),
+                                      rEvtRefresh.getHeight() );
+    }
+}
+
+
 void TopWindow::processEvent( EvtFocus &rEvtFocus )
 {
 //    fprintf(stderr, rEvtFocus.getAsString().c_str()) ;
index b4caf04aee365044257099fdcf73eeae6b16c8ba..8850ac3913d59792dab8d58d8f765c4ffcd2d430 100644 (file)
@@ -48,6 +48,7 @@ class TopWindow: public GenericWindow
         virtual ~TopWindow();
 
         /// Methods to process OS events.
+        virtual void processEvent( EvtRefresh &rEvtRefresh );
         virtual void processEvent( EvtFocus &rEvtFocus );
         virtual void processEvent( EvtMotion &rEvtMotion );
         virtual void processEvent( EvtMouse &rEvtMouse );
index 6e9163a625f5b28a7123b47e210a9d6c021141a0..b43cf8b51cc1234d156df7e3d41f8ec7e1f30ecc 100755 (executable)
@@ -65,6 +65,9 @@ class VlcProc: public SkinObject
         /// Set the vout window handle
         void setVoutWindow( void *pVoutWindow );
 
+        /// Indicate whether the embedded video output is currently used
+        bool isVoutUsed() const { return m_pVout; }
+
     protected:
         // Protected because it is a singleton
         VlcProc( intf_thread_t *pIntf );
@@ -92,7 +95,7 @@ class VlcProc: public SkinObject
         VariablePtr m_cVarStopped;
         VariablePtr m_cVarPaused;
         VariablePtr m_cVarSeekable;
-        /// Vout window hanlde
+        /// Vout window handle
         void *m_pVoutWindow;
         /// Vout thread
         vout_thread_t *m_pVout;
index d394bb3821a2edbd35da981b405d02583ea0e340..9a237b4f588c542a2d74651f7c107f2ac6208b04 100644 (file)
@@ -22,6 +22,7 @@
  *****************************************************************************/
 
 #include "vout_window.hpp"
+#include "vlcproc.hpp"
 #include "os_factory.hpp"
 #include "os_graphics.hpp"
 #include "os_window.hpp"
@@ -69,7 +70,14 @@ void VoutWindow::refresh( int left, int top, int width, int height )
 {
     if( m_pImage )
     {
-        m_pImage->copyToWindow( *getOSWindow(), left, top, width, height, left,
-                                top );
+        // Get the VlcProc
+        VlcProc *pVlcProc = getIntf()->p_sys->p_vlcProc;
+
+        // Refresh only when there is no video!
+        if( pVlcProc && !pVlcProc->isVoutUsed() )
+        {
+            m_pImage->copyToWindow( *getOSWindow(), left, top,
+                                    width, height, left, top );
+        }
     }
 }
index 229c1968bcb0c84b0cb1d0d6f2896b82f6e84963..4b50fd07b07e20d376fdeff67a6508183d42eec8 100755 (executable)
@@ -129,12 +129,7 @@ void Win32Loop::run()
                                 Infos.rcPaint.right - Infos.rcPaint.left + 1,
                                 Infos.rcPaint.bottom - Infos.rcPaint.top + 1 );
                 EndPaint( msg.hwnd, &Infos );
-                // Ignore all the painting events for the vout window,
-                // otherwise we are going to screw up the colorkey
-                if( win.getType() != "Vout" )
-                {
-                    win.processEvent( evt );
-                }
+                win.processEvent( evt );
                 break;
             }
             case WM_MOUSEMOVE: