Commit 2c45bce6 authored by Erwan Tulou's avatar Erwan Tulou

skins2: rework skins2 as a vout_window provider

  - remove the awkward global lock and serializer mechanism
  - adapt to latest module API (fix compil errors)
  - be more specific about hwnd or xid depending on port
  - set display.x11 on Linux port
parent 97be28c4
......@@ -33,8 +33,6 @@ SOURCES_skins2 = \
commands/cmd_quit.hpp \
commands/cmd_resize.cpp \
commands/cmd_resize.hpp \
commands/cmd_voutwindow.cpp \
commands/cmd_voutwindow.hpp \
commands/cmd_snapshot.cpp \
commands/cmd_snapshot.hpp \
commands/cmd_show_window.hpp \
......
......@@ -65,4 +65,78 @@ private:
void (VlcProc::*m_pfExecute)(vlc_object_t *,vlc_value_t);
};
class CmdExecuteBlock : public CmdGeneric
{
public:
CmdExecuteBlock( intf_thread_t* pIntf, vlc_object_t* obj,
void (*func) (intf_thread_t*, vlc_object_t* ) )
: CmdGeneric( pIntf), m_pObj( obj ), m_pfFunc( func ),
m_executing( false )
{
vlc_mutex_init( &m_lock );
vlc_cond_init( &m_wait );
if( m_pObj )
vlc_object_hold( m_pObj );
}
virtual ~CmdExecuteBlock()
{
if( m_pObj )
vlc_object_release( m_pObj );
vlc_cond_destroy( &m_wait );
vlc_mutex_destroy( &m_lock );
}
static void executeWait( const CmdGenericPtr& rcCommand )
{
CmdExecuteBlock& rCmd = (CmdExecuteBlock&)*rcCommand.get();
vlc_mutex_lock( &rCmd.m_lock );
if( !rCmd.m_pObj || !rCmd.m_pfFunc || rCmd.m_executing )
{
msg_Err( rCmd.getIntf(), "unexpected command call" );
vlc_mutex_unlock( &rCmd.m_lock );
return;
}
AsyncQueue *pQueue = AsyncQueue::instance( rCmd.getIntf() );
pQueue->push( rcCommand, false );
rCmd.m_executing = true;
while( rCmd.m_executing )
vlc_cond_wait( &rCmd.m_wait, &rCmd.m_lock );
vlc_mutex_unlock( &rCmd.m_lock );
}
virtual void execute()
{
vlc_mutex_lock( &m_lock );
if( !m_pObj || !m_pfFunc || !m_executing )
{
msg_Err( getIntf(), "unexpected command call" );
vlc_mutex_unlock( &m_lock );
return;
}
(*m_pfFunc)( getIntf(), m_pObj );
m_executing = false;
vlc_cond_signal( &m_wait );
vlc_mutex_unlock( &m_lock );
}
virtual string getType() const { return "CmdExecuteBlock"; }
private:
vlc_object_t* m_pObj;
void (*m_pfFunc)(intf_thread_t*, vlc_object_t*);
bool m_executing;
vlc_mutex_t m_lock;
vlc_cond_t m_wait;
};
#endif
/*****************************************************************************
* cmd_voutwindow.cpp
*****************************************************************************
* Copyright (C) 2009 the VideoLAN team
* $Id$
*
* Author: Erwan Tulou <erwan10 aT videolan doT org >
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "cmd_voutwindow.hpp"
#include "../src/vout_manager.hpp"
#include "../src/vout_window.hpp"
CmdNewVoutWindow::CmdNewVoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd )
: CmdGeneric( pIntf ), m_pWnd( pWnd ) { }
void CmdNewVoutWindow::execute()
{
intf_sys_t *p_sys = getIntf()->p_sys;
vlc_mutex_lock( &p_sys->vout_lock );
p_sys->handle = p_sys->p_voutManager->acceptWnd( m_pWnd );
p_sys->b_vout_ready = true;
vlc_cond_signal( &p_sys->vout_wait );
vlc_mutex_unlock( &p_sys->vout_lock );
}
CmdReleaseVoutWindow::CmdReleaseVoutWindow( intf_thread_t *pIntf,
vout_window_t* pWnd )
: CmdGeneric( pIntf ), m_pWnd( pWnd ) { }
void CmdReleaseVoutWindow::execute()
{
intf_sys_t *p_sys = getIntf()->p_sys;
vlc_mutex_lock( &p_sys->vout_lock );
p_sys->p_voutManager->releaseWnd( m_pWnd );
p_sys->b_vout_ready = true;
vlc_cond_signal( &p_sys->vout_wait );
vlc_mutex_unlock( &p_sys->vout_lock );
}
/*****************************************************************************
* cmd_voutwindow.hpp
*****************************************************************************
* Copyright (C) 2009 the VideoLAN team
* $Id$
*
* Author: Erwan Tulou <erwan10 aT videolan doT org >
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_VOUTWINDOW_HPP
#define CMD_VOUTWINDOW_HPP
#include "cmd_generic.hpp"
#include <vlc_vout_window.h>
/// Command to create a vout window
class CmdNewVoutWindow: public CmdGeneric
{
public:
/// Create a vout window
CmdNewVoutWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
virtual ~CmdNewVoutWindow() { }
virtual void execute();
virtual string getType() const { return "wnd_new"; }
private:
vout_window_t* m_pWnd;
};
/// Command to release a vout window
class CmdReleaseVoutWindow: public CmdGeneric
{
public:
/// Release a vout window
CmdReleaseVoutWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
virtual ~CmdReleaseVoutWindow() { }
virtual void execute();
virtual string getType() const { return "wnd_release"; }
private:
vout_window_t* m_pWnd;
};
#endif
......@@ -166,8 +166,7 @@ void GenericWindow::innerHide()
}
}
void* GenericWindow::getOSHandle() const
vlc_wnd_type GenericWindow::getOSHandle() const
{
return m_pOsWindow->getOSHandle();
}
......@@ -181,7 +180,7 @@ void GenericWindow::setParent( GenericWindow* pParent, int x, int y, int w, int
m_width = ( w > 0 ) ? w : m_width;
m_height = ( h > 0 ) ? h : m_height;
void* handle = pParent ? pParent->getOSHandle() : NULL;
vlc_wnd_type handle = pParent ? pParent->getOSHandle() : 0;
m_pOsWindow->reparent( handle, m_left, m_top, m_width, m_height );
}
......
......@@ -97,7 +97,7 @@ public:
virtual string getType() const { return "Generic"; }
/// windows handle
void* getOSHandle() const;
vlc_wnd_type getOSHandle() const;
/// reparent
void setParent( GenericWindow* pParent,
......
......@@ -132,6 +132,9 @@ public:
/// Delete a directory recursively
virtual void rmDir( const string &rPath ) = 0;
/// Get Display
virtual char* getDisplay() = 0;
protected:
// Protected because it's a singleton
OSFactory( intf_thread_t* pIntf ): SkinObject( pIntf ) { }
......
......@@ -57,10 +57,11 @@ public:
virtual void toggleOnTop( bool onTop ) const = 0;
/// getter for handler
virtual void* getOSHandle( ) const = 0;
virtual vlc_wnd_type getOSHandle( ) const = 0;
/// reparent the window
virtual void reparent( void* OSHandle, int x, int y, int w, int h ) = 0;
virtual void reparent( vlc_wnd_type OSHandle,
int x, int y, int w, int h ) = 0;
/// updateWindow (tell the OS we need to update the window)
virtual bool invalidateRect( int x, int y, int w, int h ) const = 0;
......
......@@ -61,6 +61,11 @@ class ThemeRepository;
#pragma warning ( disable:4786 )
#endif
#ifdef X11_SKINS
typedef uint32_t vlc_wnd_type;
#else
typedef void* vlc_wnd_type;
#endif
/// Wrapper around FromLocale, to avoid the need to call LocaleFree()
static inline string sFromLocale( const string &rLocale )
......@@ -138,12 +143,6 @@ struct intf_sys_t
vlc_mutex_t init_lock;
vlc_cond_t init_wait;
bool b_ready;
/// handle (vout windows)
void* handle;
vlc_mutex_t vout_lock;
vlc_cond_t vout_wait;
bool b_vout_ready;
};
......
......@@ -32,6 +32,7 @@
#include <vlc_playlist.h>
#include <vlc_threads.h>
#include <vlc_vout_window.h>
#include <vlc_vout_display.h>
#include "dialogs.hpp"
#include "os_factory.hpp"
......@@ -50,6 +51,10 @@
#include "../commands/cmd_dialogs.hpp"
#include "../commands/cmd_minimize.hpp"
#include "../commands/cmd_playlist.hpp"
#include "../commands/cmd_callbacks.hpp"
#include "../commands/cmd_show_window.hpp"
#include "../commands/cmd_resize.hpp"
#include "../commands/cmd_on_top.hpp"
//---------------------------------------------------------------------------
// Exported interface functions.
......@@ -108,9 +113,6 @@ static int Open( vlc_object_t *p_this )
// No theme yet
p_intf->p_sys->p_theme = NULL;
vlc_mutex_init( &p_intf->p_sys->vout_lock );
vlc_cond_init( &p_intf->p_sys->vout_wait );
vlc_mutex_init( &p_intf->p_sys->init_lock );
vlc_cond_init( &p_intf->p_sys->init_wait );
......@@ -124,8 +126,6 @@ static int Open( vlc_object_t *p_this )
vlc_cond_destroy( &p_intf->p_sys->init_wait );
vlc_mutex_destroy( &p_intf->p_sys->init_lock );
vlc_cond_destroy( &p_intf->p_sys->vout_wait );
vlc_mutex_destroy( &p_intf->p_sys->vout_lock );
free( p_intf->p_sys );
return VLC_EGENERIC;
}
......@@ -164,9 +164,6 @@ static void Close( vlc_object_t *p_this )
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
#endif
vlc_cond_destroy( &p_intf->p_sys->vout_wait );
vlc_mutex_destroy( &p_intf->p_sys->vout_lock );
// Destroy structure
free( p_intf->p_sys );
}
......@@ -313,11 +310,34 @@ end:
return NULL;
}
static vlc_mutex_t serializer = VLC_STATIC_MUTEX;
static int WindowOpen( vout_window_t *, const vout_window_cfg_t * );
static void WindowClose( vout_window_t * );
static int WindowControl( vout_window_t *, int, va_list );
struct vout_window_sys_t
{
intf_thread_t* pIntf;
vout_window_cfg_t cfg;
};
static void WindowOpenLocal( intf_thread_t* pIntf, vlc_object_t *pObj )
{
vout_window_t* pWnd = (vout_window_t*)pObj;
int width = (int)pWnd->sys->cfg.width;
int height = (int)pWnd->sys->cfg.height;
VoutManager::instance( pIntf )->acceptWnd( pWnd, width, height );
}
static void WindowCloseLocal( intf_thread_t* pIntf, vlc_object_t *pObj )
{
vout_window_t* pWnd = (vout_window_t*)pObj;
VoutManager::instance( pIntf )->releaseWnd( pWnd );
}
// Callbacks for vout requests
static int WindowOpen( vout_window_t *pWnd, const vout_window_cfg_t *cfg )
{
vout_window_sys_t* sys;
vlc_mutex_lock( &skin_load.mutex );
intf_thread_t *pIntf = skin_load.intf;
if( pIntf )
......@@ -335,37 +355,104 @@ static int WindowOpen( vout_window_t *pWnd, const vout_window_cfg_t *cfg )
return VLC_EGENERIC;
}
vlc_mutex_lock( &serializer );
sys = (vout_window_sys_t*)calloc( 1, sizeof( *sys ) );
if( !sys )
{
vlc_object_release( pIntf );
return VLC_ENOMEM;
}
pWnd->handle.hwnd = VoutManager::getWindow( pIntf, pWnd );
pWnd->sys = sys;
pWnd->sys->cfg = *cfg;
pWnd->sys->pIntf = pIntf;
pWnd->control = WindowControl;
if( pWnd->handle.hwnd )
{
pWnd->control = &VoutManager::controlWindow;
pWnd->sys = (vout_window_sys_t*)pIntf;
// force execution in the skins2 thread context
CmdExecuteBlock* cmd = new CmdExecuteBlock( pIntf, VLC_OBJECT( pWnd ),
WindowOpenLocal );
CmdExecuteBlock::executeWait( CmdGenericPtr( cmd ) );
vlc_mutex_unlock( &serializer );
return VLC_SUCCESS;
}
else
#ifdef X11_SKINS
if( !pWnd->handle.xid )
#else
if( !pWnd->handle.hwnd )
#endif
{
free( sys );
vlc_object_release( pIntf );
vlc_mutex_unlock( &serializer );
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
static void WindowClose( vout_window_t *pWnd )
{
intf_thread_t *pIntf = (intf_thread_t *)pWnd->sys;
vout_window_sys_t* sys = pWnd->sys;
intf_thread_t *pIntf = sys->pIntf;
vlc_mutex_lock( &serializer );
VoutManager::releaseWindow( pIntf, pWnd );
vlc_mutex_unlock( &serializer );
// force execution in the skins2 thread context
CmdExecuteBlock* cmd = new CmdExecuteBlock( pIntf, VLC_OBJECT( pWnd ),
WindowCloseLocal );
CmdExecuteBlock::executeWait( CmdGenericPtr( cmd ) );
vlc_object_release( pIntf );
vlc_object_release( sys->pIntf );
free( sys );
}
static int WindowControl( vout_window_t *pWnd, int query, va_list args )
{
vout_window_sys_t* sys = pWnd->sys;
intf_thread_t *pIntf = sys->pIntf;
VoutManager *pVoutManager = VoutManager::instance( pIntf );
AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
switch( query )
{
case VOUT_WINDOW_SET_SIZE:
{
unsigned int i_width = va_arg( args, unsigned int );
unsigned int i_height = va_arg( args, unsigned int );
if( i_width && i_height )
{
// Post a vout resize command
CmdResizeVout *pCmd =
new CmdResizeVout( pIntf, pWnd,
(int)i_width, (int)i_height );
pQueue->push( CmdGenericPtr( pCmd ) );
}
return VLC_EGENERIC;
}
case VOUT_WINDOW_SET_FULLSCREEN:
{
bool b_fullscreen = va_arg( args, int );
// Post a set fullscreen command
CmdSetFullscreen* pCmd =
new CmdSetFullscreen( pIntf, pWnd, b_fullscreen );
pQueue->push( CmdGenericPtr( pCmd ) );
return VLC_SUCCESS;
}
case VOUT_WINDOW_SET_STATE:
{
unsigned i_arg = va_arg( args, unsigned );
unsigned on_top = i_arg & VOUT_WINDOW_STATE_ABOVE;
// Post a SetOnTop command
CmdSetOnTop* pCmd =
new CmdSetOnTop( pIntf, on_top );
pQueue->push( CmdGenericPtr( pCmd ) );
return VLC_SUCCESS;
}
default:
msg_Dbg( pIntf, "control query not supported" );
return VLC_EGENERIC;
}
}
//---------------------------------------------------------------------------
// Module descriptor
......
......@@ -25,17 +25,9 @@
# include "config.h"
#endif
#include <vlc_vout.h>
#include <vlc_vout_display.h>
#include "vout_manager.hpp"
#include "window_manager.hpp"
#include "vlcproc.hpp"
#include "../commands/async_queue.hpp"
#include "../commands/cmd_show_window.hpp"
#include "../commands/cmd_resize.hpp"
#include "../commands/cmd_voutwindow.hpp"
#include "../commands/cmd_on_top.hpp"
#include "os_factory.hpp"
......@@ -194,17 +186,16 @@ CtrlVideo* VoutManager::getBestCtrlVideo( )
}
void* VoutManager::acceptWnd( vout_window_t* pWnd )
{
int width = (int)pWnd->cfg->width;
int height = (int)pWnd->cfg->height;
// Functions called by window provider
// ///////////////////////////////////
void VoutManager::acceptWnd( vout_window_t* pWnd, int width, int height )
{
// Creation of a dedicated Window per vout thread
VoutWindow* pVoutWindow = new VoutWindow( getIntf(), pWnd, width, height,
(GenericWindow*) m_pVoutMainWindow );
void* handle = pVoutWindow->getOSHandle();
// try to find a video Control within the theme
CtrlVideo* pCtrlVideo = getBestCtrlVideo();
if( pCtrlVideo )
......@@ -221,14 +212,12 @@ void* VoutManager::acceptWnd( vout_window_t* pWnd )
// save vout characteristics
m_SavedWndVec.push_back( SavedWnd( pWnd, pVoutWindow, pCtrlVideo ) );
msg_Dbg( pWnd, "New vout : handle = %p, Ctrl = %p, w x h = %dx%d",
handle, pCtrlVideo, width, height );
return handle;
msg_Dbg( pWnd, "New vout : Ctrl = %p, w x h = %dx%d",
pCtrlVideo, width, height );
}
void VoutManager::releaseWnd( vout_window_t *pWnd )
void VoutManager::releaseWnd( vout_window_t* pWnd )
{
// remove vout thread from savedVec
vector<SavedWnd>::iterator it;
......@@ -259,7 +248,7 @@ void VoutManager::releaseWnd( vout_window_t *pWnd )
void VoutManager::setSizeWnd( vout_window_t *pWnd, int width, int height )
{
msg_Dbg( pWnd, "setSize (%dx%d) received from vout threadr",
msg_Dbg( pWnd, "setSize (%dx%d) received from vout thread",
width, height );
vector<SavedWnd>::iterator it;
......@@ -304,113 +293,3 @@ void VoutManager::onUpdate( Subject<VarBool> &rVariable, void *arg )
}
}
// Functions called by window provider
// ///////////////////////////////////
void *VoutManager::getWindow( intf_thread_t *pIntf, vout_window_t *pWnd )
{
// Theme may have been destroyed
if( !pIntf->p_sys->p_theme )
return NULL;
vlc_mutex_lock( &pIntf->p_sys->vout_lock );
pIntf->p_sys->b_vout_ready = false;
pIntf->p_sys->handle = NULL;
CmdNewVoutWindow *pCmd =
new CmdNewVoutWindow( pIntf, pWnd );
AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
pQueue->push( CmdGenericPtr( pCmd ), false );
while( !pIntf->p_sys->b_vout_ready )
vlc_cond_wait( &pIntf->p_sys->vout_wait, &pIntf->p_sys->vout_lock );
void* handle = pIntf->p_sys->handle;
vlc_mutex_unlock( &pIntf->p_sys->vout_lock );
return handle;
}
void VoutManager::releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd )
{
vlc_mutex_lock( &pIntf->p_sys->vout_lock );
pIntf->p_sys->b_vout_ready = false;
CmdReleaseVoutWindow *pCmd =
new CmdReleaseVoutWindow( pIntf, pWnd );
AsyncQueue *pQueue = AsyncQueue::instance( pIntf );
pQueue->push( CmdGenericPtr( pCmd ), false );
while( !pIntf->p_sys->b_vout_ready )
vlc_cond_wait( &pIntf->p_sys->vout_wait, &pIntf->p_sys->vout_lock );
vlc_mutex_unlock( &pIntf->p_sys->vout_lock );
}
int VoutManager::controlWindow( struct vout_window_t *pWnd,
int query, va_list args )
{
intf_thread_t *pIntf = (intf_thread_t *)pWnd->sys;
VoutManager *pThis = pIntf->p_sys->p_voutManager;
switch( query )
{
case VOUT_WINDOW_SET_SIZE:
{
unsigned int i_width = va_arg( args, unsigned int );
unsigned int i_height = va_arg( args, unsigned int );
if( i_width && i_height )
{
// Post a vout resize command
CmdResizeVout *pCmd =
new CmdResizeVout( pThis->getIntf(),
pWnd, (int)i_width, (int)i_height );
AsyncQueue *pQueue =
AsyncQueue::instance( pThis->getIntf() );
pQueue->push( CmdGenericPtr( pCmd ) );
}
return VLC_EGENERIC;
}
case VOUT_WINDOW_SET_FULLSCREEN:
{
bool b_fullscreen = va_arg( args, int );
// Post a vout resize command
CmdSetFullscreen* pCmd =
new CmdSetFullscreen( pThis->getIntf(), pWnd, b_fullscreen );
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
pQueue->push( CmdGenericPtr( pCmd ) );
return VLC_SUCCESS;
}
case VOUT_WINDOW_SET_STATE:
{
unsigned i_arg = va_arg( args, unsigned );
unsigned on_top = i_arg & VOUT_WINDOW_STATE_ABOVE;
// Post a SetOnTop command
CmdSetOnTop* pCmd =
new CmdSetOnTop( pThis->getIntf(), on_top );
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
pQueue->push( CmdGenericPtr( pCmd ) );
return VLC_SUCCESS;
}
default:
msg_Dbg( pWnd, "control query not supported" );
return VLC_EGENERIC;
}
}
......@@ -106,28 +106,18 @@ public:
/// Delete the instance of VoutManager
static void destroy( intf_thread_t *pIntf );
/// Accept Wnd
void* acceptWnd( vout_window_t* pWnd );
/// accept window request (vout window provider)
void acceptWnd( vout_window_t *pWnd, int width, int height );
/// Release Wnd
void releaseWnd( vout_window_t* pWnd );
// release window (vout window provider)
void releaseWnd( vout_window_t *pWnd );
/// set size Wnd
/// set window size (vout window provider)
void setSizeWnd( vout_window_t* pWnd, int width, int height );
/// set fullscreen Wnd
/// set fullscreen mode (vout window provider)
void setFullscreenWnd( vout_window_t* pWnd, bool b_fullscreen );
/// Callback to request a vout window
static void *getWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
// Window provider (release)
static void releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
/// Callback to change a vout window
static int controlWindow( struct vout_window_t *pWnd,
int query, va_list args );
// Register Video Controls (when building theme)
void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
......
......@@ -41,14 +41,32 @@ VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
m_pParentWindow( pParent ), m_pCtrlVideo( NULL )
{
if( m_pWnd )
{
vlc_object_hold( m_pWnd );
#ifdef X11_SKINS
m_pWnd->handle.xid = getOSHandle();
if( m_pWnd->handle.xid )
m_pWnd->display.x11 =
OSFactory::instance( getIntf() )->getDisplay();
#else
m_pWnd->handle.hwnd = getOSHandle();
#endif
}
}
VoutWindow::~VoutWindow()
{
if( m_pWnd )
{
#ifdef X11_SKINS
free( m_pWnd->display.x11 );
m_pWnd->display.x11 = NULL;
#endif
vlc_object_release( m_pWnd );
}
}
......
......@@ -118,6 +118,8 @@ public:
HWND getParentWindow() { return m_hParentWindow; }
char* getDisplay() { return NULL; }
/// Callback function (Windows Procedure)
static LRESULT CALLBACK Win32Proc( HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam );
......
......@@ -59,11 +59,9 @@ type X11Display::blendPixel(type v,type r, type g, type b, type a) const
X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_mainWindow( 0 ), m_gc( NULL ), m_colormap( 0 )
{
char *psz_display = var_CreateGetNonEmptyString( pIntf, "x11-display" );
m_psz_display = var_CreateGetNonEmptyString( pIntf, "x11-display" );
// Open a connection to the X Server
m_pDisplay = XOpenDisplay( psz_display );
free( psz_display );
m_pDisplay = XOpenDisplay( m_psz_display );
if( m_pDisplay == NULL )
{
MSG_ERR( "Cannot open display" );
......@@ -287,6 +285,7 @@ X11Display::X11Display( intf_thread_t *pIntf ): SkinObject( pIntf ),
X11Display::~X11Display()
{
free( m_psz_display );
if( m_mainWindow ) XDestroyWindow( m_pDisplay, m_mainWindow );
if( m_gc ) XFreeGC( m_pDisplay, m_gc );
if( m_colormap ) XFreeColormap( m_pDisplay, m_colormap );
......
......@@ -83,8 +83,9 @@ public:
/// Get the main window ID
Window getMainWindow() const { return m_mainWindow; }
//XXX
///Window m_voutWindow;
/// Get the x11_display string (to be freed by caller)
char* getX11Display()
{ return (m_psz_display ? strdup( m_psz_display ) : NULL); }
/// EWMH spec
Atom m_net_wm_supported;
......@@ -101,6 +102,8 @@ public:
void testEWMH();
private:
/// x11-display (as a character string)
char* m_psz_display;
/// Dummy parent window for the task bar
Window m_mainWindow;
/// Display parameters
......
......@@ -29,6 +29,7 @@
#include "../src/os_factory.hpp"
#include "../src/generic_window.hpp"
#include "x11_display.hpp"
#include <map>
class X11Display;
......@@ -141,6 +142,9 @@ public:
/// Get the timer loop
X11TimerLoop *getTimerLoop() const { return m_pTimerLoop; }
/// Get x11_display string (to be freed by caller)
char* getDisplay() { return m_pDisplay->getX11Display(); }
private:
/// X11 display
X11Display *m_pDisplay;
......
......@@ -237,7 +237,7 @@ X11Window::~X11Window()
XSync( XDISPLAY, False );
}
void X11Window::reparent( void* OSHandle, int x, int y, int w, int h )
void X11Window::reparent( uint32_t OSHandle, int x, int y, int w, int h )
{
// Reparent the window
Window new_parent =
......
......@@ -68,13 +68,13 @@ public:
Window getDrawable() const { return m_wnd; }
/// Getter for the handler
void* getOSHandle() const { return (void*) m_wnd; }
uint32_t getOSHandle() const { return m_wnd; }
/// Getter for the handler
void* getParentOSHandle() const { return (void*) m_wnd_parent; }
uint32_t getParentOSHandle() const { return m_wnd_parent; }
/// reparent the window
void reparent( void* OSHandle, int x, int y, int w, int h );
void reparent( uint32_t OSHandle, int x, int y, int w, int h );
/// invalidate a window surface
bool invalidateRect( int x, int y, int w, int h ) const;
......
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