include/vcl/syschild.hxx | 6 +++ slideshow/source/engine/opengl/TransitionerImpl.cxx | 20 ++++++++++ vcl/inc/salobj.hxx | 4 +- vcl/inc/unx/salobj.h | 2 + vcl/source/window/syschild.cxx | 6 +++ vcl/unx/generic/window/salobj.cxx | 39 ++++++++++++++++++++ vcl/unx/gtk/gtksalframe.cxx | 4 +- 7 files changed, 79 insertions(+), 2 deletions(-)
New commits: commit dc22d67525d31c8ebdb2563f3d56e6e5b9f7745b Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jun 13 18:09:08 2017 +0100 make opengl transitions under X flicker free on enter/leave Change-Id: I109637dc6b3d23c0beca21f3cf0c7ba918ecb4f8 Reviewed-on: https://gerrit.libreoffice.org/38752 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/syschild.hxx b/include/vcl/syschild.hxx index 3f5ed9beda2a..9f5be6780064 100644 --- a/include/vcl/syschild.hxx +++ b/include/vcl/syschild.hxx @@ -49,6 +49,12 @@ public: // however, this might not always be required void EnableEraseBackground( 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; sal_IntPtr GetParentWindowHandle(); }; diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx index 644c3b823498..246f9c85cb09 100644 --- a/slideshow/source/engine/opengl/TransitionerImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx @@ -365,6 +365,26 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& SAL_INFO("slideshow.opengl", "leaving bitmap area: " << maSlideSize.Width << "x" << maSlideSize.Height); maSlideSize = mxEnteringBitmap->getSize(); 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); + } } diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx index 3d2105fcb008..07f1843fadcc 100644 --- a/vcl/inc/salobj.hxx +++ b/vcl/inc/salobj.hxx @@ -21,7 +21,7 @@ #define INCLUDED_VCL_INC_SALOBJ_HXX #include <vcl/dllapi.h> - +#include <com/sun/star/uno/Sequence.hxx> #include "salwtype.hxx" struct SystemEnvData; @@ -48,6 +48,8 @@ public: 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; void SetCallback( void* pInst, SALOBJECTPROC pProc ) diff --git a/vcl/inc/unx/salobj.h b/vcl/inc/unx/salobj.h index ffc738aa6987..b3170cb6c0af 100644 --- a/vcl/inc/unx/salobj.h +++ b/vcl/inc/unx/salobj.h @@ -76,6 +76,8 @@ public: virtual void Show( bool bVisible ) 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; }; diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 9a975910eaa8..8cb32ab1a581 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -159,6 +159,12 @@ void SystemChildWindow::EnableEraseBackground( bool 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 ) { if ( mpWindowImpl->mpSysObj ) diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 186af85cbe49..0b181ddd6d85 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -248,6 +248,9 @@ X11SalObject::~X11SalObject() rObjects.remove( this ); GetGenericData()->ErrorTrapPush(); + const SystemEnvData* pEnv = mpParent->GetSystemData(); + ::Window aObjectParent = (::Window)pEnv->aWindow; + XSetWindowBackgroundPixmap(static_cast<Display*>(maSystemChildData.pDisplay), aObjectParent, None); if ( maSecondary ) XDestroyWindow( static_cast<Display*>(maSystemChildData.pDisplay), maSecondary ); if ( maPrimary ) @@ -473,4 +476,40 @@ bool X11SalObject::Dispatch( XEvent* pEvent ) 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: */ diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx index 8192076fc906..95a8b8cbd7fd 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -2875,7 +2875,9 @@ gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer { 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 );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits