diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-01-02 18:02:41 +0100 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-01-09 16:21:57 +0100 |
commit | a9d9abe590e310a82f23f297bc25609f91ae8540 (patch) | |
tree | 6a13a4310148176d9dc57de745305fdac3442e73 /vcl | |
parent | 3018dcbf12fe96e57fe52dc1b2d7a1235b480eef (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>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86487
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 bdd64c1de5db..9c3dec48a725 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 e6b4b074868d..0d87a01f36e9 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -14,6 +14,7 @@ #include <vcl/bitmapaccess.hxx> #include <vcl/wrkwin.hxx> #include <bufferdevice.hxx> +#include <window.h> #include <tools/stream.hxx> #include <vcl/pngwrite.hxx> @@ -28,11 +29,13 @@ public: void testVirtualDevice(); void testUseAfterDispose(); void testRTL(); + void testRTLGuard(); CPPUNIT_TEST_SUITE(VclOutdevTest); CPPUNIT_TEST(testVirtualDevice); CPPUNIT_TEST(testUseAfterDispose); CPPUNIT_TEST(testRTL); + CPPUNIT_TEST(testRTLGuard); CPPUNIT_TEST_SUITE_END(); }; @@ -112,6 +115,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 de5f7a1734d7..26802eab2a90 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -992,7 +992,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 00a658b9ed42..12eab3c6fe80 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -162,11 +162,11 @@ void ImplAnimView::drawToPos( sal_uLong nPos ) { VclPtr<vcl::RenderContext> pRenderContext = mpOut; - std::unique_ptr<PaintBufferGuard> pGuard; + std::unique_ptr<vcl::PaintBufferGuard> pGuard; if (mpOut->GetOutDevType() == OUTDEV_WINDOW) { vcl::Window* pWindow = static_cast<vcl::Window*>(mpOut.get()); - pGuard.reset(new PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); + pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); pRenderContext = pGuard->GetRenderContext(); } @@ -194,11 +194,11 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) { VclPtr<vcl::RenderContext> pRenderContext = mpOut; - std::unique_ptr<PaintBufferGuard> pGuard; + std::unique_ptr<vcl::PaintBufferGuard> pGuard; if (!pVDev && mpOut->GetOutDevType() == OUTDEV_WINDOW) { vcl::Window* pWindow = static_cast<vcl::Window*>(mpOut.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 c5c64684f1b9..27320b30a1ac 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 fca72f214022..da9b233eaea2 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.get()); m_pWindow->PushPaintHelper(this, *pFrameData->mpBuffer.get()); |