diff options
Diffstat (limited to 'src/citra_qt/bootmanager.cpp')
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 20824692d..516e115fd 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -2,6 +2,12 @@ | |||
| 2 | #include <QKeyEvent> | 2 | #include <QKeyEvent> |
| 3 | #include <QApplication> | 3 | #include <QApplication> |
| 4 | 4 | ||
| 5 | #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) | ||
| 6 | // Required for screen DPI information | ||
| 7 | #include <QScreen> | ||
| 8 | #include <QWindow> | ||
| 9 | #endif | ||
| 10 | |||
| 5 | #include "common/common.h" | 11 | #include "common/common.h" |
| 6 | #include "bootmanager.hxx" | 12 | #include "bootmanager.hxx" |
| 7 | 13 | ||
| @@ -176,6 +182,24 @@ void GRenderWindow::PollEvents() { | |||
| 176 | */ | 182 | */ |
| 177 | } | 183 | } |
| 178 | 184 | ||
| 185 | // On Qt 5.1+, this correctly gets the size of the framebuffer (pixels). | ||
| 186 | // | ||
| 187 | // Older versions get the window size (density independent pixels), | ||
| 188 | // and hence, do not support DPI scaling ("retina" displays). | ||
| 189 | // The result will be a viewport that is smaller than the extent of the window. | ||
| 190 | void GRenderWindow::GetFramebufferSize(int* fbWidth, int* fbHeight) | ||
| 191 | { | ||
| 192 | #if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) | ||
| 193 | int pixelRatio = child->QPaintDevice::devicePixelRatio(); | ||
| 194 | |||
| 195 | *fbWidth = child->QPaintDevice::width() * pixelRatio; | ||
| 196 | *fbHeight = child->QPaintDevice::height() * pixelRatio; | ||
| 197 | #else | ||
| 198 | *fbWidth = child->QPaintDevice::width(); | ||
| 199 | *fbHeight = child->QPaintDevice::height(); | ||
| 200 | #endif | ||
| 201 | } | ||
| 202 | |||
| 179 | void GRenderWindow::BackupGeometry() | 203 | void GRenderWindow::BackupGeometry() |
| 180 | { | 204 | { |
| 181 | geometry = ((QGLWidget*)this)->saveGeometry(); | 205 | geometry = ((QGLWidget*)this)->saveGeometry(); |