vcl/source/app/svapp.cxx   |   11 ++++++++++-
 vcl/source/window/menu.cxx |    7 +++++++
 vcl/win/app/salinfo.cxx    |   10 +++++++++-
 3 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 5d8e07231b6e8b106292f212a3c80be004e11d6a
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Thu Mar 12 14:12:59 2020 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Mon Mar 16 18:26:57 2020 +0100

    Some more checks for correct screen size
    
    Change-Id: Id5a811e4227052fd9117ab2b099de31e8e3b90c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90413
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
    (cherry picked from commit 3741d70743c297029f54b20b0ca711f40cff7097)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90576
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 33420e5456fc..5a02e96b05a5 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1229,7 +1229,16 @@ unsigned int Application::GetDisplayExternalScreen()
 tools::Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen )
 {
     SalSystem* pSys = ImplGetSalSystem();
-    return pSys ? pSys->GetDisplayScreenPosSizePixel( nScreen ) : 
tools::Rectangle();
+    if (!pSys)
+    {
+        SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen 
<< " failed");
+        assert(false);
+        return tools::Rectangle();
+    }
+    tools::Rectangle aRect = pSys->GetDisplayScreenPosSizePixel(nScreen);
+    if (aRect.getHeight() == 0)
+        SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen 
<< " returned 0 height.");
+    return aRect;
 }
 
 namespace {
diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index 90fa81b04d0e..ba914e280e82 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -21,6 +21,7 @@
 #include <rtl/ustrbuf.hxx>
 #include <o3tl/char16_t2wchar_t.hxx>
 
+#include <sal/log.hxx>
 #include <vcl/window.hxx>
 
 #include <win/salsys.h>
@@ -161,7 +162,14 @@ unsigned int WinSalSystem::GetDisplayBuiltInScreen()
 tools::Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int 
nScreen )
 {
     initMonitors();
-    return (nScreen < m_aMonitors.size()) ? m_aMonitors[nScreen].m_aArea : 
tools::Rectangle();
+    if (nScreen >= m_aMonitors.size())
+    {
+        SAL_WARN("vcl", "Requested screen size/pos for screen #"
+                            << nScreen << ", but only " << m_aMonitors.size() 
<< " screens found.");
+        assert(false);
+        return tools::Rectangle();
+    }
+    return m_aMonitors[nScreen].m_aArea;
 }
 
 int WinSalSystem::ShowNativeMessageBox(const OUString& rTitle, const OUString& 
rMessage)
commit a22c6cdc74584ae6c9efd731ea524de210ec8c2c
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Wed Mar 11 12:41:58 2020 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Mon Mar 16 18:26:42 2020 +0100

    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.behr...@cib.de>
    (cherry picked from commit 643a1492bd648fbd803ca86aca600cc2bdaf5819)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90575
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index a2d6083c234f..e2733c607e24 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2927,6 +2927,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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to