Commit 6351e9c9 authored by Cyril Deguet's avatar Cyril Deguet

* all: first implementation of skinnable vouts (X11 only)

  - 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
parent 1e81c8f9
...@@ -114,6 +114,8 @@ SOURCES_skins2 = \ ...@@ -114,6 +114,8 @@ SOURCES_skins2 = \
src/var_manager.hpp \ src/var_manager.hpp \
src/vlcproc.cpp \ src/vlcproc.cpp \
src/vlcproc.hpp \ src/vlcproc.hpp \
src/vout_window.cpp \
src/vout_window.hpp \
src/window_manager.cpp \ src/window_manager.cpp \
src/window_manager.hpp \ src/window_manager.hpp \
\ \
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "../src/os_factory.hpp" #include "../src/os_factory.hpp"
#include "../src/generic_bitmap.hpp" #include "../src/generic_bitmap.hpp"
#include "../src/generic_window.hpp" #include "../src/generic_window.hpp"
#include "../src/vout_window.hpp"
#include "../src/anchor.hpp" #include "../src/anchor.hpp"
#include "../src/ft2_font.hpp" #include "../src/ft2_font.hpp"
#include "../src/theme.hpp" #include "../src/theme.hpp"
...@@ -91,6 +92,7 @@ Theme *Builder::build() ...@@ -91,6 +92,7 @@ Theme *Builder::build()
ADD_OBJECTS( RadialSlider ); ADD_OBJECTS( RadialSlider );
ADD_OBJECTS( Slider ); ADD_OBJECTS( Slider );
ADD_OBJECTS( List ); ADD_OBJECTS( List );
ADD_OBJECTS( Video );
return m_pTheme; return m_pTheme;
} }
...@@ -558,6 +560,22 @@ void Builder::addList( const BuilderData::List &rData ) ...@@ -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 Position Builder::makePosition( const string &rLeftTop,
const string &rRightBottom, const string &rRightBottom,
int xPos, int yPos, int width, int xPos, int yPos, int width,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* builder.hpp * builder.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -76,6 +76,7 @@ class Builder: public SkinObject ...@@ -76,6 +76,7 @@ class Builder: public SkinObject
void addRadialSlider( const BuilderData::RadialSlider &rData ); void addRadialSlider( const BuilderData::RadialSlider &rData );
void addSlider( const BuilderData::Slider &rData ); void addSlider( const BuilderData::Slider &rData );
void addList( const BuilderData::List &rData ); void addList( const BuilderData::List &rData );
void addVideo( const BuilderData::Video &rData );
/// Compute the position of a control /// Compute the position of a control
const Position makePosition( const string &rLeftTop, const Position makePosition( const string &rLeftTop,
......
...@@ -11,3 +11,4 @@ Text id:string xPos:int yPos:int fontId:string text:string width:int color:uint3 ...@@ -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 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 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 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
...@@ -307,6 +307,28 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height ) ...@@ -307,6 +307,28 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height )
/// List /// List
list<List> m_listList; 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;
}; };
......
...@@ -15,7 +15,7 @@ hppfile.write( ...@@ -15,7 +15,7 @@ hppfile.write(
* builder_data.hpp * builder_data.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
......
...@@ -192,6 +192,18 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr ) ...@@ -192,6 +192,18 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
attr["author"] ); 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" ) else if( rName == "Window" )
{ {
m_curWindowId = uniqueId( attr["id"] ); m_curWindowId = uniqueId( attr["id"] );
......
...@@ -49,21 +49,35 @@ ...@@ -49,21 +49,35 @@
GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top, GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
WindowManager &rWindowManager, WindowManager &rWindowManager,
bool dragDrop, bool playOnDrop ): bool dragDrop, bool playOnDrop,
GenericWindow *pParent ):
SkinObject( pIntf ), m_rWindowManager( rWindowManager ), SkinObject( pIntf ), m_rWindowManager( rWindowManager ),
m_left( left ), m_top( top ), m_width( 0 ), m_height( 0 ), 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_pCapturingControl( NULL ), m_pFocusControl( NULL ), m_varVisible( pIntf ),
m_currModifier( 0 ) m_currModifier( 0 )
{ {
// Register as a moving window // Get the OSFactory
m_rWindowManager.registerWindow( *this );
// Get the OSFactory
OSFactory *pOsFactory = OSFactory::instance( getIntf() ); 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 // 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 // Observe the visibility variable
m_varVisible.addObserver( this ); m_varVisible.addObserver( this );
...@@ -72,9 +86,12 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top, ...@@ -72,9 +86,12 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
GenericWindow::~GenericWindow() GenericWindow::~GenericWindow()
{ {
if( !m_isChild )
{
// Unregister from the window manager
m_rWindowManager.unregisterWindow( *this );
}
m_varVisible.delObserver( this ); m_varVisible.delObserver( this );
// Unregister from the window manager
m_rWindowManager.unregisterWindow( *this );
if( m_pOsWindow ) if( m_pOsWindow )
{ {
......
...@@ -52,7 +52,8 @@ class GenericWindow: public SkinObject, public Observer<VarBool> ...@@ -52,7 +52,8 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
public: public:
GenericWindow( intf_thread_t *pIntf, int xPos, int yPos, GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
WindowManager &rWindowManager, WindowManager &rWindowManager,
bool dragDrop, bool playOnDrop ); bool dragDrop, bool playOnDrop,
GenericWindow *pParent = NULL );
virtual ~GenericWindow(); virtual ~GenericWindow();
/// Methods to process OS events. /// Methods to process OS events.
...@@ -126,6 +127,8 @@ class GenericWindow: public SkinObject, public Observer<VarBool> ...@@ -126,6 +127,8 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
WindowManager &m_rWindowManager; WindowManager &m_rWindowManager;
/// Window position and size /// Window position and size
int m_left, m_top, m_width, m_height; int m_left, m_top, m_width, m_height;
/// Flag set if the window has a parent
bool m_isChild;
/// OS specific implementation /// OS specific implementation
OSWindow *m_pOsWindow; OSWindow *m_pOsWindow;
/// Current active layout of the window /// Current active layout of the window
......
...@@ -76,7 +76,8 @@ class OSFactory: public SkinObject ...@@ -76,7 +76,8 @@ class OSFactory: public SkinObject
/// Instantiate an object OSWindow. /// Instantiate an object OSWindow.
virtual OSWindow *createOSWindow( GenericWindow &rWindow, virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop ) = 0; bool dragDrop, bool playOnDrop,
OSWindow *pParent ) = 0;
/// Instantiate an object OSTooltip. /// Instantiate an object OSTooltip.
virtual OSTooltip *createOSTooltip() = 0; virtual OSTooltip *createOSTooltip() = 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* theme.cpp * theme.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -30,6 +30,7 @@ Theme::~Theme() ...@@ -30,6 +30,7 @@ Theme::~Theme()
saveConfig(); saveConfig();
// Be sure things are destroyed in the right order (XXX check) // Be sure things are destroyed in the right order (XXX check)
m_vouts.clear();
m_layouts.clear(); m_layouts.clear();
m_controls.clear(); m_controls.clear();
m_windows.clear(); m_windows.clear();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* theme.hpp * theme.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr> * Olivier Teulière <ipkiss@via.ecp.fr>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "../src/generic_bitmap.hpp" #include "../src/generic_bitmap.hpp"
#include "../src/generic_font.hpp" #include "../src/generic_font.hpp"
#include "../src/generic_window.hpp" #include "../src/vout_window.hpp"
#include "../src/generic_layout.hpp" #include "../src/generic_layout.hpp"
#include "../src/window_manager.hpp" #include "../src/window_manager.hpp"
#include "../commands/cmd_generic.hpp" #include "../commands/cmd_generic.hpp"
...@@ -77,6 +77,8 @@ class Theme: public SkinObject ...@@ -77,6 +77,8 @@ class Theme: public SkinObject
list<BezierPtr> m_curves; list<BezierPtr> m_curves;
/// Store the variables /// Store the variables
list<VariablePtr> m_vars; list<VariablePtr> m_vars;
/// Store the vout windows
list<VoutWindowPtr> m_vouts;
private: private:
WindowManager m_windowManager; WindowManager m_windowManager;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "../parser/skin_parser.hpp" #include "../parser/skin_parser.hpp"
#include "../src/os_factory.hpp" #include "../src/os_factory.hpp"
#include "../src/window_manager.hpp" #include "../src/window_manager.hpp"
#include "../src/vout_window.hpp"
#include <fcntl.h> #include <fcntl.h>
#if !defined( WIN32 ) #if !defined( WIN32 )
...@@ -88,6 +89,15 @@ bool ThemeLoader::load( const string &fileName ) ...@@ -88,6 +89,15 @@ bool ThemeLoader::load( const string &fileName )
pNewTheme->getWindowManager().showAll(); 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; return true;
} }
......
/*****************************************************************************
* 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!
}
/*****************************************************************************
* 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
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
maxheight CDATA "-1" maxheight CDATA "-1"
> >
<!ELEMENT Group (Group|Image|Button|Playlist|Slider|RadialSlider|Text|CheckBox| <!ELEMENT Group (Group|Image|Button|Playlist|Slider|RadialSlider|Text|CheckBox|
Anchor)+> Anchor|Video)+>
<!ATTLIST Group <!ATTLIST Group
x CDATA "0" x CDATA "0"
y CDATA "0" y CDATA "0"
...@@ -182,3 +182,15 @@ ...@@ -182,3 +182,15 @@
selcolor CDATA "#0000FF" selcolor CDATA "#0000FF"
help CDATA "" 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 ""
>
...@@ -61,6 +61,8 @@ ...@@ -61,6 +61,8 @@
<Bitmap id="stop_disabled" file="stop_disabled.png" alphacolor="#FF0000"/> <Bitmap id="stop_disabled" file="stop_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="stop_onclick" file="stop_onclick.png" alphacolor="#FF0000"/> <Bitmap id="stop_onclick" file="stop_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="volume_radial" file="volume.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="default_font" font="FreeSansBold.ttf" size="15"/>
<Font id="playlist_font" font="FreeSansBold.ttf" size="12"/> <Font id="playlist_font" font="FreeSansBold.ttf" size="12"/>
...@@ -116,5 +118,15 @@ ...@@ -116,5 +118,15 @@
</Group> </Group>
</Layout> </Layout>
</Window> </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> </Theme>
...@@ -58,7 +58,8 @@ class Win32Factory: public OSFactory ...@@ -58,7 +58,8 @@ class Win32Factory: public OSFactory
/// Instantiate an OSWindow object /// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow, virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop ); bool dragDrop, bool playOnDrop,
OSWindow *pParent );
/// Instantiate an object OSTooltip. /// Instantiate an object OSTooltip.
virtual OSTooltip *createOSTooltip(); virtual OSTooltip *createOSTooltip();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_display.cpp * x11_display.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -36,6 +36,7 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ), ...@@ -36,6 +36,7 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
{ {
// Open a connection to the X Server // Open a connection to the X Server
m_pDisplay = XOpenDisplay( NULL ); m_pDisplay = XOpenDisplay( NULL );
if( m_pDisplay == NULL ) if( m_pDisplay == NULL )
{ {
MSG_ERR( "Cannot open display" ); MSG_ERR( "Cannot open display" );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_display.hpp * x11_display.hpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -68,6 +68,9 @@ class X11Display: public SkinObject ...@@ -68,6 +68,9 @@ class X11Display: public SkinObject
/// Get the pixel value corresponding to the given colors /// Get the pixel value corresponding to the given colors
unsigned long getPixelValue( uint8_t r, uint8_t g, uint8_t b ) const; unsigned long getPixelValue( uint8_t r, uint8_t g, uint8_t b ) const;
//XXX
Window m_voutWindow;
private: private:
/// Display parameters /// Display parameters
Display *m_pDisplay; Display *m_pDisplay;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_factory.cpp * x11_factory.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -98,10 +98,10 @@ OSTimer *X11Factory::createOSTimer( const Callback &rCallback ) ...@@ -98,10 +98,10 @@ OSTimer *X11Factory::createOSTimer( const Callback &rCallback )
OSWindow *X11Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop, OSWindow *X11Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop,
bool playOnDrop ) bool playOnDrop, OSWindow *pParent )
{ {
return new X11Window( getIntf(), rWindow, *m_pDisplay, dragDrop, return new X11Window( getIntf(), rWindow, *m_pDisplay, dragDrop,
playOnDrop ); playOnDrop, (X11Window*)pParent );
} }
......
...@@ -64,7 +64,8 @@ class X11Factory: public OSFactory ...@@ -64,7 +64,8 @@ class X11Factory: public OSFactory
/// Instantiate an OSWindow object /// Instantiate an OSWindow object
virtual OSWindow *createOSWindow( GenericWindow &rWindow, virtual OSWindow *createOSWindow( GenericWindow &rWindow,
bool dragDrop, bool playOnDrop ); bool dragDrop, bool playOnDrop,
OSWindow *pParent );
/// Instantiate an object OSTooltip. /// Instantiate an object OSTooltip.
virtual OSTooltip *createOSTooltip(); virtual OSTooltip *createOSTooltip();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_graphics.cpp * x11_graphics.cpp
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -53,7 +53,6 @@ X11Graphics::X11Graphics( intf_thread_t *pIntf, X11Display &rDisplay, ...@@ -53,7 +53,6 @@ X11Graphics::X11Graphics( intf_thread_t *pIntf, X11Display &rDisplay,
XGCValues xgcvalues; XGCValues xgcvalues;
xgcvalues.graphics_exposures = False; xgcvalues.graphics_exposures = False;
m_gc = XCreateGC( XDISPLAY, m_pixmap, GCGraphicsExposures, &xgcvalues ); m_gc = XCreateGC( XDISPLAY, m_pixmap, GCGraphicsExposures, &xgcvalues );
} }
......
...@@ -35,14 +35,23 @@ ...@@ -35,14 +35,23 @@
X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, 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 ) 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; XSetWindowAttributes attr;
// Create the window // 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 ); InputOutput, CopyFromParent, 0, &attr );
// Set the colormap for 8bpp mode // Set the colormap for 8bpp mode
...@@ -52,9 +61,9 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, ...@@ -52,9 +61,9 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
} }
// Select events received by the window // Select events received by the window
XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|PointerMotionMask| XSelectInput( XDISPLAY, m_wnd, ExposureMask|KeyPressMask|
ButtonPressMask|ButtonReleaseMask|LeaveWindowMask| PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
FocusChangeMask ); LeaveWindowMask|FocusChangeMask );
// Store a pointer on the generic window in a map // Store a pointer on the generic window in a map
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() ); X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
...@@ -94,6 +103,14 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, ...@@ -94,6 +103,14 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
// Change the window title XXX // Change the window title XXX
XStoreName( XDISPLAY, m_wnd, "VLC" ); 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 );
}
} }
......
...@@ -38,7 +38,8 @@ class X11Window: public OSWindow ...@@ -38,7 +38,8 @@ class X11Window: public OSWindow
{ {
public: public:
X11Window( intf_thread_t *pIntf, GenericWindow &rWindow, X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
X11Display &rDisplay, bool dragDrop, bool playOnDrop ); X11Display &rDisplay, bool dragDrop, bool playOnDrop,
X11Window *pParentWindow );
virtual ~X11Window(); virtual ~X11Window();
......
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