ofHideCursor() on OSX

This is not strictly OF but related to a GLUT bug. Hiding the mouse cursor with the glut call does not work reliably on osx. Since OF uses this call it is affected too. A possible workaround is the following:

  
  
#include <ApplicationServices/ApplicationServices.h>  
  
[...]  
  
//hide cursor  
CGDisplayHideCursor(kCGDirectMainDisplay);  
  
[...]  
  
//unhide cursor  
CGDisplayShowCursor(kCGDirectMainDisplay);  
  
  
  

I am not sure what the situation is on Leopard. I would be glad to hear if it has been fixed there.

I can test on leopard today.

for now, it’s like this in the SVN – I didn’t test yet on a mac, just threw these changes in:

  
  
//--------------------------------------  
void ofHideCursor(){  
	#ifdef TARGET_OSX  
		CGDisplayHideCursor(kCGDirectMainDisplay);  
	#else   
		glutSetCursor(GLUT_CURSOR_NONE);  
	#endif  
}  
  
//--------------------------------------  
void ofShowCursor(){  
	#ifdef TARGET_OSX  
		CGDisplayShowCursor(kCGDirectMainDisplay);  
	#else   
		glutSetCursor(GLUT_CURSOR_LEFT_ARROW);  
	#endif  
}  
  

with ofconstants.h:

  
  
#ifdef TARGET_OSX  
	......  
	#include <GLUT/glut.h>  
	#include <ApplicationServices/ApplicationServices.h>  
  

is that what you meant?

thanks!!
zach

pretty sure that should do the trick :slight_smile: