vcl/source/control/imp_listbox.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit d66fb70959b13dd822664867c363591b2c401767
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu May 5 14:24:16 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu May 5 21:42:09 2022 +0200

    tdf#148771 in scrollable dropdowns show some lines before selected entry
    
    and don't just position with the selected entry at the top so it's quick
    to pick preceeding adjacent entries
    
    Change-Id: I20103200c34037fb02b3c0dcc29d154c1197549d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133893
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/control/imp_listbox.cxx 
b/vcl/source/control/imp_listbox.cxx
index 13910084db77..fa01c647e9b0 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -1876,6 +1876,11 @@ void ImplListBoxWindow::SetTopEntry( sal_Int32 nTop )
 
 void ImplListBoxWindow::ShowProminentEntry( sal_Int32 nEntryPos )
 {
+    sal_Int32 nPos = nEntryPos;
+    auto nWHeight = PixelToLogic( GetSizePixel() ).Height();
+    while( nEntryPos > 0 && maEntryList.GetAddedHeight( nPos+1, nEntryPos ) < 
nWHeight/2 )
+        nEntryPos--;
+
     SetTopEntry( nEntryPos );
 }
 

Reply via email to