Kaydet (Commit) a5a76729 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

make opengl transitions under X flicker free on enter/leave

Change-Id: I109637dc6b3d23c0beca21f3cf0c7ba918ecb4f8
Reviewed-on: https://gerrit.libreoffice.org/38749Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
(cherry picked from commit 277395b6)
Reviewed-on: https://gerrit.libreoffice.org/38753Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit b49779db)
üst 736c12e1
...@@ -49,6 +49,12 @@ public: ...@@ -49,6 +49,12 @@ public:
// however, this might not always be required // however, this might not always be required
void EnableEraseBackground( bool bEnable ); void EnableEraseBackground( bool bEnable );
void SetForwardKey( bool bEnable ); void SetForwardKey( bool bEnable );
//To avoid annoying flashing under X entering and leaving slides with opengl effects set the leaving
//bitmap as the background pixmap of the opengl child window and the entering bitmap as the background
//pixmap of the non-opengl parent window. If any expose events occur around the start and end of
//the transition then those windows are default filled by X with the desired start/end image so there's
//no visible flash
void SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& rLeaveArgs, const css::uno::Sequence<css::uno::Any>& rEnterArgs);
// return the platform specific handle/id of this window; // return the platform specific handle/id of this window;
sal_IntPtr GetParentWindowHandle(); sal_IntPtr GetParentWindowHandle();
}; };
......
...@@ -367,6 +367,26 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& ...@@ -367,6 +367,26 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >&
SAL_INFO("slideshow.opengl", "leaving bitmap area: " << maSlideSize.Width << "x" << maSlideSize.Height); SAL_INFO("slideshow.opengl", "leaving bitmap area: " << maSlideSize.Width << "x" << maSlideSize.Height);
maSlideSize = mxEnteringBitmap->getSize(); maSlideSize = mxEnteringBitmap->getSize();
SAL_INFO("slideshow.opengl", "entering bitmap area: " << maSlideSize.Width << "x" << maSlideSize.Height); SAL_INFO("slideshow.opengl", "entering bitmap area: " << maSlideSize.Width << "x" << maSlideSize.Height);
//to avoid annoying flashing under X entering and leaving slides with opengl effects set the leaving
//bitmap as the background pixmap of the opengl child window and the entering bitmap as the background
//pixmap of the non-opengl parent window. If any expose events occur around the start and end of
//the transition then those windows are default filled by X with the desired start/end image so there's
//no visible flash
if (SystemChildWindow* pChildWindow = mpContext->getChildWindow())
{
css::uno::Reference<css::beans::XFastPropertySet> xEnteringFastPropertySet(mxEnteringBitmap, css::uno::UNO_QUERY);
css::uno::Reference<css::beans::XFastPropertySet> xLeavingFastPropertySet(mxLeavingBitmap, css::uno::UNO_QUERY);
css::uno::Sequence<css::uno::Any> aEnteringBitmap;
css::uno::Sequence<css::uno::Any> aLeavingBitmap;
if (xEnteringFastPropertySet.get() && xLeavingFastPropertySet.get())
{
xEnteringFastPropertySet->getFastPropertyValue(1) >>= aEnteringBitmap;
xLeavingFastPropertySet->getFastPropertyValue(1) >>= aLeavingBitmap;
}
if (aEnteringBitmap.getLength() == 3 && aLeavingBitmap.getLength() == 3)
pChildWindow->SetLeaveEnterBackgrounds(aLeavingBitmap, aEnteringBitmap);
}
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define INCLUDED_VCL_INC_SALOBJ_HXX #define INCLUDED_VCL_INC_SALOBJ_HXX
#include <vcl/dllapi.h> #include <vcl/dllapi.h>
#include <com/sun/star/uno/Sequence.hxx>
#include "salwtype.hxx" #include "salwtype.hxx"
struct SystemEnvData; struct SystemEnvData;
...@@ -48,6 +48,8 @@ public: ...@@ -48,6 +48,8 @@ public:
virtual void SetForwardKey( bool /* bEnable */ ) {} virtual void SetForwardKey( bool /* bEnable */ ) {}
virtual void SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& /*rLeaveArgs*/, const css::uno::Sequence<css::uno::Any>& /*rEnterArgs*/) {}
virtual const SystemEnvData* GetSystemData() const = 0; virtual const SystemEnvData* GetSystemData() const = 0;
void SetCallback( void* pInst, SALOBJECTPROC pProc ) void SetCallback( void* pInst, SALOBJECTPROC pProc )
......
...@@ -76,6 +76,8 @@ public: ...@@ -76,6 +76,8 @@ public:
virtual void Show( bool bVisible ) override; virtual void Show( bool bVisible ) override;
virtual void GrabFocus() override; virtual void GrabFocus() override;
virtual void SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& rLeaveArgs, const css::uno::Sequence<css::uno::Any>& rEnterArgs) override;
virtual const SystemEnvData* GetSystemData() const override; virtual const SystemEnvData* GetSystemData() const override;
}; };
......
...@@ -162,6 +162,12 @@ void SystemChildWindow::EnableEraseBackground( bool bEnable ) ...@@ -162,6 +162,12 @@ void SystemChildWindow::EnableEraseBackground( bool bEnable )
mpWindowImpl->mpSysObj->EnableEraseBackground( bEnable ); mpWindowImpl->mpSysObj->EnableEraseBackground( bEnable );
} }
void SystemChildWindow::SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& rLeaveArgs, const css::uno::Sequence<css::uno::Any>& rEnterArgs)
{
if (mpWindowImpl->mpSysObj)
mpWindowImpl->mpSysObj->SetLeaveEnterBackgrounds(rLeaveArgs, rEnterArgs);
}
void SystemChildWindow::SetForwardKey( bool bEnable ) void SystemChildWindow::SetForwardKey( bool bEnable )
{ {
if ( mpWindowImpl->mpSysObj ) if ( mpWindowImpl->mpSysObj )
......
...@@ -249,6 +249,9 @@ X11SalObject::~X11SalObject() ...@@ -249,6 +249,9 @@ X11SalObject::~X11SalObject()
rObjects.remove( this ); rObjects.remove( this );
GetGenericData()->ErrorTrapPush(); GetGenericData()->ErrorTrapPush();
const SystemEnvData* pEnv = mpParent->GetSystemData();
::Window aObjectParent = (::Window)pEnv->aWindow;
XSetWindowBackgroundPixmap(static_cast<Display*>(maSystemChildData.pDisplay), aObjectParent, None);
if ( maSecondary ) if ( maSecondary )
XDestroyWindow( static_cast<Display*>(maSystemChildData.pDisplay), maSecondary ); XDestroyWindow( static_cast<Display*>(maSystemChildData.pDisplay), maSecondary );
if ( maPrimary ) if ( maPrimary )
...@@ -474,4 +477,40 @@ bool X11SalObject::Dispatch( XEvent* pEvent ) ...@@ -474,4 +477,40 @@ bool X11SalObject::Dispatch( XEvent* pEvent )
return false; return false;
} }
void X11SalObject::SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& rLeaveArgs, const css::uno::Sequence<css::uno::Any>& rEnterArgs)
{
SalDisplay* pSalDisp = vcl_sal::getSalDisplay(GetGenericData());
const SystemEnvData* pEnv = mpParent->GetSystemData();
Display* pDisp = pSalDisp->GetDisplay();
::Window aObjectParent = (::Window)pEnv->aWindow;
bool bFreePixmap = false;
Pixmap aPixmap = None;
if (rEnterArgs.getLength() == 3)
{
rEnterArgs[0] >>= bFreePixmap;
long pixmapHandle = None;
rEnterArgs[1] >>= pixmapHandle;
aPixmap = pixmapHandle;
}
XSetWindowBackgroundPixmap(pDisp, aObjectParent, aPixmap);
if (bFreePixmap)
XFreePixmap(pDisp, aPixmap);
bFreePixmap = false;
aPixmap = None;
if (rLeaveArgs.getLength() == 3)
{
rLeaveArgs[0] >>= bFreePixmap;
long pixmapHandle = None;
rLeaveArgs[1] >>= pixmapHandle;
aPixmap = pixmapHandle;
}
XSetWindowBackgroundPixmap(pDisp, maSecondary, aPixmap);
if (bFreePixmap)
XFreePixmap(pDisp, aPixmap);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -2882,7 +2882,9 @@ gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer ...@@ -2882,7 +2882,9 @@ gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer
{ {
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
struct SalPaintEvent aEvent( pEvent->area.x, pEvent->area.y, pEvent->area.width, pEvent->area.height, OpenGLHelper::isVCLOpenGLEnabled() ); const bool bImmediate = OpenGLHelper::isVCLOpenGLEnabled() || pThis->m_bFullscreen;
struct SalPaintEvent aEvent( pEvent->area.x, pEvent->area.y, pEvent->area.width, pEvent->area.height, bImmediate );
pThis->CallCallback( SalEvent::Paint, &aEvent ); pThis->CallCallback( SalEvent::Paint, &aEvent );
......
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