From 513483f8d59912fc4be6eb8f4765348bbfc17f9f Mon Sep 17 00:00:00 2001
From: Pierre de La Morinerie
Date: Fri, 11 Sep 2015 22:06:19 +0200
Subject: citra-qt: Use custom Info.plist for Mac builds
Instead of letting CMake re-generate an automatic Info.plist file on
every build, use our own. This allows greater control on the application
bundle settings.
---
src/citra_qt/CMakeLists.txt | 2 ++
src/citra_qt/Info.plist | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 src/citra_qt/Info.plist
(limited to 'src')
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 51a574629..747ad5519 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -24,6 +24,7 @@ set(SRCS
hotkeys.cpp
main.cpp
citra-qt.rc
+ Info.plist
)
set(HEADERS
@@ -72,6 +73,7 @@ endif()
if (APPLE)
add_executable(citra-qt MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS})
+ set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
else()
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
endif()
diff --git a/src/citra_qt/Info.plist b/src/citra_qt/Info.plist
new file mode 100644
index 000000000..0e5f092e5
--- /dev/null
+++ b/src/citra_qt/Info.plist
@@ -0,0 +1,36 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ English
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleGetInfoString
+
+ CFBundleIconFile
+ citra.icns
+ CFBundleIdentifier
+ com.citra-emu.citra
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleLongVersionString
+
+ CFBundleName
+ Citra
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+
+ CFBundleSignature
+ ????
+ CFBundleVersion
+
+ CSResourcesFileMapped
+
+ LSRequiresCarbon
+
+ NSHumanReadableCopyright
+
+
+
--
cgit v1.2.3
From 2f4a1e0d599df022a41e86a08cfb479212f75214 Mon Sep 17 00:00:00 2001
From: Pierre de La Morinerie
Date: Fri, 11 Sep 2015 22:08:15 +0200
Subject: citra-qt: Enable high-DPI widgets on Mac app
The OS will render the widgets using the system screen DPI (instead of
being locked at @1x resolution).
This has no impact on the existing high-DPI rendering code in Citra,
which means that the resolution of the emulated content is increased
to the real number of pixels, as on other platforms.
---
src/citra_qt/Info.plist | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'src')
diff --git a/src/citra_qt/Info.plist b/src/citra_qt/Info.plist
index 0e5f092e5..4c89e128b 100644
--- a/src/citra_qt/Info.plist
+++ b/src/citra_qt/Info.plist
@@ -32,5 +32,9 @@
NSHumanReadableCopyright
+ NSPrincipalClass
+ NSApplication
+ NSHighResolutionCapable
+ True
--
cgit v1.2.3
From ba5d0f594d9c9cc0dbadb4720511c76de93e6d0d Mon Sep 17 00:00:00 2001
From: Pierre de La Morinerie
Date: Thu, 10 Sep 2015 23:42:45 +0200
Subject: citra-qt: Fix mouse events coordinates on high-DPI screens
---
src/citra_qt/bootmanager.cpp | 31 +++++++++++++++++++------------
src/citra_qt/bootmanager.h | 2 ++
2 files changed, 21 insertions(+), 12 deletions(-)
(limited to 'src')
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index b19b367e1..8e60b9cad 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -181,16 +181,9 @@ void GRenderWindow::PollEvents() {
void GRenderWindow::OnFramebufferSizeChanged()
{
// Screen changes potentially incur a change in screen DPI, hence we should update the framebuffer size
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
- // windowHandle() might not be accessible until the window is displayed to screen.
- auto pixel_ratio = windowHandle() ? (windowHandle()->screen()->devicePixelRatio()) : 1.0;
-
- unsigned width = child->QPaintDevice::width() * pixel_ratio;
- unsigned height = child->QPaintDevice::height() * pixel_ratio;
-#else
- unsigned width = child->QPaintDevice::width();
- unsigned height = child->QPaintDevice::height();
-#endif
+ qreal pixelRatio = windowPixelRatio();
+ unsigned width = child->QPaintDevice::width() * pixelRatio;
+ unsigned height = child->QPaintDevice::height() * pixelRatio;
NotifyFramebufferLayoutChanged(EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height));
}
@@ -223,6 +216,16 @@ QByteArray GRenderWindow::saveGeometry()
return geometry;
}
+qreal GRenderWindow::windowPixelRatio()
+{
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ // windowHandle() might not be accessible until the window is displayed to screen.
+ return windowHandle() ? windowHandle()->screen()->devicePixelRatio() : 1.0f;
+#else
+ return 1.0f;
+#endif
+}
+
void GRenderWindow::closeEvent(QCloseEvent* event) {
emit Closed();
QWidget::closeEvent(event);
@@ -243,14 +246,18 @@ void GRenderWindow::mousePressEvent(QMouseEvent *event)
if (event->button() == Qt::LeftButton)
{
auto pos = event->pos();
- this->TouchPressed(static_cast(pos.x()), static_cast(pos.y()));
+ qreal pixelRatio = windowPixelRatio();
+ this->TouchPressed(static_cast(pos.x() * pixelRatio),
+ static_cast(pos.y() * pixelRatio));
}
}
void GRenderWindow::mouseMoveEvent(QMouseEvent *event)
{
auto pos = event->pos();
- this->TouchMoved(static_cast(std::max(pos.x(), 0)), static_cast(std::max(pos.y(), 0)));
+ qreal pixelRatio = windowPixelRatio();
+ this->TouchMoved(std::max(static_cast(pos.x() * pixelRatio), 0u),
+ std::max(static_cast(pos.y() * pixelRatio), 0u));
}
void GRenderWindow::mouseReleaseEvent(QMouseEvent *event)
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h
index 0a9d263b8..0dcf3e5eb 100644
--- a/src/citra_qt/bootmanager.h
+++ b/src/citra_qt/bootmanager.h
@@ -111,6 +111,8 @@ public:
void restoreGeometry(const QByteArray& geometry); // overridden
QByteArray saveGeometry(); // overridden
+ qreal windowPixelRatio();
+
void closeEvent(QCloseEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
--
cgit v1.2.3