Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions plugins/obs-vst/win/EditorWidget-win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<int>(width / scale_factor);
Expand Down Expand Up @@ -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<int>(width / scale_factor);
Expand Down