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

New commits:
commit 1a25ff64326ab6668e107e8daaf87d20af8987de
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri Mar 14 16:17:49 2025 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Mar 14 20:59:44 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/+/182927
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index e8d93f1ea52c..08651f048969 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -157,8 +157,14 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits 
nStyle )
     if( nStyle & WB_DROPDOWN )
     {
         m_pFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this );
-        if (!IsNativeControlSupported(ControlType::Pushbutton, 
ControlPart::Focus))
-            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_pFloatWin->RequestDoubleBuffering(true);
+        }
         m_pFloatWin->SetAutoWidth( true );
         m_pFloatWin->SetPopupModeEndHdl(LINK(this, ComboBox, 
ImplPopupModeEndHdl));
 
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index beaa0cc19c06..3638233486dc 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