summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-03-11 12:41:58 +0100
committerVasily Melenchuk <vasily.melenchuk@cib.de>2020-12-05 19:21:17 +0300
commitb831c530844aa8b4199349bf98e90b1c022c3e4a (patch)
treeade9d0bba5c5d664c203bcc233c5b208cd2eb4e9
parentcd70ce29f90219258d7c813e3acc6e66ac938217 (diff)
Add some fallback minimum size when screen size detection goes wrong
Change-Id: I97ec2359b8ae406e310a5d043ac068ddd89b3fd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90320 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 643a1492bd648fbd803ca86aca600cc2bdaf5819) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90575 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--vcl/source/window/menu.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 1d25c089e976..23ce82868e48 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2936,6 +2936,13 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const tools::R
nMaxHeight = std::min(nMaxHeight, std::max(nHeightAbove, nHeightBelow));
}
+ // 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",
+ "Available height misdetected as " << nMaxHeight
+ << "px. Setting to 768px instead.");
+ nMaxHeight = std::max(nMaxHeight, 768l);
+
if (pStartedFrom && pStartedFrom->IsMenuBar())
nMaxHeight -= pW->GetSizePixel().Height();
sal_Int32 nLeft, nTop, nRight, nBottom;