From 6f65238efc4d698ea4396c70d2df59f9e162b954 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 6 May 2018 04:42:23 +0200 Subject: [PATCH] Qt: Fix "Render To Main" --- .../Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp | 2 ++ Source/Core/DolphinQt2/RenderWidget.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp index f35f9b71a9..b466740466 100644 --- a/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp @@ -212,6 +212,8 @@ void GeneralWidget::SaveSettings() SConfig::GetInstance().bFullscreen = m_enable_fullscreen->isChecked(); // Autoadjust window size SConfig::GetInstance().bRenderWindowAutoSize = m_autoadjust_window_size->isChecked(); + // Render To Main + SConfig::GetInstance().bRenderToMain = m_render_main_window->isChecked(); } void GeneralWidget::OnEmulationStateChanged(bool running) diff --git a/Source/Core/DolphinQt2/RenderWidget.cpp b/Source/Core/DolphinQt2/RenderWidget.cpp index 3865968fe1..04372e8e16 100644 --- a/Source/Core/DolphinQt2/RenderWidget.cpp +++ b/Source/Core/DolphinQt2/RenderWidget.cpp @@ -158,8 +158,14 @@ bool RenderWidget::event(QEvent* event) const QResizeEvent* se = static_cast(event); QSize new_size = se->size(); - const auto dpr = - QGuiApplication::screens()[QApplication::desktop()->screenNumber(this)]->devicePixelRatio(); + auto* desktop = QApplication::desktop(); + + int screen_nr = desktop->screenNumber(this); + + if (screen_nr == -1) + screen_nr = desktop->screenNumber(parentWidget()); + + const auto dpr = desktop->screen(screen_nr)->devicePixelRatio(); emit SizeChanged(new_size.width() * dpr, new_size.height() * dpr); break;