From 93fc30708c1280301574128aa007292def064479 Mon Sep 17 00:00:00 2001 From: Tom Evers Date: Tue, 6 Feb 2024 15:09:52 +0100 Subject: [PATCH] Get the device pixel ratio from the correct device Fixes small mistake in 542cb876dce6077bb24fa5ee0439e7d21ac53f59 --- plugins/obs-vst/win/EditorWidget-win.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/obs-vst/win/EditorWidget-win.cpp b/plugins/obs-vst/win/EditorWidget-win.cpp index a645de5852e8af..223b9551facb04 100644 --- a/plugins/obs-vst/win/EditorWidget-win.cpp +++ b/plugins/obs-vst/win/EditorWidget-win.cpp @@ -35,8 +35,8 @@ void EditorWidget::buildEffectContainer(AEffect *effect) LONG_PTR wndPtr = (LONG_PTR)effect; SetWindowLongPtr(windowHandle, -21 /*GWLP_USERDATA*/, wndPtr); - QWidget *widget = QWidget::createWindowContainer( - QWindow::fromWinId((WId)windowHandle), nullptr); + QWindow *window = QWindow::fromWinId((WId)windowHandle); + QWidget *widget = QWidget::createWindowContainer(window, nullptr); widget->move(0, 0); QGridLayout *layout = new QGridLayout(); layout->setContentsMargins(0, 0, 0, 0); @@ -52,7 +52,7 @@ void EditorWidget::buildEffectContainer(AEffect *effect) // on Windows, the size reported by 'effect' is larger than // its actuall size by a factor of the monitor's ui scale, // so the window size should be divided by the factor - qreal scale_factor = devicePixelRatioF(); + qreal scale_factor = window->devicePixelRatio(); int width = vstRect->right - vstRect->left; int height = vstRect->bottom - vstRect->top; width = static_cast(width / scale_factor); @@ -81,7 +81,8 @@ void EditorWidget::handleResizeRequest(int, int) // on Windows, the size reported by 'effect' is larger than // its actuall size by a factor of the monitor's ui scale, // so the window size should be divided by the factor - qreal scale_factor = devicePixelRatioF(); + QWindow *window = QWindow::fromWinId((WId)windowHandle); + qreal scale_factor = window->devicePixelRatio(); int width = rec->right - rec->left; int height = rec->bottom - rec->top; width = static_cast(width / scale_factor);