I haven't found out what I need to do to avoid drawing over the resize corner on a secondary thread. There's something that the system does when it calls drawRect: as a result of a call to setNeedsDisplayInRect: that I can't reproduce. I'm pretty sure it's not a multithreading issue, but since I have no idea who draws the resize corner and when that happens, I'm not sure where to start looking.

However, Hamish pointed out a way I can use to get around it:

On Feb 28, 2008, at 11:45 AM, Hamish Allan wrote:

Assuming you're drawing on a secondary thread because it's
computationally expensive: have that thread draw to a cache e.g.
NSImage and call setNeedsDisplay:, then in your drawRect: (on the main
thread) just transfer the contents of the cache to your rect.


I'm not drawing on the secondary thread because it's expensive - the drawing I need to do is very simple and fast. Your idea solved my problem though: the only reason I'm trying to draw on another thread is that my drawing is timer-driven, and the timer gets suspended if it's on the main thread and the user clicks on a menu or a scrollbar or some such thing.

By moving the timer to a secondary thread and calling my callback on the main thread that problem is solved. Much simpler and more elegant.

Thanks all!
Hank

Hank Heijink
[EMAIL PROTECTED]



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to