# Linux setGlobalScaleFactor doesn't work correctly

**URL:** <https://forum.juce.com/t/linux-setglobalscalefactor-doesnt-work-correctly/32918>\
**Category:** Linux\
**Created:** [April 18, 2019, 11:30am UTC](https://forum.juce.com/t/linux-setglobalscalefactor-doesnt-work-correctly/32918 "2019-04-18T11:30:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![harrycodex](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@harrycodex](https://forum.juce.com/u/harrycodex)\
**Post date:** [April 18, 2019, 11:30am UTC](https://forum.juce.com/t/linux-setglobalscalefactor-doesnt-work-correctly/32918/1 "2019-04-18T11:30:39Z")

</div>

It looks like the GlobalScale is being applied twice on Linux X11. We were not having this issue on JUCE 4.3.1. I am testing on JUCE 5.4.1.

Reproduce by adding `Desktop::getInstance().setGlobalScaleFactor(2.0);` to the MainAppWindow constructor in DemoRunner.

It looks better if I use the following diff (but I do not have a lot of X11 experience and have not tested this thoroughly - this is not a Pull Request).

```
diff --git a/modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp b/modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp
index ab9b9496b..402fe6f35 100644
--- a/modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp
+++ b/modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp
@@ -1809,7 +1809,7 @@ public:
    template <typename EventType>
    Point<float> getMousePos (const EventType& e) noexcept
    {
- return Point<float> ((float) e.x, (float) e.y) / currentScaleFactor;
+ return Point<float> ((float) e.x, (float) e.y);// / currentScaleFactor;^M
    }

    void handleWheelEvent (const XButtonPressedEvent& buttonPressEvent, float amount)
@@ -2307,7 +2307,7 @@ private:
                {
                    std::unique_ptr<LowLevelGraphicsContext> context (peer.getComponent().getLookAndFeel()
                                                                        .createGraphicsContext (image, -totalArea.getPosition(), adjustedList));
- context->addTransform (AffineTransform::scale ((float) peer.currentScaleFactor));
+ //context->addTransform (AffineTransform::scale ((float) peer.currentScaleFactor));^M
                    peer.handlePaint (*context);
                }

```

UPDATES:

- Reproduced on 5.4.3-16-g49c631e91 (git describe) and develop
- I cannot reproduce on 4.3.1
- That patch is not complete, although scale factors for mouse clicks and widgets seem right the area in the windows that is repainted is sometimes wrong. I had bits of scrollbars stick around when moved and similar.

---

<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:** [April 18, 2019, 1:32pm UTC](https://forum.juce.com/t/linux-setglobalscalefactor-doesnt-work-correctly/32918/2 "2019-04-18T13:32:22Z")

</div>

> <https://github.com/WeAreROLI/JUCE/commit/a45f05c1dbd0778dbe04ca3688ada4377d2f77a6>

Does this fix the issue for you?

---

<div class="post-metadata">

**Author:** ![harrycodex](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@harrycodex](https://forum.juce.com/u/harrycodex)\
**Post date:** [April 18, 2019, 1:43pm UTC](https://forum.juce.com/t/linux-setglobalscalefactor-doesnt-work-correctly/32918/3 "2019-04-18T13:43:48Z")

</div>

That looks like it fixes it for me @ed95, cheers
