Mac mouse problems - possible fix

Hi there folks,

Do you compile your own builds, and own a Mac ( PPC, or possibly an Intel Mac and running the non-intel build )?

With regard to the bug on some Macs with the mouseLoc ( see http://blenderartists.org/forum/showthread.php?t=60556&highlight=mac+mouselook ), I had a look into how it might be fixed.

I don’t have a Mac here, so I can’t test it myself :slight_smile:

If you build your own versions of Blender, could you try this.

Firstly, see if you are finding the problem with the Mac.
Download and run this script ( the script was created by someone else ).
http://www.candointeractive.com/blender/mousebug.blend

Hopefully there will be a problem with running this on the Mac ( possibly a lag ).

If you have the problem, could you carry out this function change below, and then rebuild and retry running the .blend file above to see if it fixes the issue.

Open up the GHOST_SystemCarbon.cpp file ( it will be in the intern:ghost:intern folder )

Now, search for line 492 and the function setCursorPosition.

Change this function from…

GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
{
float xf=(float)x, yf=(float)y;

CGWarpMouseCursorPosition(CGPointMake(xf, yf));
// this call below sends event, but empties other events (like shift)
// CGPostMouseEvent(CGPointMake(xf, yf), TRUE, 1, FALSE, 0);

return GHOST_kSuccess;

}

to…

GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
{
float xf=(float)x, yf=(float)y;

CGAssociateMouseAndMouseCursorPosition(false);
CGSetLocalEventsSuppressionInterval(0);
CGWarpMouseCursorPosition(CGPointMake(xf, yf));
CGAssociateMouseAndMouseCursorPosition(true);

// this call below sends event, but empties other events (like shift)
// CGPostMouseEvent(CGPointMake(xf, yf), TRUE, 1, FALSE, 0);

return GHOST_kSuccess;
}

Hopefully these changes will allow some of the mouse based scripts to be crossplatform now on the Mac.

Let me know if it works OK!
Mal

This seems to work on my Macbook Pro, checked into CVS.

Thanks!
Erwin