Custom NSCursor Flashing Black Quad

I added NSTrackingArea to my opinion in order to capture mouseEntered / mouseExited events. It is working. Then, when the mouseEntered event gets captured, I do

[self.window invalidateCursorRectsForView:self]; 

And in the - (void)resetCursorRects I draw an image, create an NSCursor from it, and then:

 [self addCursorRect:self.bounds cursor:myCursor]; 

It seems that the work is good, but sometimes when dragging with the mouse (mouse down and drag) the cursor flashes above the cursor (some mysterious black square appears under the cursor, the size of which is perfect for my cursor size. As this problem does not appear if my cursor When it gets bigger, it starts to blink, and it doesn’t appear until other drawings are executed at the same time.

What could be the problem?


Screens:

good point: enter image description here

Bad point: enter image description here

+6
source share
2 answers

Since my NSView was NSOpenGLView, I had to delete the glClear(GL_COLOR_BUFFER_BIT) line glClear(GL_COLOR_BUFFER_BIT) , because when I execute glClear it claims with alpha values.

0
source

What OSX are you targeting? resetCursorRects seems deprecated. Also, are you implementing the cursorUpdate method? And How?

Best, Akos

+1
source

All Articles