vcl/inc/window.h | 5 ++++- vcl/qa/cppunit/outdev.cxx | 15 +++++++++++++++ vcl/source/control/edit.cxx | 2 +- vcl/source/gdi/impanmvw.cxx | 8 ++++---- vcl/source/window/cursor.cxx | 4 ++-- vcl/source/window/paint.cxx | 8 ++++++-- 6 files changed, 32 insertions(+), 10 deletions(-)
New commits: commit b0fa356eed82a0452e6bcb915f179f5e2d02943a Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Jan 2 18:02:41 2020 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Jan 2 18:48:13 2020 +0100 tdf#129662 vcl: rtl: fix scrollbar in dropdowns Regression from commit d4714b0fdb81e6e561ae526cc517ecc9a40a603e (tdf#101978 vcl combobox/listbox floating window: avoid flicker, 2019-06-17). High-level vcl double-buffering never set up RTL status of the virtual device correctly, but now that double-buffering is used at more places, this got noticed. Change-Id: Iba378cef3a693b0712389fab519f38ee222577d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86134 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 970e7c58b0c3..4da4a3adc5d2 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -396,8 +396,10 @@ public: bool mbLOKParentNotifier; }; +namespace vcl +{ /// Sets up the buffer to have settings matching the window, and restores the original state in the dtor. -class PaintBufferGuard +class VCL_DLLPUBLIC PaintBufferGuard { ImplFrameData* mpFrameData; VclPtr<vcl::Window> m_pWindow; @@ -415,6 +417,7 @@ public: /// Returns either the frame's buffer or the window, in case of no buffering. vcl::RenderContext* GetRenderContext(); }; +} // helper methods diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index 2f42412e75aa..e99a35f67adf 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -17,6 +17,7 @@ #include <vcl/metaact.hxx> #include <bitmapwriteaccess.hxx> #include <bufferdevice.hxx> +#include <window.h> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -34,6 +35,7 @@ public: void testDrawTransformedBitmapEx(); void testDrawTransformedBitmapExFlip(); void testRTL(); + void testRTLGuard(); CPPUNIT_TEST_SUITE(VclOutdevTest); CPPUNIT_TEST(testVirtualDevice); @@ -45,6 +47,7 @@ public: CPPUNIT_TEST(testDrawTransformedBitmapEx); CPPUNIT_TEST(testDrawTransformedBitmapExFlip); CPPUNIT_TEST(testRTL); + CPPUNIT_TEST(testRTLGuard); CPPUNIT_TEST_SUITE_END(); }; @@ -269,6 +272,18 @@ void VclOutdevTest::testRTL() CPPUNIT_ASSERT(pBuffer->IsRTLEnabled()); } +void VclOutdevTest::testRTLGuard() +{ + ScopedVclPtrInstance<vcl::Window> pWindow(nullptr, WB_APP | WB_STDWORK); + pWindow->EnableRTL(); + pWindow->RequestDoubleBuffering(true); + ImplFrameData* pFrameData = pWindow->ImplGetWindowImpl()->mpFrameData; + vcl::PaintBufferGuard aGuard(pFrameData, pWindow); + // Without the accompanying fix in place, this test would have failed, because the RTL status + // from pWindow was not propagated to aGuard. + CPPUNIT_ASSERT(aGuard.GetRenderContext()->IsRTLEnabled()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(VclOutdevTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index ddf942f76c15..4525eb630613 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -977,7 +977,7 @@ void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, const tools:: { // ImplPaintBorder() is a NOP, we have a native border, and this is a sub-edit of a control. // That means we have to draw the parent native widget to paint the edit area to clear our background. - PaintBufferGuard g(ImplGetWindowImpl()->mpFrameData, GetParent()); + vcl::PaintBufferGuard g(ImplGetWindowImpl()->mpFrameData, GetParent()); GetParent()->Paint(rRenderContext, rRectangle); } } diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index 0537c349e0f3..7818a3dcc0ed 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -152,11 +152,11 @@ void ImplAnimView::drawToPos( sal_uLong nPos ) { VclPtr<vcl::RenderContext> pRenderContext = mpRenderContext; - std::unique_ptr<PaintBufferGuard> pGuard; + std::unique_ptr<vcl::PaintBufferGuard> pGuard; if (mpRenderContext->GetOutDevType() == OUTDEV_WINDOW) { vcl::Window* pWindow = static_cast<vcl::Window*>(mpRenderContext.get()); - pGuard.reset(new PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); + pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); pRenderContext = pGuard->GetRenderContext(); } @@ -184,11 +184,11 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) { VclPtr<vcl::RenderContext> pRenderContext = mpRenderContext; - std::unique_ptr<PaintBufferGuard> pGuard; + std::unique_ptr<vcl::PaintBufferGuard> pGuard; if (!pVDev && mpRenderContext->GetOutDevType() == OUTDEV_WINDOW) { vcl::Window* pWindow = static_cast<vcl::Window*>(mpRenderContext.get()); - pGuard.reset(new PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); + pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); pRenderContext = pGuard->GetRenderContext(); } diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index 06eb1faf01ec..8291d29e2b21 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -122,10 +122,10 @@ static void ImplCursorInvert(vcl::Window* pWindow, ImplCursorData const * pData) if (!pWindow || pWindow->IsDisposed()) return; - std::unique_ptr<PaintBufferGuard> pGuard; + std::unique_ptr<vcl::PaintBufferGuard> pGuard; const bool bDoubleBuffering = pWindow->SupportsDoubleBuffering(); if (bDoubleBuffering) - pGuard.reset(new PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); + pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); vcl::RenderContext* pRenderContext = bDoubleBuffering ? pGuard->GetRenderContext() : pWindow; diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 9aa966814e07..99c6ed983a09 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -40,6 +40,8 @@ // PaintBufferGuard +namespace vcl +{ PaintBufferGuard::PaintBufferGuard(ImplFrameData* pFrameData, vcl::Window* pWindow) : mpFrameData(pFrameData), m_pWindow(pWindow), @@ -100,6 +102,7 @@ PaintBufferGuard::PaintBufferGuard(ImplFrameData* pFrameData, vcl::Window* pWind mnOutOffY = pFrameData->mpBuffer->GetOutOffYPixel(); pFrameData->mpBuffer->SetOutOffXPixel(pWindow->GetOutOffXPixel()); pFrameData->mpBuffer->SetOutOffYPixel(pWindow->GetOutOffYPixel()); + pFrameData->mpBuffer->EnableRTL(pWindow->IsRTLEnabled()); } PaintBufferGuard::~PaintBufferGuard() @@ -156,6 +159,7 @@ vcl::RenderContext* PaintBufferGuard::GetRenderContext() else return m_pWindow; } +} class PaintHelper { @@ -235,7 +239,7 @@ void PaintHelper::PaintBuffer() assert(pFrameData->mbInBufferedPaint); assert(m_bStartedBufferedPaint); - PaintBufferGuard aGuard(pFrameData, m_pWindow); + vcl::PaintBufferGuard aGuard(pFrameData, m_pWindow); aGuard.SetPaintRect(pFrameData->maBufferedRect); } @@ -286,7 +290,7 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) if (pFrameData->mbInBufferedPaint && m_pWindow->SupportsDoubleBuffering()) { // double-buffering - PaintBufferGuard g(pFrameData, m_pWindow); + vcl::PaintBufferGuard g(pFrameData, m_pWindow); m_pWindow->ApplySettings(*pFrameData->mpBuffer); m_pWindow->PushPaintHelper(this, *pFrameData->mpBuffer); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits