Improve QT_QPA_EGLFS_KMS_CONFIG temporary file handling

- Close it before handing it to the QPA plugin to read
- Put the temporary file in TMPDIR instead of the current directory
This commit is contained in:
Cameron Gutman
2025-12-01 00:36:59 -06:00
parent 9d5f25f828
commit 5feb331c46

View File

@@ -418,9 +418,9 @@ int main(int argc, char *argv[])
#endif
// We keep this at function scope to ensure it stays around while we're running,
// becaue the Qt QPA will need to read it. Since the temporary file is only
// because the Qt QPA will need to read it. Since the temporary file is only
// created when open() is called, this doesn't do any harm for other platforms.
QTemporaryFile eglfsConfigFile("eglfs_override_XXXXXX.conf");
QTemporaryFile eglfsConfigFile;
// Avoid using High DPI on EGLFS. It breaks font rendering.
// https://bugreports.qt.io/browse/QTBUG-64377
@@ -463,6 +463,7 @@ int main(int argc, char *argv[])
qInfo() << "Overriding default Qt EGLFS card selection to" << cardOverride;
QTextStream(&eglfsConfigFile) << "{ \"device\": \"" << cardOverride << "\" }";
qputenv("QT_QPA_EGLFS_KMS_CONFIG", eglfsConfigFile.fileName().toUtf8());
eglfsConfigFile.close();
}
}
}