Kaydet (Commit) 21a2ce0d authored tarafından Zolnai Tamás's avatar Zolnai Tamás

slideshow\glTF: add a parent window to the OpenGL window

OpenGL window is a SystemChildWindow which doesn't handle
window events as a vcl Window does (call it's event
handler functions and the given event listeners), so
I added a new parent which will handle window events
and capture them from the slideshow's main window.

Change-Id: I06ac87fb85e663e52f2691c1311605b3fd7d3afa
üst 8099056f
...@@ -75,7 +75,8 @@ namespace slideshow ...@@ -75,7 +75,8 @@ namespace slideshow
const uno::Reference< drawing::XShape >& rxShape, const uno::Reference< drawing::XShape >& rxShape,
const uno::Reference< uno::XComponentContext >& rxContext ) : const uno::Reference< uno::XComponentContext >& rxContext ) :
mpViewLayer( rViewLayer ), mpViewLayer( rViewLayer ),
mpMediaWindow(), mpMediaWindow(0),
mpEventHandlerParent(0),
maWindowOffset( 0, 0 ), maWindowOffset( 0, 0 ),
maBounds(), maBounds(),
mxShape( rxShape ), mxShape( rxShape ),
...@@ -149,6 +150,7 @@ namespace slideshow ...@@ -149,6 +150,7 @@ namespace slideshow
} }
mpMediaWindow.reset(); mpMediaWindow.reset();
mpEventHandlerParent.reset();
// shutdown player // shutdown player
if( mxPlayer.is() ) if( mxPlayer.is() )
...@@ -277,7 +279,15 @@ namespace slideshow ...@@ -277,7 +279,15 @@ namespace slideshow
if( mpMediaWindow.get() ) if( mpMediaWindow.get() )
{ {
mpMediaWindow->SetPosSizePixel( aPosPixel, aSizePixel ); if( mpEventHandlerParent )
{
mpEventHandlerParent->SetPosSizePixel( aPosPixel, aSizePixel );
mpMediaWindow->SetPosSizePixel( Point(0,0), aSizePixel );
}
else
{
mpMediaWindow->SetPosSizePixel( aPosPixel, aSizePixel );
}
mxPlayerWindow->setPosSize( 0, 0, mxPlayerWindow->setPosSize( 0, 0,
aSizePixel.Width(), aSizePixel.Height(), aSizePixel.Width(), aSizePixel.Height(),
0 ); 0 );
...@@ -463,16 +473,22 @@ namespace slideshow ...@@ -463,16 +473,22 @@ namespace slideshow
rRangePix.getMaxY() - rRangePix.getMinY() ); rRangePix.getMaxY() - rRangePix.getMinY() );
if( avmedia::IsModel(rMimeType) ) if( avmedia::IsModel(rMimeType) )
{ {
SystemWindowData aWinData = OpenGLContext::generateWinData(pWindow); mpEventHandlerParent.reset(new Window(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL));
mpMediaWindow.reset(new SystemChildWindow(pWindow, 0, &aWinData)); mpEventHandlerParent->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
Size( aAWTRect.Width, aAWTRect.Height ) );
mpEventHandlerParent->Show();
SystemWindowData aWinData = OpenGLContext::generateWinData(mpEventHandlerParent.get());
mpMediaWindow.reset(new SystemChildWindow(mpEventHandlerParent.get(), 0, &aWinData));
mpMediaWindow->SetPosSizePixel( Point( 0, 0 ),
Size( aAWTRect.Width, aAWTRect.Height ) );
} }
else else
{ {
mpMediaWindow.reset( new SystemChildWindow( pWindow, WB_CLIPCHILDREN ) ); mpMediaWindow.reset( new SystemChildWindow( pWindow, WB_CLIPCHILDREN ) );
mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
Size( aAWTRect.Width, aAWTRect.Height ) );
} }
mpMediaWindow->SetBackground( Color( COL_BLACK ) ); mpMediaWindow->SetBackground( Color( COL_BLACK ) );
mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
Size( aAWTRect.Width, aAWTRect.Height ) );
mpMediaWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP ); mpMediaWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP );
mpMediaWindow->EnableEraseBackground( false ); mpMediaWindow->EnableEraseBackground( false );
mpMediaWindow->EnablePaint( false ); mpMediaWindow->EnablePaint( false );
...@@ -504,6 +520,7 @@ namespace slideshow ...@@ -504,6 +520,7 @@ namespace slideshow
//if there was no playerwindow, then clear the mpMediaWindow too //if there was no playerwindow, then clear the mpMediaWindow too
//so that we can draw a placeholder instead in that space //so that we can draw a placeholder instead in that space
mpMediaWindow.reset(); mpMediaWindow.reset();
mpEventHandlerParent.reset();
} }
} }
} }
......
...@@ -25,10 +25,12 @@ ...@@ -25,10 +25,12 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
#include "viewlayer.hxx" #include "viewlayer.hxx"
class SystemChildWindow; class SystemChildWindow;
class Window;
namespace com { namespace sun { namespace star { namespace drawing { namespace com { namespace sun { namespace star { namespace drawing {
class XShape; class XShape;
...@@ -145,7 +147,8 @@ namespace slideshow ...@@ -145,7 +147,8 @@ namespace slideshow
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams,
const OUString& rMimeType ); const OUString& rMimeType );
ViewLayerSharedPtr mpViewLayer; ViewLayerSharedPtr mpViewLayer;
::std::auto_ptr< SystemChildWindow > mpMediaWindow; ::std::auto_ptr< SystemChildWindow > mpMediaWindow;
boost::scoped_ptr< Window > mpEventHandlerParent;
mutable ::com::sun::star::awt::Point maWindowOffset; mutable ::com::sun::star::awt::Point maWindowOffset;
mutable ::basegfx::B2DRectangle maBounds; mutable ::basegfx::B2DRectangle maBounds;
......
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