# getMouseXYRelative ignoring window offset

**URL:** <https://forum.juce.com/t/getmousexyrelative-ignoring-window-offset/35677>\
**Category:** General JUCE discussion\
**Created:** [October 14, 2019, 4:15pm UTC](https://forum.juce.com/t/getmousexyrelative-ignoring-window-offset/35677 "2019-10-14T16:15:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheWaveWarden](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thewavewarden/32/13708_2.png) [@TheWaveWarden](https://forum.juce.com/u/TheWaveWarden)\
**Post date:** [October 14, 2019, 4:15pm UTC](https://forum.juce.com/t/getmousexyrelative-ignoring-window-offset/35677/1 "2019-10-14T16:15:43Z")

</div>

I’m having a weird issue, where `getMouseXYRelative()` acts like the plugin-window was in the top left corner off the screen regardless where it actually is. Meaning: if I position the window top-left, everything works fine, moving it away, I have to trigger the sections as if it was top-left.

I only have this issue in the VST2-build, the standalone acts normal (both Linux).

I tried to dig a litte deeper: The function `getMouseXYRelative()` seems to be calling

```auto
Point<int> Component::getMouseXYRelative() const
{
    return getLocalPoint (nullptr, Desktop::getMousePosition());
}

```

which in turn tries to find the highest level component and then calculate the offset.  
However I have no clue what could be wrong. Anyone with an idea?

EDIT: It seems to me that all are working well, only the highest level conversion (window → screen) is failing. Hence the absence of the offset.

---

<div class="post-metadata">

**Author:** ![TheWaveWarden](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thewavewarden/32/13708_2.png) [@TheWaveWarden](https://forum.juce.com/u/TheWaveWarden)\
**Post date:** [October 14, 2019, 6:09pm UTC](https://forum.juce.com/t/getmousexyrelative-ignoring-window-offset/35677/2 "2019-10-14T18:09:41Z")

</div>

Update: I remembered I updated JUCE recently, so I tried to roll back and the issue was resolved.

The working version: JUCE 5.4.3  
Non-working: JUCE 5.4.4

I’ll stay on the old version then (I updated primarily to get rid of the popup 😇)  
Maybe the problem was on my side, but if other users experience the same there could be a problem in the new version.

---

<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:** [October 15, 2019, 11:17am UTC](https://forum.juce.com/t/getmousexyrelative-ignoring-window-offset/35677/3 "2019-10-15T11:17:52Z")

</div>

There were a few changes in the Linux windowing code between 5.4.3 and 5.4.4. Can you see if the following commit fixes the issue for you?

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

---

<div class="post-metadata">

**Author:** ![TheWaveWarden](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thewavewarden/32/13708_2.png) [@TheWaveWarden](https://forum.juce.com/u/TheWaveWarden)\
**Post date:** [October 16, 2019, 6:08pm UTC](https://forum.juce.com/t/getmousexyrelative-ignoring-window-offset/35677/4 "2019-10-16T18:08:12Z")

</div>

@ed95 Yes, I can confirm it fixes the issue! 🙂
