vcl/source/window/menu.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 5afd6b0b249272b7e86d1b20f21cd71fa639b330
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Dec 20 16:34:14 2024 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Tue Dec 24 13:01:05 2024 +0100

    tdf#164396: Fix the minimum size for menu
    
    It is not the full size of our minimal system requirements - it's
    half of that: when the menu appears from the middle of the screen,
    it only has half of the height.
    
    Since the original commit 643a1492bd648fbd803ca86aca600cc2bdaf5819
    (Add some fallback minimum size when screen size detection goes wrong,
    2020-03-11) only mentioned misdetection of 0, this change should
    be safe.
    
    Change-Id: If62f4ee90dc062c37547fea4e72df2569d78f956
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178940
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit c0149f76729ba0f13997134b3663f44c532fe828)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178956
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    (cherry picked from commit e86f4989461a20c11d906f87a9842b065c73d567)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179306

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 4ce56eb5af4c..42eca3617e29 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2981,11 +2981,12 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& 
pParentWin, tools::Rectang
     }
 
     // In certain cases this might be misdetected with a height of 0, leading 
to menus not being displayed.
-    // So assume that the available screen size matches at least the system 
requirements
-    SAL_WARN_IF(nMaxHeight < 768, "vcl",
+    // So assume that the available screen size matches at least the system 
requirements. With menu origin
+    // in the middle, nMaxHeight will be at least half of screen height.
+    SAL_WARN_IF(nMaxHeight < 768 / 2, "vcl",
                 "Available height misdetected as " << nMaxHeight
-                                                   << "px. Setting to 768px 
instead.");
-    nMaxHeight = std::max(nMaxHeight, tools::Long(768));
+                                                   << "px. Setting to 384px 
instead.");
+    nMaxHeight = std::max(nMaxHeight, tools::Long(768 / 2));
 
     if (pStartedFrom && pStartedFrom->IsMenuBar())
         nMaxHeight -= pParentWin->GetSizePixel().Height();

Reply via email to