nut-tree/libnut-core

Mouse click doesn't work on external monitor with negative x and y

morajabi opened this issue · 0 comments

Version
2.1.2

Short overview
Mouse move works well on bounds like -20, -200 using an external monitor. But as soon as I do mouseClick, it moves the mouse the primary display. It's like it doesn't support negative bounds.

Detailed error description
image
The real position obtained from Electron, versus the incorrect unsigned position returned by libnut.getMousePos().

Steps to reproduce error
nut.mouseClick(-20, -200)

Solution
You should use

#define MMSignedPointFromCGPoint(p) MMPointMake((int32_t)(p).x, (int32_t)(p).y)

instead of MMPointFromCGPoint

I'm on M1 MacBook 13" Pro.