diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-15 12:49:57 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-15 14:23:42 +0200 |
commit | 21a2ce0d09a34ca63aebb3821ce120a8e00e0d68 (patch) | |
tree | 03a4603cb7463470a85f5988c1f76ca67ba32e42 /slideshow | |
parent | 8099056f50f4587cb03b76cf6bac7e876f6ff967 (diff) |
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
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/shapes/viewmediashape.cxx | 29 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/viewmediashape.hxx | 5 |
2 files changed, 27 insertions, 7 deletions
diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index d854151db20f..ab972353b3a5 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -75,7 +75,8 @@ namespace slideshow const uno::Reference< drawing::XShape >& rxShape, const uno::Reference< uno::XComponentContext >& rxContext ) : mpViewLayer( rViewLayer ), - mpMediaWindow(), + mpMediaWindow(0), + mpEventHandlerParent(0), maWindowOffset( 0, 0 ), maBounds(), mxShape( rxShape ), @@ -149,6 +150,7 @@ namespace slideshow } mpMediaWindow.reset(); + mpEventHandlerParent.reset(); // shutdown player if( mxPlayer.is() ) @@ -277,7 +279,15 @@ namespace slideshow 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, aSizePixel.Width(), aSizePixel.Height(), 0 ); @@ -463,16 +473,22 @@ namespace slideshow rRangePix.getMaxY() - rRangePix.getMinY() ); if( avmedia::IsModel(rMimeType) ) { - SystemWindowData aWinData = OpenGLContext::generateWinData(pWindow); - mpMediaWindow.reset(new SystemChildWindow(pWindow, 0, &aWinData)); + mpEventHandlerParent.reset(new Window(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL)); + 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 { 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->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ), - Size( aAWTRect.Width, aAWTRect.Height ) ); mpMediaWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP ); mpMediaWindow->EnableEraseBackground( false ); mpMediaWindow->EnablePaint( false ); @@ -504,6 +520,7 @@ namespace slideshow //if there was no playerwindow, then clear the mpMediaWindow too //so that we can draw a placeholder instead in that space mpMediaWindow.reset(); + mpEventHandlerParent.reset(); } } } diff --git a/slideshow/source/engine/shapes/viewmediashape.hxx b/slideshow/source/engine/shapes/viewmediashape.hxx index 609c36ef9366..dc726f65e726 100644 --- a/slideshow/source/engine/shapes/viewmediashape.hxx +++ b/slideshow/source/engine/shapes/viewmediashape.hxx @@ -25,10 +25,12 @@ #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> +#include <boost/scoped_ptr.hpp> #include "viewlayer.hxx" class SystemChildWindow; +class Window; namespace com { namespace sun { namespace star { namespace drawing { class XShape; @@ -145,7 +147,8 @@ namespace slideshow const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams, const OUString& rMimeType ); 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 ::basegfx::B2DRectangle maBounds; |