# Secondary Window launched from plugin gets incorrect monitor scaling

**URL:** <https://forum.juce.com/t/secondary-window-launched-from-plugin-gets-incorrect-monitor-scaling/51319>\
**Category:** Windows\
**Created:** [May 6, 2022, 12:52am UTC](https://forum.juce.com/t/secondary-window-launched-from-plugin-gets-incorrect-monitor-scaling/51319 "2022-05-06T00:52:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [May 6, 2022, 12:52am UTC](https://forum.juce.com/t/secondary-window-launched-from-plugin-gets-incorrect-monitor-scaling/51319/1 "2022-05-06T00:52:35Z")

</div>

I’ve created a simple plugin project to demonstrate an issue I’m having (on Windows 10). JUCE 6.1.6. You click a button in the plugin window to open a secondary window.

[TwoWindowsPlug.zip](https://forum.juce.com/uploads/short-url/6oyom4vX13XCzpt2083BvW7rkop.zip) (30.4 KB)

My plugin can launch a few separate windows - for debugging purposes. I know it is not recommended to have additional windows in a released plugin.

But in any case, when I run the display with Display Scaling at 100%, the secondary window opens the correct size (same as the main plugin in this example project):

![100](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/a/ac32cf3c59faf60f129f4d2145ab1488beeac6fe.png)

 ![test1](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/6/6bcb34db2c5eae4941147c5d930cfc98a466ce0d.png)

When I set the Windows Display Scaling to 150%, the AudioPluginHost and the plugin’s window open at the same size, but the secondary window opens at 75%:

![150](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/3/37d5b7c01fe0a536a59144400237016ee28f012b.png)

 ![test2](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/c/ca695be8a86332dfe82db560c22020d734e766b8.png)

Is there something I should be doing to fix this?

---

<div class="post-metadata">

**Author:** ![Bgraf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bgraf/32/7204_2.png) [@Bgraf](https://forum.juce.com/u/Bgraf)\
**Post date:** [May 6, 2022, 12:33pm UTC](https://forum.juce.com/t/secondary-window-launched-from-plugin-gets-incorrect-monitor-scaling/51319/2 "2022-05-06T12:33:13Z")

</div>

I had a similar issue for extra windows with hdpi monitors. I solved it in a similar way as it has been solved for Tooltip and Alert windows:

In my document window:

```auto
protected:
    /** @internal */
    float getDesktopScaleFactor() const override {
        return scale * Desktop::getInstance().getGlobalScaleFactor();
    }

```

where scale is a member variable which I set in the window constructor with a value passed in by the main editor window:

```auto
showSecondWindow (){
    float scale = Component::getApproximateScaleFactorForComponent( this );
    newWindow = std::make_unique<MyDocumentWindow>(scale);
   ...
}

```

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [May 7, 2022, 7:36pm UTC](https://forum.juce.com/t/secondary-window-launched-from-plugin-gets-incorrect-monitor-scaling/51319/3 "2022-05-07T19:36:17Z")

</div>

@Bgraf - thank you! I tried this and it works.
