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

New commits:
commit c0149f76729ba0f13997134b3663f44c532fe828
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Dec 20 16:34:14 2024 +0100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Dec 20 17:49:49 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>

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index d61736fac5f4..7b3c2a78be62 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -3001,11 +3001,12 @@ sal_uInt16 PopupMenu::ImplExecute(const 
VclPtr<vcl::Window>& pParentWin, const t
     }
 
     // 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