r23575 by jghali - Make ScribusMainWindow::getScreenData() safer

scribus-commit scribus-commit at lists.scribus.net
Wed Apr 8 22:34:16 UTC 2020


Author: jghali
Date: Wed Apr  8 22:34:16 2020
New Revision: 23575

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23575
Log:
Make ScribusMainWindow::getScreenData() safer

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23575&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Wed Apr  8 22:34:16 2020
@@ -507,6 +507,10 @@
 void ScribusMainWindow::getScreenData(int& screenNumber, int& xPos, int& yPos)
 {
 	QList<QScreen*> screens = QGuiApplication::screens();
+	screenNumber = 0;
+	xPos = 0;
+	yPos = 0;
+
 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
 	QWindow* w = ScCore->primaryMainWindow()->windowHandle();
 	if (w != nullptr)
@@ -517,6 +521,10 @@
 	QScreen* s = ScCore->primaryMainWindow()->screen();
 	screenNumber = screens.indexOf(s);
 #endif
+	if (screenNumber < 0)
+		screenNumber = screens.indexOf(QGuiApplication::primaryScreen());
+	if (screenNumber < 0)
+		screenNumber = 0;
 	QRect screenGeom = screens.at(screenNumber)->geometry();
 	xPos = screenGeom.left();
 	yPos = screenGeom.top();




More information about the scribus-commit mailing list