• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: lockFocusIfCanDraw behavior in layer-backed mode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lockFocusIfCanDraw behavior in layer-backed mode


  • Subject: Re: lockFocusIfCanDraw behavior in layer-backed mode
  • From: Tor Arne Vestbø <email@hidden>
  • Date: Mon, 17 Dec 2018 01:34:42 +0000
  • Thread-topic: lockFocusIfCanDraw behavior in layer-backed mode


> On 15 Dec 2018, at 18:49, Richard Charles <email@hidden> wrote:
>
>
>> On Dec 15, 2018, at 8:07 AM, Tor Arne Vestbø <email@hidden> wrote:
>>
>> Piggy-backing on this thread, what does lockFocusIfCanDraw actually do in
>> layer-backed mode?
>
> I have a layer-hosting view running under macOS 10.12.6 and lockFocus is
> called by the system frameworks.

Right. I was thinking more what happens when calling it outside of the display
cycle. The behavior I described was on Mojave (10.14.2)

>
> WWDC 2018 Session 209 states the following.
>
> "With our changes to layer backing, there's a few patterns I want to call out
> that aren't going to work in macOS 10.14 anymore. If you're using NSView
> lockFocus and unlockFocus, or trying to access the window's graphics contents
> directly, there's a better way of doing that. You should just subclass NSView
> and implement draw rect. Both of those methods have been kind of finicky for
> a while. So, you'll be saving yourself some trouble."
>
> Note that all of the NSView focus methods are now depreciated.

The session doesn’t go into what do if you want to draw synchronously outside
of the display cycle though. Is it enough to setNeedsDisplay and then call
[NSView displayIfNeeded] or [CALayer displayIfNeeded]? I guess the latter since
I don’t want AppKit to walk the view hierarchy and display other views (unless
it’s smart enough to treat a layer-backed view as not needing that behavior).

Cheers,
Tor Arne
_______________________________________________

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

  • Follow-Ups:
    • Re: lockFocusIfCanDraw behavior in layer-backed mode
      • From: Richard Charles <email@hidden>
References: 
 >Re: NSString drawAtPoint in Mojave (From: Tom Doan <email@hidden>)
 >Re: NSString drawAtPoint in Mojave (From: Matt Jacobson <email@hidden>)
 >lockFocusIfCanDraw behavior in layer-backed mode (From: Tor Arne Vestbø <email@hidden>)
 >Re: lockFocusIfCanDraw behavior in layer-backed mode (From: Richard Charles <email@hidden>)

  • Prev by Date: Re: lockFocusIfCanDraw behavior in layer-backed mode
  • Next by Date: Re: lockFocusIfCanDraw behavior in layer-backed mode
  • Previous by thread: Re: lockFocusIfCanDraw behavior in layer-backed mode
  • Next by thread: Re: lockFocusIfCanDraw behavior in layer-backed mode
  • Index(es):
    • Date
    • Thread