summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-12-20 16:34:14 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2024-12-20 17:49:49 +0100
commitc0149f76729ba0f13997134b3663f44c532fe828 (patch)
tree7fca3b3aec0f34e8d5981c32bb8b6979a68a37b5
parent0600d72f81a1f28652905ca818c2ffaf22f7421f (diff)
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.kaganski@collabora.com>
-rw-r--r--vcl/source/window/menu.cxx9
1 files changed, 5 insertions, 4 deletions
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();