mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Revert "Linux: disable high dpi scaling on incorrect EDID"
This reverts commit 37cc9e8736
.
This commit is contained in:
parent
906ceabaec
commit
2d87a2275f
1 changed files with 9 additions and 32 deletions
41
main.cpp
41
main.cpp
|
@ -31,35 +31,6 @@ static void consoleMsgHandler(QtMsgType, const QMessageLogContext &, const QStri
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Workarounds for systems on which correct EDID info is not available */
|
||||
static inline void _handleDpi(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication tmp(argc, argv);
|
||||
QScreen *primaryScreen = QGuiApplication::primaryScreen();
|
||||
int w = primaryScreen->geometry().width();
|
||||
int h = primaryScreen->geometry().height();
|
||||
int w_mm = primaryScreen->physicalSize().width();
|
||||
int h_mm = primaryScreen->physicalSize().height();
|
||||
|
||||
#ifdef QT_NO_WIDGETS
|
||||
if (h > 720)
|
||||
{
|
||||
qputenv("QT_SCALE_FACTOR", QByteArray::number(h / 720.0, 'f', 2));
|
||||
}
|
||||
#else
|
||||
qDebug() << "Displaying on:"
|
||||
<< primaryScreen->manufacturer()
|
||||
<< primaryScreen->model()
|
||||
<< QString::number(w)+"x"+QString::number(h)
|
||||
<< QString::number(w_mm)+" mm x "+QString::number(h_mm)+" mm";
|
||||
if (w_mm < 100)
|
||||
{
|
||||
qDebug() << "Physical display dimensions seem unrealistically low. Disabling high DPI scaling";
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
|
@ -67,10 +38,16 @@ int main(int argc, char *argv[])
|
|||
// prefer ANGLE (DirectX) over desktop OpenGL
|
||||
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
_handleDpi(argc, argv);
|
||||
#endif
|
||||
#ifdef QT_NO_WIDGETS
|
||||
{
|
||||
QGuiApplication tmp(argc, argv);
|
||||
int h = QGuiApplication::primaryScreen()->geometry().height();
|
||||
if (h > 720)
|
||||
{
|
||||
qputenv("QT_SCALE_FACTOR", QByteArray::number(h / 720.0, 'f', 2));
|
||||
}
|
||||
}
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
#else
|
||||
QApplication app(argc, argv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue