summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-06-17 17:02:54 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-06-17 19:08:43 +0200
commitd4714b0fdb81e6e561ae526cc517ecc9a40a603e (patch)
treee02901728616ef7ab881c09c8a4c6b397e6f7a89 /vcl
parent2be2c914ed48823304c2e95a836ee93a08853628 (diff)
tdf#101978 vcl combobox/listbox floating window: avoid flicker
Regression from commit dca01def7885ad69cf66edd75cf8207a5adb64f9 (refactor ListBox/ComboBox to use RenderContext, 2015-05-07), the problem was that with VCL backends which don't paint on idle, the widget flickered on keyboard / mouse interaction, similar to the Calc autofilter. To avoid side-effects: - Avoid direct paint in ScrollBar::ImplDragThumb(), instead do Invalidate() + Update(), which is the same, but this way dragging the scrollbar with the mouse doesn't fails an assertion (because we tried to paint directly on a double-buffered window). - Only call RequestDoubleBuffering() for backends which don't handle focus themselves (i.e. not for gtk3); to be in sync with the Calc autofilter behavior. Change-Id: Iec9ad2fe9d32efb8da65cc26cf89cc47912bf545 Reviewed-on: https://gerrit.libreoffice.org/74176 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/combobox.cxx2
-rw-r--r--vcl/source/control/imp_listbox.cxx9
-rw-r--r--vcl/source/control/listbox.cxx2
-rw-r--r--vcl/source/control/scrbar.cxx8
4 files changed, 19 insertions, 2 deletions
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 109c8374243b..31f8a0373f52 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -194,6 +194,8 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
if( nStyle & WB_DROPDOWN )
{
m_pImpl->m_pFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this );
+ if (!IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Focus))
+ m_pImpl->m_pFloatWin->RequestDoubleBuffering(true);
m_pImpl->m_pFloatWin->SetAutoWidth( true );
m_pImpl->m_pFloatWin->SetPopupModeEndHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplPopupModeEndHdl) );
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index d6efa0e726ab..037fe20299f5 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -1910,7 +1910,14 @@ void ImplListBoxWindow::ImplDoPaint(vcl::RenderContext& rRenderContext, const to
void ImplListBoxWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{
- ImplDoPaint(rRenderContext, rRect);
+ if (SupportsDoubleBuffering())
+ {
+ // This widget is explicitly double-buffered, so avoid partial paints.
+ tools::Rectangle aRect(Point(0, 0), GetOutputSizePixel());
+ ImplDoPaint(rRenderContext, aRect);
+ }
+ else
+ ImplDoPaint(rRenderContext, rRect);
}
sal_uInt16 ImplListBoxWindow::GetDisplayLineCount() const
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index 08855cef701d..e991978d71ab 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -119,6 +119,8 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
}
mpFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this );
+ if (!IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Focus))
+ mpFloatWin->RequestDoubleBuffering(true);
mpFloatWin->SetAutoWidth( true );
mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) );
mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop);
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 19db246006b7..b20711d5e2f8 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -816,7 +816,13 @@ void ScrollBar::ImplDragThumb( const Point& rMousePos )
// When dragging in windows the repaint request gets starved so dragging
// the scrollbar feels slower than it actually is. Let's force an immediate
// repaint of the scrollbar.
- ImplDraw(*this);
+ if (SupportsDoubleBuffering())
+ {
+ Invalidate();
+ Update();
+ }
+ else
+ ImplDraw(*this);
mnDelta = mnThumbPos-nOldPos;
Scroll();