JUCE SetCursorPos() equivalent


#1

Im trying to find an equivalent function to windows SetCursorPos() to use it in osX, but I can’t find it.
I tried this:
Point newPosition(middleX+240, middleY+164);
Array sources=Desktop::getInstance().getMouseSources();
sources[0].setScreenPosition(newPosition);

But I get this error

/JUCE/modules/juce_core/containers/juce_Array.h:251:16: No matching constructor for initialization of ‘juce::MouseInputSource’


#2

I just figured it out, if someone needs this.

Point newPosition(middleX, middleY);
Desktop::getInstance().getMouseSource (0)->setScreenPosition(newPosition);


#3

I’ve just used this one with no issue:

Desktop::setMousePosition(point);