Re: How to know if an NSView has pending draws
Re: How to know if an NSView has pending draws
- Subject: Re: How to know if an NSView has pending draws
- From: Jeff Evans <email@hidden>
- Date: Thu, 04 Feb 2016 16:14:16 -0800
Clark, you've got a great idea there. The notification method is perhaps not the one, because there are circumstances in which a draw method will conclude that further adjustment is going to be needed and will ask for other sections to adjust, etc. But the view that matters here is just a single view - perhaps it would be enough to check needsDisplay! Worth trying.
Jeff
On Feb 4, 2016, at 4:06 PM, Clark S. Cox III wrote:
> On Feb 4, 2016, at 15:52, Jeff Evans <email@hidden> wrote:
>
> Clark, it's a music app; a piece is composed and placed on the screen; there's a lot of massaging going on as the music adjusts visually.
Instead of looking to the view system to know when your code is done laying things out, why not ask your layout code directly? Or why not have your layout code post a notification when it begins and another when it ends?
> I want the play of the example to begin once there are no more updates remaining. That is no noticeable delay in terms of human time, but makes a difference in the appearance.
>
> So I figure: the system presumably knows if it is about to send more redraw requests to that view. Is there any way I could know what it knows?
If you really wanted to, I suppose you could walk the window's entire view hierarchy and ask every visible view for the value of its needsDisplay property. (Though I would advise against it
>
> Jeff
>
>
> On Feb 4, 2016, at 3:31 PM, Clark S. Cox III wrote:
>
>
>
>
>
>
>> On Feb 4, 2016, at 15:07, Jeff Evans <email@hidden> wrote:
>>
>> Suppose one wants to do a task in an NSView only once it has no drawRect calls pending. Is there any way to tell, for a particular NSView, if there are any drawing events coming up? Whether, that is, the view is up to date?
>>
>> I've tried counting my explicit uses of setNeedsDisplay and decrementing that count at drawRect, but the trouble is that one can call setNeedsDisplay many times and that will not translate into the same number of drawRects.
>>
>> One idea was to call getRectsBeingDrawn at drawRect and hope that the number of rects is equal to the number of update requests combined into that call. But the number of rects does not appear to equal the number of draw requests.
>
> Multiple invalid regions can be merged.
>
>> But there must be some place that contains a queue of upcoming draw requests. If so, is there access to it?
>
> There really isn't any such queue. There are only areas of the view that are marked as invalid.
>
>> I'm hoping this is a dumb question.
>>
>> Thanks, Jeff
>
> I hate to be "that guy", but what are you actually trying to do?
>
>
> --
> If this email is spam, report it to
> https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MDE2Njc6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ
>
>
>
> _______________________________________________
>
> 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
--
If this email is spam, report it to
https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE4NDk5MDk1MjQ6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ
_______________________________________________
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