# Issues with setGlobalScaleFactor on Windows standalone in latest dev?

**URL:** <https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291>\
**Category:** Windows\
**Created:** [September 6, 2018, 6:14am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291 "2018-09-06T06:14:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [September 6, 2018, 6:14am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/1 "2018-09-06T06:14:30Z")

</div>

Hi, has anyone notices any issues with this?

The code I use for scaling is:

```
auto& desktop = Desktop::getInstance();
desktop.setGlobalScaleFactor( scale );
// do stuff to resize main window

```

This continues to work on OSX and has worked on Windows up until recently. Now when scaled to anything other than 1.0 the mouse doesn’t track controls correctly and sometimes the display is rendering incorrectly. Not sure whether this is to do with HDPI changes recently.

Anyone else noticed any issues? I can do a video to demo if that’s useful.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [September 6, 2018, 8:26am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/2 "2018-09-06T08:26:09Z")

</div>

Yeah we’re aware of the issues and are working on getting a fix out. It’s related to the recent hiDPI support changes.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [September 6, 2018, 9:34am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/3 "2018-09-06T09:34:38Z")

</div>

great thx - let me know when it’s done and I’ll test.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [September 7, 2018, 3:35pm UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/4 "2018-09-07T15:35:49Z")

</div>

Hi, is there an eta for this or a quick fix to undo the problem? thx

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [September 7, 2018, 3:39pm UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/5 "2018-09-07T15:39:03Z")

</div>

You can disable the hiDPI support for the time being by disabling the `JUCE_WIN_PER_MONITOR_DPI_AWARE` flag in the `juce_gui_basics` module settings in the Projucer.

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [September 13, 2018, 10:19am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/6 "2018-09-13T10:19:13Z")

</div>

I had report as well that something broke in recent version of Juce with users that use my own app scaling factor (that uses setTransform on the main component) in combination with the windows one. It used to work in previous Juce versions.

Thanks !

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [September 27, 2018, 10:05am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/7 "2018-09-27T10:05:11Z")

</div>

Is this supposed to be fixed with commit from ed95 on the 19th of September ?

Thanks !

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [September 30, 2018, 3:25pm UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/8 "2018-09-30T15:25:16Z")

</div>

Yeah that commit should have fixed a few bugs with hiDPI support on Windows, with the global scale factor being one of them.

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [October 8, 2018, 7:02am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/9 "2018-10-08T07:02:42Z")

</div>

Looks like there are still issue. (using the trunk)  
We have reports of graphical issue when using OpenGL renderer that use to work fine couple of month ago.  
This happens when the Windows global scale is different than 100%  
Weirdly this happens only in plugin mode and we don’t use the Juce plugin wrapper.

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [October 8, 2018, 8:05am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/10 "2018-10-08T08:05:27Z")

</div>

Disabling JUCE\_WIN\_PER\_MONITOR\_DPI\_AWARE fixes the issue.

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [October 8, 2018, 10:26am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/11 "2018-10-08T10:26:19Z")

</div>

Probably related to the scaling applied twice.In the app and in juce\_OpenGL\_win32.h  
Don’t know much what would be the correct fix.

---

<div class="post-metadata">

**Author:** ![david-a-hoatson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/david-a-hoatson/32/15634_2.png) [@david-a-hoatson](https://forum.juce.com/u/david-a-hoatson)\
**Post date:** [November 28, 2018, 11:49pm UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/12 "2018-11-28T23:49:05Z")

</div>

The only way to fix it on my Windows 7 system is to disable OpenGL. Disabling JUCE\_WIN\_PER\_MONITOR\_DPI\_AWARE doesn’t do anything that I can see on Windows 7.

Is there any update as to when this might be fixed?

---

<div class="post-metadata">

**Author:** ![david-a-hoatson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/david-a-hoatson/32/15634_2.png) [@david-a-hoatson](https://forum.juce.com/u/david-a-hoatson)\
**Post date:** [November 29, 2018, 7:01pm UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/13 "2018-11-29T19:01:39Z")

</div>

Any ETA on fixing this? I’m having to disable OpenGL to get around this issue.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [November 30, 2018, 9:24am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/14 "2018-11-30T09:24:08Z")

</div>

Can you be more specific? Does this only happen on Windows 7 or are later versions of Windows also affected? Which plug-in formats, and in which DAWs?

---

<div class="post-metadata">

**Author:** ![david-a-hoatson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/david-a-hoatson/32/15634_2.png) [@david-a-hoatson](https://forum.juce.com/u/david-a-hoatson)\
**Post date:** [November 30, 2018, 9:58pm UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/15 "2018-11-30T21:58:08Z")

</div>

This is a stand-alone application. No DAW or Plug-in required or used.

JUCE 5.3.2; Windows 7; Works as expected.  
JUCE 5.4.0; Windows 7; Fails as described.  
JUCE 5.4.1; Windows 7; Fails as described.  
JUCE 5.4.1; Windows 10 Pro; Works as expected.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [December 3, 2018, 8:51am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/16 "2018-12-03T08:51:23Z")

</div>

OK, so just to be clear this is only happening when global scale factor != 1? Unfortunately we don’t have a Win7 machine to test this on but could you try changing the `getWindowScaleFactor()` method in `juce_OpenGL_win32.h` ([here](https://github.com/WeAreROLI/JUCE/blob/e786f9c0aa94cd67376d6863a5cfac1ca6d818c9/modules/juce_opengl/native/juce_OpenGL_win32.h#L164)) to this:

```auto
double getWindowScaleFactor (const Rectangle<int>& screenBounds)
{
    if (nativeWindow != nullptr && shouldScaleGLWindow (nativeWindow->getNativeHandle()))
        return Desktop::getInstance().getDisplays().findDisplayForRect (screenBounds).scale;

    return Desktop::getInstance().getGlobalScaleFactor();
}

```

and see if that fixes the issue?

---

<div class="post-metadata">

**Author:** ![pflugshaupt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pflugshaupt/32/13206_2.png) [@pflugshaupt](https://forum.juce.com/u/pflugshaupt)\
**Post date:** [December 3, 2018, 8:57am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/17 "2018-12-03T08:57:31Z")

</div>

> [@ed95](#):
>
> Unfortunately we don’t have a Win7 machine

I’m sorry to be annoying but I have a hard time accepting you guys don’t at least have a VM for each recent OS to test with!

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [December 3, 2018, 9:11am UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/18 "2018-12-03T09:11:54Z")

</div>

We do have one, but it’s a spectacular pain to use - it’s tied up in our CI system and is extremely slow to use interactively. If it’s possible to debug vicariously via the forum that will be a more efficient use of time.

---

<div class="post-metadata">

**Author:** ![david-a-hoatson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/david-a-hoatson/32/15634_2.png) [@david-a-hoatson](https://forum.juce.com/u/david-a-hoatson)\
**Post date:** [December 3, 2018, 5:10pm UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/19 "2018-12-03T17:10:15Z")

</div>

Yes, that fixed the issue on Windows 7. Thank you! Is that something you plan on rolling back into the standard source?

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [December 3, 2018, 5:11pm UTC](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291/20 "2018-12-03T17:11:12Z")

</div>

OK, great. I’ll get it pushed to the develop branch now, it’ll make its way onto master and the website downloads when we do a point release.

[Next page](https://forum.juce.com/t/issues-with-setglobalscalefactor-on-windows-standalone-in-latest-dev/29291.md?page=2)
