I make a iphone remote mouse controller application for Mac: the iPhone application sends the coordinate values to the Mac, which then processes mouse location value.
To get the current mouse location on the Mac, the receiver calls [NSEvent mouseLocation].
The value for x is always correct, but the value for y is wrong.
I used a "while" loop to process this event.
while (1) {
mouseLoc = [NSEvent mouseLocation];
while ((msgLength = recv(clientSocket, buffer, sizeof(buffer), 0)) != 0) {
CGPoint temp;
temp.x = mouseLoc.x;
temp.y = mouseLoc.y; // wrong value
........
A y value is different at each loop period. For example, y value is 400 at first loop, y is 500 at next loop; then y is 400 again at next loop.
The mouse pointer is coming up and down continuously, and sum of two different y values is always 900. (I think because the screen resolution is 1440 * 900.)
I don't know why it happens, what to do, and how to debug it.
mouseLocation
is not a static method. – CitifiedNSEvent
. – Quasi