[Libreoffice-commits] core.git: vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 17 17:09:36 UTC 2019


 vcl/source/control/combobox.cxx    |    2 ++
 vcl/source/control/imp_listbox.cxx |    9 ++++++++-
 vcl/source/control/listbox.cxx     |    2 ++
 vcl/source/control/scrbar.cxx      |    8 +++++++-
 4 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit d4714b0fdb81e6e561ae526cc517ecc9a40a603e
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jun 17 17:02:54 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jun 17 19:08:43 2019 +0200

    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 at collabora.com>

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();


More information about the Libreoffice-commits mailing list