graphics/dspdfviewer: Fixes build with Qt 5.13

Submitted by:	adridg
Approved by:	philip (mentor)
This commit is contained in:
Santhosh Raju
2019-09-04 02:08:27 +00:00
parent aac0e82f7f
commit 2a4da933b6
2 changed files with 43 additions and 1 deletions

View File

@@ -3,7 +3,7 @@
PORTNAME= dspdfviewer
PORTVERSION= 1.15.1
DISTVERSIONPREFIX= v
PORTREVISION= 19
PORTREVISION= 20
CATEGORIES= graphics
MAINTAINER= fox@FreeBSD.org

View File

@@ -0,0 +1,42 @@
Fix graphics/dspdfviewer build w/ Qt 5.13
- adjust to deprecated methods
- QApplication::flush() hasn't really been a thing since Qt4,
just comment it out.
The application looks abandoned upstream.
Patched by adridg@freebsd.org
--- pdfviewerwindow.cpp.orig 2016-09-13 13:18:47 UTC
+++ pdfviewerwindow.cpp
@@ -24,6 +24,7 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QMouseEvent>
+#include <QScreen>
#if defined(POPPLER_QT5) && defined(_WIN32)
#include <QWindow>
#endif
@@ -116,7 +117,12 @@ void PDFViewerWindow::reposition()
this->windowHandle()->setScreen(0);
this->showFullScreen();
#else
- QRect rect = QApplication::desktop()->screenGeometry( numeric_cast<int>(getMonitor()) );
+ auto screens = QGuiApplication::screens();
+ int screen_number = numeric_cast<int>(getMonitor());
+ if ((screen_number < 0) || (screen_number >= screens.length())) {
+ screen_number = 0;
+ }
+ QRect rect = screens.at(screen_number)->geometry();
move(rect.topLeft());
resize( rect.size() );
this->showFullScreen();
@@ -381,7 +387,7 @@ void PDFViewerWindow::resizeEvent(QResizeEvent* resize
! i3shellcode_executed
// Make sure to do this only once
) {
- QApplication::flush(); // Make sure the window has been painted
+ // QApplication::flush(); // Make sure the window has been painted
// This is the second screen. It has now been created.
// so we should call the i3 shellcode now
const std::string shellcode = runtimeConfiguration.i3workaround_shellcode();