6
votes

I added NSTrackingArea to my view to capture mouseEntered/mouseExited events. It works. Then, when mouseEntered event gets captured I do

[self.window invalidateCursorRectsForView:self];

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

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

It looks like working good, but sometimes, when dragging mouse (mouse down and dragged) over view cursor blinks (under the cursor appears some mysterious black quad, wich's size perfectly fits my cursor size. Only my cursor is circle. By the way that problem doesn't appears if my cursor is small. When ever it gets bigger it starts blinking. And it doesn't appears while no other drawings is being done at the same time.

What could be the problem?


Screens:

good moment: enter image description here

bad moment: enter image description here

2
What you mean by this "And it doesn't appears while no other drawings is being done at the same time." What drawing is done under cursor and how?wonder.mice
I can give you a hint. Mac OS X uses hardware accelerated cursor only for small cursor. If it large - it drawn by window server when compositing screen image. So, problem can be in how drawing is performed.wonder.mice

2 Answers

1
votes

Which OSX are you targeting? resetCursorRects seems to be deprecated. Also, do you implement the cursorUpdate method? And how?

Best, Akos

0
votes

Because my NSView was NSOpenGLView, I had to delete glClear(GL_COLOR_BUFFER_BIT) line, because while doing glClear it argues with alpha values.