obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

obs-vst: Get devicePixelRatio from correct device

Open Tom-Evers opened this issue 1 year ago • 2 comments

Fixes small mistake in 542cb876dce6077bb24fa5ee0439e7d21ac53f59

Description

Should fix a small mistake in 542cb876dce6077bb24fa5ee0439e7d21ac53f59 by taking the scaling factor (dpi) from the display the widget is on, instead of the main display

Motivation and Context

The old commit took the scale factor with devicePixelRatioF, but that seems to be the scale factor of the main monitor. Which is not necessarily the same as the scale factor the VST plugin (widget) is on.

And this indeed causes a problem in the following situation

  • I'm running OBS on my second monitor on 100%
  • My main monitor is running on 125%
  • I open the plugin window, which reports a size of 1000x500 (and creates a child window of that size)
  • OBS gives me a host window on my second (100%) monitor

Expected behaviour:

  • The host window is 1000x500 as it is on a 100% monitor

Observed behaviour:

  • The host window is scaled down to 800x400 (divided by 1.25)

Here is an image of the consequences (note the cut-off contents on the right and bottom sides): image

How Has This Been Tested?

It hasn't.

Types of changes

I'm calling a function on a specific window.

Checklist:

  • [ ] My code has been run through clang-format.
  • [ ] I have read the contributing document.
  • [ ] My code is not on the master branch.
  • [ ] The code has been tested.
  • [ ] All commit messages are properly formatted and commits squashed where appropriate.
  • [ ] I have included updates to all appropriate documentation. This is my first ever pull request, no idea what to do or how to do these things. I just wanted to fix a bug.

Tom-Evers avatar Feb 06 '24 14:02 Tom-Evers

Please be sure to select an option under "Types of changes" and fill out the checklist as appropriate in the PR template. Please also make sure that your commit message and PR title conform with our Commit Guidelines.

I cannot change the commit message anymore (without force pushing anyway).

I don't want to sound like a complete a-hole, but I really don't have time to spend on this. Could someone just check if this works and put it in the next beta if it does?

Tom-Evers avatar Feb 07 '24 16:02 Tom-Evers

I cannot change the commit message anymore (without force pushing anyway).

Force pushing to fix commit messages is fine.

Could someone just check if this works and put it in the next beta if it does?

I don't use VSTs and I don't have multiple displays, so I cannot validate this. Someone else will have to do it, which occurs on their own free time when they can.

RytoEX avatar Feb 07 '24 17:02 RytoEX