vcl/source/control/combobox.cxx |   10 ++++++++--
 vcl/source/control/listbox.cxx  |   10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 4640bca67bfd60c043ea984eda3de0bded05b3f7
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri Mar 14 16:17:49 2025 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Mar 17 08:31:35 2025 +0100

    lokit: don't double-buffer combo/list box dropdowns
    
    we don't need them and they take up a noticeable amount
    of dead memory
    
    .e.g. before: 57140k, after 56732k for a blank writer
    document.
    
    Change-Id: I50b378989c01e5e2a94e06c8e78a08dfb3829ef8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182929
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 82520cc765f4..4625a0b21d4a 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -199,8 +199,14 @@ 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);
+        // For Kit jsdialogs we don't need or want a buffer the size of
+        // the ComboBox dropdown taking up memory which is unnecessary
+        // in that case.
+        if (!comphelper::LibreOfficeKit::isActive())
+        {
+            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/listbox.cxx b/vcl/source/control/listbox.cxx
index e189c8480f05..818ddd1e40b5 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -109,8 +109,14 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits 
nStyle )
         }
 
         mpFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this );
-        if (!IsNativeControlSupported(ControlType::Pushbutton, 
ControlPart::Focus))
-            mpFloatWin->RequestDoubleBuffering(true);
+        // For Kit jsdialogs we don't need or want a buffer the size of
+        // the ListBox dropdown taking up memory which is unnecessary
+        // in that case.
+        if (!comphelper::LibreOfficeKit::isActive())
+        {
+            if (!IsNativeControlSupported(ControlType::Pushbutton, 
ControlPart::Focus))
+                mpFloatWin->RequestDoubleBuffering(true);
+        }
         mpFloatWin->SetAutoWidth( true );
         mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, 
ImplPopupModeEndHdl ) );
         mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop);

Reply via email to