]> git.sesse.net Git - vlc/commitdiff
* all: first implementation of skinnable vouts (X11 only)
authorCyril Deguet <asmax@videolan.org>
Sat, 13 Mar 2004 22:11:28 +0000 (22:11 +0000)
committerCyril Deguet <asmax@videolan.org>
Sat, 13 Mar 2004 22:11:28 +0000 (22:11 +0000)
  - new "Video" element in the XML
  - of course it doesn't work if the vout is launched before
    the interface
  - known bugs:
     - no refresh of the area when there is no vout
     - BadDrawable X11 error at exit because the vout still uses
      a destroyed window
     - hardcoded size

26 files changed:
modules/gui/skins2/Modules.am
modules/gui/skins2/parser/builder.cpp
modules/gui/skins2/parser/builder.hpp
modules/gui/skins2/parser/builder_data.def
modules/gui/skins2/parser/builder_data.hpp
modules/gui/skins2/parser/gen_builder.py
modules/gui/skins2/parser/skin_parser.cpp
modules/gui/skins2/src/generic_window.cpp
modules/gui/skins2/src/generic_window.hpp
modules/gui/skins2/src/os_factory.hpp
modules/gui/skins2/src/theme.cpp
modules/gui/skins2/src/theme.hpp
modules/gui/skins2/src/theme_loader.cpp
modules/gui/skins2/src/vout_window.cpp [new file with mode: 0644]
modules/gui/skins2/src/vout_window.hpp [new file with mode: 0644]
modules/gui/skins2/theme/skin.dtd
modules/gui/skins2/theme/theme.xml
modules/gui/skins2/theme/vout.png [new file with mode: 0644]
modules/gui/skins2/win32/win32_factory.hpp
modules/gui/skins2/x11/x11_display.cpp
modules/gui/skins2/x11/x11_display.hpp
modules/gui/skins2/x11/x11_factory.cpp
modules/gui/skins2/x11/x11_factory.hpp
modules/gui/skins2/x11/x11_graphics.cpp
modules/gui/skins2/x11/x11_window.cpp
modules/gui/skins2/x11/x11_window.hpp

index 79cbf9df11db4b4da5e52a933809cb91d7e5dcaa..c3f6691cf4983f779972fc10a298f6ebd430dc50 100644 (file)
@@ -114,6 +114,8 @@ SOURCES_skins2 = \
        src/var_manager.hpp \
        src/vlcproc.cpp \
        src/vlcproc.hpp \
+       src/vout_window.cpp \
+       src/vout_window.hpp \
        src/window_manager.cpp \
        src/window_manager.hpp \
        \
index 017f664729faa752c7cebfc3206cb24a1eb26cc3..2e6e6be9383896b6bf2a4231b7ca989900dfc2bc 100755 (executable)
@@ -30,6 +30,7 @@
 #include "../src/os_factory.hpp"
 #include "../src/generic_bitmap.hpp"
 #include "../src/generic_window.hpp"
+#include "../src/vout_window.hpp"
 #include "../src/anchor.hpp"
 #include "../src/ft2_font.hpp"
 #include "../src/theme.hpp"
@@ -91,6 +92,7 @@ Theme *Builder::build()
     ADD_OBJECTS( RadialSlider );
     ADD_OBJECTS( Slider );
     ADD_OBJECTS( List );
+    ADD_OBJECTS( Video );
 
     return m_pTheme;
 }
@@ -558,6 +560,22 @@ void Builder::addList( const BuilderData::List &rData )
 }
 
 
+void Builder::addVideo( const BuilderData::Video &rData )
+{
+    GenericWindow *pWindow = m_pTheme->m_windows[rData.m_windowId].get();
+    if( pWindow == NULL )
+    {
+        msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
+        return;
+    }
+
+    VoutWindow *pVout = new VoutWindow( getIntf(), rData.m_xPos,
+            rData.m_yPos, m_pTheme->getWindowManager(), false, false,
+            *pWindow );
+    m_pTheme->m_vouts.push_back( VoutWindowPtr( pVout ) );
+}
+
+
 const Position Builder::makePosition( const string &rLeftTop,
                                       const string &rRightBottom,
                                       int xPos, int yPos, int width,
index 571f6b7795cc25056405e3c455b41dba5fb5d0d9..41658dfdc363392c967ccb1627f98b69bd3adcdb 100644 (file)
@@ -2,7 +2,7 @@
  * builder.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: builder.hpp,v 1.4 2004/03/01 18:33:31 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -76,6 +76,7 @@ class Builder: public SkinObject
         void addRadialSlider( const BuilderData::RadialSlider &rData );
         void addSlider( const BuilderData::Slider &rData );
         void addList( const BuilderData::List &rData );
+        void addVideo( const BuilderData::Video &rData );
 
        /// Compute the position of a control
         const Position makePosition( const string &rLeftTop,
index 7c89ba28a72fcbae26c6c01222d93190c41ea2b0..de495f88879253a335b3f7ab29a439d13357f937 100644 (file)
@@ -11,3 +11,4 @@ Text id:string xPos:int yPos:int fontId:string text:string width:int color:uint3
 RadialSlider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string sequence:string nbImages:int minAngle:float maxAngle:float value:string tooltip:string help:string layer:int windowId:string layoutId:string
 Slider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string upId:string downId:string overId:string points:string thickness:int value:string tooltip:string help:string layer:int windowId:string layoutId:string
 List id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string fontId:string var:string fgColor:uint32_t playColor:uint32_t bgColor1:uint32_t bgColor2:uint32_t selColor:uint32_t help:string layer:int windowId:string layoutId:string
+Video id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string visible:bool help:string layer:int windowId:string layoutId:string
index 4c893e7fda5d76c7051b3a5ed0e791c48de423aa..31beb43c18f92d4b0bd512a72de452e617dff95f 100644 (file)
@@ -307,6 +307,28 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height )
     /// List
     list<List> m_listList;
 
+    /// Type definition
+    struct Video
+    {
+        Video( const string & id, int xPos, int yPos, int width, int height, const string & leftTop, const string & rightBottom, bool visible, const string & help, int layer, const string & windowId, const string & layoutId ):
+m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_visible( visible ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
+
+        const string m_id;
+        int m_xPos;
+        int m_yPos;
+        int m_width;
+        int m_height;
+        const string m_leftTop;
+        const string m_rightBottom;
+        bool m_visible;
+        const string m_help;
+        int m_layer;
+        const string m_windowId;
+        const string m_layoutId;
+    };
+    /// List
+    list<Video> m_listVideo;
+
 
 };
 
index 5bf3c8c3b20ad164ee9855d8a606da52967dbf18..767fbfd5ab8b787a8da91e2c002821aad3995243 100755 (executable)
@@ -15,7 +15,7 @@ hppfile.write(
  * builder_data.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gen_builder.py,v 1.2 2004/03/02 21:45:15 ipkiss Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
index 7c8ea53e632aa6b573c18095824743577229a4ec..bb54b7b7f70fcbc60672cf81b1b922470d9c8049 100644 (file)
@@ -192,6 +192,18 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
                   attr["author"] );
     }
 
+    else if( rName == "Video" )
+    {
+        const BuilderData::Video videoData( uniqueId( attr["id"] ),
+                atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
+                atoi( attr["width"] ), atoi( attr["height" ]),
+                attr["lefttop"], attr["rightbottom"],
+                ConvertBoolean( attr["visible"] ), attr["help"], m_curLayer,
+                m_curWindowId, m_curLayoutId );
+        m_curLayer++;
+        m_data.m_listVideo.push_back( videoData );
+    }
+
     else if( rName == "Window" )
     {
         m_curWindowId = uniqueId( attr["id"] );
index a203e784c062e3793d4af7df6add3fa14567ed5b..1f9e2912dbf5a0f541637cac7f079e70aa4fb3c7 100644 (file)
 
 GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
                               WindowManager &rWindowManager,
-                              bool dragDrop, bool playOnDrop ):
+                              bool dragDrop, bool playOnDrop,
+                              GenericWindow *pParent ):
     SkinObject( pIntf ), m_rWindowManager( rWindowManager ),
     m_left( left ), m_top( top ), m_width( 0 ), m_height( 0 ),
-    m_pActiveLayout( NULL ), m_pLastHitControl( NULL ),
+    m_isChild( true ), m_pActiveLayout( NULL ), m_pLastHitControl( NULL ),
     m_pCapturingControl( NULL ), m_pFocusControl( NULL ), m_varVisible( pIntf ),
     m_currModifier( 0 )
 {
-    // Register as a moving window
-    m_rWindowManager.registerWindow( *this );
-
-    // Get the OSFactory
+   // Get the OSFactory
     OSFactory *pOsFactory = OSFactory::instance( getIntf() );
 
+    // Get the parent OSWindow, if any
+    OSWindow *pOSParent = NULL;
+    if( pParent )
+    {
+        pOSParent = pParent->m_pOsWindow;
+    }
+
     // Create an OSWindow to handle OS specific processing
-    m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop );
+    m_pOsWindow = pOsFactory->createOSWindow( *this, dragDrop, playOnDrop,
+                                              pOSParent );
+
+    // Child windows don't need that
+    if( !pParent )
+    {
+        m_isChild = false;
+        // Register as a moving window
+        m_rWindowManager.registerWindow( *this );
+    }
 
     // Observe the visibility variable
     m_varVisible.addObserver( this );
@@ -72,9 +86,12 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
 
 GenericWindow::~GenericWindow()
 {
+    if( !m_isChild )
+    {
+        // Unregister from the window manager
+        m_rWindowManager.unregisterWindow( *this );
+    }
     m_varVisible.delObserver( this );
-    // Unregister from the window manager
-    m_rWindowManager.unregisterWindow( *this );
 
     if( m_pOsWindow )
     {
index e36dc7e2694b5fba87372b7214d0a9c6223ea4f0..54776f98798623ba634c7dd17fa3c6d0da0d9162 100644 (file)
@@ -52,7 +52,8 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
     public:
         GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
                        WindowManager &rWindowManager,
-                       bool dragDrop, bool playOnDrop );
+                       bool dragDrop, bool playOnDrop,
+                       GenericWindow *pParent = NULL );
         virtual ~GenericWindow();
 
         /// Methods to process OS events.
@@ -126,6 +127,8 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
         WindowManager &m_rWindowManager;
         /// Window position and size
         int m_left, m_top, m_width, m_height;
+        /// Flag set if the window has a parent
+        bool m_isChild;
         /// OS specific implementation
         OSWindow *m_pOsWindow;
         /// Current active layout of the window
index 9bcb039484736d615f27c10e759d3d6e52c38732..bd78d23f011723ad4f473e8748a7fb8e9efdab06 100644 (file)
@@ -76,7 +76,8 @@ class OSFactory: public SkinObject
 
         /// Instantiate an object OSWindow.
         virtual OSWindow *createOSWindow( GenericWindow &rWindow,
-                                          bool dragDrop, bool playOnDrop ) = 0;
+                                          bool dragDrop, bool playOnDrop,
+                                          OSWindow *pParent ) = 0;
 
         /// Instantiate an object OSTooltip.
         virtual OSTooltip *createOSTooltip() = 0;
index 204ef8bdb888132c1e9599674fc985ae2860d29f..90cbf6ddf6a7ad0352cb8a69d224dd8182b534c3 100755 (executable)
@@ -2,7 +2,7 @@
  * theme.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: theme.cpp,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>
@@ -30,6 +30,7 @@ Theme::~Theme()
     saveConfig();
 
     // Be sure things are destroyed in the right order (XXX check)
+    m_vouts.clear();
     m_layouts.clear();
     m_controls.clear();
     m_windows.clear();
index b932d764d62627430ac2953004b6d74354d1f2f3..f3ae060a72151c5a996f926a42a4be3ab5cb3dc0 100755 (executable)
@@ -2,7 +2,7 @@
  * theme.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: theme.hpp,v 1.3 2004/02/01 16:15:40 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -27,7 +27,7 @@
 
 #include "../src/generic_bitmap.hpp"
 #include "../src/generic_font.hpp"
-#include "../src/generic_window.hpp"
+#include "../src/vout_window.hpp"
 #include "../src/generic_layout.hpp"
 #include "../src/window_manager.hpp"
 #include "../commands/cmd_generic.hpp"
@@ -77,6 +77,8 @@ class Theme: public SkinObject
         list<BezierPtr> m_curves;
         /// Store the variables
         list<VariablePtr> m_vars;
+        /// Store the vout windows
+        list<VoutWindowPtr> m_vouts;
 
     private:
         WindowManager m_windowManager;
index f3acd4b1fad3b37b5d43e2dd5d0899d16b68a4c1..56563ed8f1c555d7fe9ac917b0620b78f8541741 100755 (executable)
@@ -28,6 +28,7 @@
 #include "../parser/skin_parser.hpp"
 #include "../src/os_factory.hpp"
 #include "../src/window_manager.hpp"
+#include "../src/vout_window.hpp"
 
 #include <fcntl.h>
 #if !defined( WIN32 )
@@ -88,6 +89,15 @@ bool ThemeLoader::load( const string &fileName )
         pNewTheme->getWindowManager().showAll();
     }
 
+    // XXX show the vout window
+    list<VoutWindowPtr> &vouts = getIntf()->p_sys->p_theme->m_vouts;
+    if (vouts.size() > 0)
+    {
+        VoutWindow *pVout = (vouts.back()).get();
+        // XXX hardcoded
+        pVout->resize(350,220);
+        pVout->show();
+    }
     return true;
 }
 
diff --git a/modules/gui/skins2/src/vout_window.cpp b/modules/gui/skins2/src/vout_window.cpp
new file mode 100644 (file)
index 0000000..c5f910d
--- /dev/null
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * vout_window.cpp
+ *****************************************************************************
+ * Copyright (C) 2003 VideoLAN
+ * $Id$
+ *
+ * Authors: Cyril Deguet     <asmax@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#include "vout_window.hpp"
+#include "os_factory.hpp"
+#include "os_window.hpp"
+
+
+VoutWindow::VoutWindow( intf_thread_t *pIntf, int left, int top,
+                        WindowManager &rWindowManager,
+                        bool dragDrop, bool playOnDrop, GenericWindow &rParent ):
+    GenericWindow( pIntf, left, top, rWindowManager, dragDrop, playOnDrop,
+                   &rParent )
+{
+}
+
+
+VoutWindow::~VoutWindow()
+{
+    // XXX we should stop the vout before destroying the window!
+}
+
diff --git a/modules/gui/skins2/src/vout_window.hpp b/modules/gui/skins2/src/vout_window.hpp
new file mode 100644 (file)
index 0000000..4a98d87
--- /dev/null
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * vout_window.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 VideoLAN
+ * $Id$
+ *
+ * Authors: Cyril Deguet     <asmax@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef VOUT_WINDOW_HPP
+#define VOUT_WINDOW_HPP
+
+#include "generic_window.hpp"
+
+
+/// Class to handle a video output window
+class VoutWindow: public GenericWindow
+{
+    public:
+        VoutWindow( intf_thread_t *pIntf, int xPos, int yPos,
+                    WindowManager &rWindowManager,
+                    bool dragDrop, bool playOnDrop, GenericWindow &rParent );
+        virtual ~VoutWindow();
+};
+
+typedef CountedPtr<VoutWindow> VoutWindowPtr;
+
+#endif
index efe40b543edc6397739a8943f797563720d8999e..bfa378d3ed76f72f9dd6b5e04c81402f6e64a935 100644 (file)
@@ -55,7 +55,7 @@
         maxheight   CDATA   "-1"
     >
 <!ELEMENT Group (Group|Image|Button|Playlist|Slider|RadialSlider|Text|CheckBox|
-                 Anchor)+>
+                 Anchor|Video)+>
     <!ATTLIST Group
         x           CDATA   "0"
         y           CDATA   "0"
         selcolor    CDATA   "#0000FF"
         help        CDATA   ""
     >
+<!ELEMENT Video EMPTY>
+    <!ATTLIST Video
+        id          CDATA   "none"
+        visible     CDATA   "true"
+        x           CDATA   "0"
+        y           CDATA   "0"
+        width       CDATA   "0"
+        height      CDATA   "0"
+        lefttop     CDATA   "lefttop"
+        rightbottom CDATA   "lefttop"
+        help        CDATA   ""
+    >
index 3a80caf919aeed7dd368dc14c9ba03080706a125..0b0852bc0492f61e597ac2661fe7915a48f2e0ac 100644 (file)
@@ -61,6 +61,8 @@
   <Bitmap id="stop_disabled" file="stop_disabled.png" alphacolor="#FF0000"/>
   <Bitmap id="stop_onclick" file="stop_onclick.png" alphacolor="#FF0000"/>
   <Bitmap id="volume_radial" file="volume.png" alphacolor="#FF0000"/>
+  <Bitmap id="vout" file="vout.png" alphacolor="#FF0000"/>
+
   <Font id="default_font" font="FreeSansBold.ttf" size="15"/> 
   <Font id="playlist_font" font="FreeSansBold.ttf" size="12"/> 
 
     </Group>
    </Layout>
   </Window>
+
+  <Window x="10" y="10" dragdrop="false">
+    <Layout width="410" height="250">
+      <Group x="0" y="0">
+        <Image x="0" y="0" image="vout" action="move"/>
+        <Video x="15" y="13" width="350" height="220"/>
+      </Group>
+   </Layout>
+  </Window>
+
 </Theme>
 
diff --git a/modules/gui/skins2/theme/vout.png b/modules/gui/skins2/theme/vout.png
new file mode 100644 (file)
index 0000000..e684b78
Binary files /dev/null and b/modules/gui/skins2/theme/vout.png differ
index 526929a19a492067f5890a0b1616b0e44e012a40..c5b11c6ef278f33b4c2e6dc84ff751079e68a1cd 100644 (file)
@@ -58,7 +58,8 @@ class Win32Factory: public OSFactory
 
         /// Instantiate an OSWindow object
         virtual OSWindow *createOSWindow( GenericWindow &rWindow,
-                                          bool dragDrop, bool playOnDrop );
+                                          bool dragDrop, bool playOnDrop,
+                                          OSWindow *pParent );
 
         /// Instantiate an object OSTooltip.
         virtual OSTooltip *createOSTooltip();
index 926ce17d66ea0025ce505e9e36cd23eac0a57ec2..6dea87605f1964abfa807ef65a0ee8028b6b5ae5 100644 (file)
@@ -2,7 +2,7 @@
  * x11_display.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_display.cpp,v 1.4 2004/01/25 18:46:37 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -36,6 +36,7 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
 {
     // Open a connection to the X Server
     m_pDisplay = XOpenDisplay( NULL );
+
     if( m_pDisplay == NULL )
     {
         MSG_ERR( "Cannot open display" );
index 26c178a945062526e7977d7365b811c2a9469ca5..5e44ac23036afbe9adc6ed17694d4600305e5b04 100644 (file)
@@ -2,7 +2,7 @@
  * x11_display.hpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_display.hpp,v 1.2 2004/01/25 18:41:08 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -68,6 +68,9 @@ class X11Display: public SkinObject
         /// Get the pixel value corresponding to the given colors
         unsigned long getPixelValue( uint8_t r, uint8_t g, uint8_t b ) const;
 
+        //XXX
+        Window m_voutWindow;
+
     private:
         /// Display parameters
         Display *m_pDisplay;
index ac3473aa8aa74d8ce40ef8f56caa158d5e35de6a..e4a7b6c589d13c567900492886ee8ba355bef95a 100644 (file)
@@ -2,7 +2,7 @@
  * x11_factory.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_factory.cpp,v 1.2 2004/01/25 13:59:33 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -98,10 +98,10 @@ OSTimer *X11Factory::createOSTimer( const Callback &rCallback )
 
 
 OSWindow *X11Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop,
-                                      bool playOnDrop )
+                                      bool playOnDrop, OSWindow *pParent )
 {
     return new X11Window( getIntf(), rWindow, *m_pDisplay, dragDrop,
-                          playOnDrop );
+                          playOnDrop, (X11Window*)pParent );
 }
 
 
index b3cfd0c600e5632adad021293509767b1f2140fd..41805fbe0bdb1deb4c75c33d0f6f54fb0ec26830 100644 (file)
@@ -64,7 +64,8 @@ class X11Factory: public OSFactory
 
         /// Instantiate an OSWindow object
         virtual OSWindow *createOSWindow( GenericWindow &rWindow,
-                                          bool dragDrop, bool playOnDrop );
+                                          bool dragDrop, bool playOnDrop,
+                                          OSWindow *pParent );
 
         /// Instantiate an object OSTooltip.
         virtual OSTooltip *createOSTooltip();
index c75c7a068838947c789c58a024faaef539e0750c..9296b03e5a511c2dc51d3d72202dee8620da2492 100644 (file)
@@ -2,7 +2,7 @@
  * x11_graphics.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_graphics.cpp,v 1.2 2004/01/25 18:41:08 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -53,7 +53,6 @@ X11Graphics::X11Graphics( intf_thread_t *pIntf, X11Display &rDisplay,
     XGCValues xgcvalues;
     xgcvalues.graphics_exposures = False;
     m_gc = XCreateGC( XDISPLAY, m_pixmap, GCGraphicsExposures, &xgcvalues );
-
 }
 
 
index 9b2a286235a8be3bd5884aa5edb46221fce9c81e..e2c10f1bb9722a4b56eb9d8284383e72382df3de 100644 (file)
 
 
 X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
-                      X11Display &rDisplay, bool dragDrop, bool playOnDrop ):
+                      X11Display &rDisplay, bool dragDrop, bool playOnDrop,
+                      X11Window *pParentWindow ):
     OSWindow( pIntf ), m_rDisplay( rDisplay ), m_dragDrop( dragDrop )
 {
-    Window root = DefaultRootWindow( XDISPLAY );
+    Window parent;
+    if (pParentWindow)
+    {
+        parent = pParentWindow->m_wnd;
+    }
+    else
+    {
+        parent = DefaultRootWindow( XDISPLAY );
+    }
     XSetWindowAttributes attr;
 
     // Create the window
-    m_wnd = XCreateWindow( XDISPLAY, root, 0, 0, 1, 1, 0, 0,
+    m_wnd = XCreateWindow( XDISPLAY, parent, 0, 0, 1, 1, 0, 0,
                            InputOutput, CopyFromParent, 0, &attr );
 
     // Set the colormap for 8bpp mode
@@ -52,9 +61,9 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
     }
 
     // Select events received by the window
-    XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|PointerMotionMask|
-                  ButtonPressMask|ButtonReleaseMask|LeaveWindowMask|
-                  FocusChangeMask );
+    XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|
+                  PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
+                  LeaveWindowMask|FocusChangeMask );
 
     // Store a pointer on the generic window in a map
     X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
@@ -94,6 +103,14 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
 
     // Change the window title XXX
     XStoreName( XDISPLAY, m_wnd, "VLC" );
+
+    // XXX Kludge to tell VLC that this window is the vout
+    if (pParentWindow)
+    {
+        vlc_value_t value;
+        value.i_int = (int) (ptrdiff_t) (void *) m_wnd;
+        var_Set( getIntf()->p_vlc, "drawable", value );
+    }
 }
 
 
index f78c429e5f87033f5fd38f7423856a1e0ba6017c..de7b920ce556febec79406985bb996b3f30e3463 100644 (file)
@@ -38,7 +38,8 @@ class X11Window: public OSWindow
 {
     public:
         X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
-                   X11Display &rDisplay, bool dragDrop, bool playOnDrop );
+                   X11Display &rDisplay, bool dragDrop, bool playOnDrop,
+                   X11Window *pParentWindow );
 
         virtual ~X11Window();