mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 10:02:31 -06:00
Fix macOS pixel ratio detection
This commit is contained in:
parent
045eec282a
commit
5d97e44279
2 changed files with 3 additions and 2 deletions
|
@ -144,8 +144,8 @@ QByteArray GRenderWindow::saveGeometry() {
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal GRenderWindow::windowPixelRatio() const {
|
qreal GRenderWindow::windowPixelRatio() const {
|
||||||
// windowHandle() might not be accessible until the window is displayed to screen.
|
// QOpenGLWidget isn't backed by a native window, so we need to use the top level window instead
|
||||||
return windowHandle() ? windowHandle()->screen()->devicePixelRatio() : 1.0f;
|
return QApplication::activeWindow()->devicePixelRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<u32, u32> GRenderWindow::ScaleTouch(const QPointF pos) const {
|
std::pair<u32, u32> GRenderWindow::ScaleTouch(const QPointF pos) const {
|
||||||
|
|
|
@ -2062,6 +2062,7 @@ int main(int argc, char* argv[]) {
|
||||||
std::string bin_path = FileUtil::GetBundleDirectory() + DIR_SEP + "..";
|
std::string bin_path = FileUtil::GetBundleDirectory() + DIR_SEP + "..";
|
||||||
chdir(bin_path.c_str());
|
chdir(bin_path.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
|
QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
|
||||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
Loading…
Reference in a new issue