Problem with setting a cursor
Problem with setting a cursor
- Subject: Problem with setting a cursor
- From: Gideon King <email@hidden>
- Date: Tue, 8 Jun 2010 02:47:00 +1000
Hi all,
I have a view where I set the cursor in a mouse moved event, when the mouse is over certain places in my view (resize handles for objects). This works fine, but sometimes I need to add some subviews to this view, and for some reason, when I do, it stops setting the cursors in some of the places where it should.
I put a breakpoint on -[NSCursor set] and notice that when I have the other subviews present, it uses cursorUpdate (as per the trace below), whereas when I don't have my subviews there, it doesn't. I have stripped my subviews back to ensure that they don't have any cursor tracking or cursor updates active, but it still makes no difference. I also have some text views as subviews, and they seem to make no difference to my cursor settings.
I believe that the loss of the cursor updates may have something to do with the way I draw the superview, but am not sure what may affect it. Most of the drawing code is fairly straightforward, with bezier paths, fills, some images etc., and only a couple of places where I save and restore the graphics state so that I can do some clipping. I do have some places where I need to drop back to a CGContext for some shadow and transparency work.
I tried setting my mouse moved so that it always set the cursor to an up/down arrow cursor, but when I had the subviews present, the cursor still changed back to the arrow cursor.
What things should I be looking at when tracking this down? I thought that the candidates would be anything using tracking rectangles, tracking areas, or mousemoved tracking, or anything else that explicitly sets the cursor. I think I have pretty much eliminated these as the cause. Then I thought it may be clipping paths or graphics states, but I can't see anything likely looking there.
Any suggestions of things to check would be very welcome.
...and here's the trace when I have the subview in place - otherwise it is just set from the mousemoved.
#0 0x00007fff87cda4e5 in -[NSCursor set] ()
#1 0x00007fff87d0fd6e in forwardMethod ()
#2 0x00007fff87d0fada in -[NSView cursorUpdate:] ()
#3 0x00007fff87d0fd6e in forwardMethod ()
#4 0x00007fff87d0fada in -[NSView cursorUpdate:] ()
#5 0x00007fff87d0fd6e in forwardMethod ()
#6 0x00007fff87d0fada in -[NSView cursorUpdate:] ()
#7 0x00007fff87d0fd6e in forwardMethod ()
#8 0x00007fff87d0fada in -[NSView cursorUpdate:] ()
#9 0x00007fff87d0fd6e in forwardMethod ()
#10 0x00007fff87d0fada in -[NSView cursorUpdate:] ()
#11 0x00007fff87d0fd6e in forwardMethod ()
#12 0x00007fff87d0fada in -[NSView cursorUpdate:] ()
#13 0x00007fff87d0fd6e in forwardMethod ()
#14 0x00007fff87d0fada in -[NSView cursorUpdate:] ()
#15 0x00007fff87d0fd6e in forwardMethod ()
#16 0x00007fff87d0fada in -[NSView cursorUpdate:] ()
#17 0x00007fff87d0ea4e in _handleInvalidCursorRectsNote ()
#18 0x00007fff84ec80d7 in __CFRunLoopDoObservers ()
#19 0x00007fff84ea3f84 in __CFRunLoopRun ()
#20 0x00007fff84ea38df in CFRunLoopRunSpecific ()
#21 0x00007fff8108bada in RunCurrentEventLoopInMode ()
#22 0x00007fff8108b83d in ReceiveNextEventCommon ()
#23 0x00007fff8108b798 in BlockUntilNextEventMatchingListInMode ()
#24 0x00007fff87ce3a2a in _DPSNextEvent ()
#25 0x00007fff87ce3379 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#26 0x00007fff87ca905b in -[NSApplication run] ()
#27 0x0000000100410774 in -[OAApplication run] ()
#28 0x00007fff87ca1d7c in NSApplicationMain ()
#29 0x0000000100001ec7 in main (argc=3, argv=0x7fff5fbff440) at /Users/gideon/Development/svn/trunk/mac/Source/main.m:11
Thanks
Gideon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden