• 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: Richard Charles <email@hidden>
  • Date: Sat, 15 Dec 2018 10:49:23 -0700

> 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.

#0  0x00000001000748f4 in -[MyView lockFocus]
#1  0x00007fffc0544e7b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#2  0x00007fffc05456d1 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#3  0x00007fffc05456d1 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#4  0x00007fffc05456d1 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#5  0x00007fffc05442af in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#6  0x00007fffc05426d8 in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#7  0x00007fffc053dfca in -[NSView displayIfNeeded]
#8  0x00007fffc053d8db in -[NSWindow displayIfNeeded]

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.

--Richard Charles

_______________________________________________

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: Tor Arne Vestbø <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>)

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