diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-01-02 18:02:41 +0100 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2020-01-06 15:55:39 +0100 |
commit | 9aa7da21e428111cbc708107c4efd75df4ea1fa2 (patch) | |
tree | 17523572d16455725be6e4de42ef2f1af64024a3 /vcl | |
parent | 4ddf3d035f8db1271df23b1e219a7c4a135297a3 (diff) |
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.
(cherry picked from commit b0fa356eed82a0452e6bcb915f179f5e2d02943a)
Conflicts:
vcl/source/window/cursor.cxx
Change-Id: Iba378cef3a693b0712389fab519f38ee222577d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86158
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/window.h | 5 | ||||
-rw-r--r-- | vcl/qa/cppunit/outdev.cxx | 15 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/impanmvw.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/cursor.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/paint.cxx | 8 |
6 files changed, 32 insertions, 10 deletions
diff --git a/vcl/inc/window.h b/vcl/inc/window.h index ab2e1497b301..a328abf75c0e 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 b4f3edd6a71a..9e25359bcf19 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -982,7 +982,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 24d05c8f86f3..3bdd19b08ddf 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -114,10 +114,10 @@ static tools::Rectangle ImplCursorInvert(vcl::RenderContext* pRenderContext, Imp static void ImplCursorInvert(vcl::Window* pWindow, ImplCursorData const * pData) { - 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 377d7d46d37a..a99ae752de45 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); |