Re: Catalina scroll view issues
Re: Catalina scroll view issues
- Subject: Re: Catalina scroll view issues
- From: Redler Eyal via Cocoa-dev <email@hidden>
- Date: Mon, 6 Jan 2020 23:03:04 +0200
Thanks for your comments.
> My first instinct when someone says "not reproducible for me with a scroll
> view" on Mac is: Maybe it only occurs with overlay scrollers, or only with
> separate scrollers? Have you tried toggling that setting?
If you mean the "show scroll bars" setting in System Preferences/General then
yes, I did try all settings without success (in reproducing). I also know that
this setting is not all set the same way for all of the complaining users.
> Also, are you calling setNeedsDisplay: or setNeedsDisplayInRect: anywhere?
> That's usually how you cause redraws.
I'm calling it where appropriate (afaik) to redraw the display when the text
changes or when the selection changes, among other things.
>
> If this is only while scrolling, are you perhaps doing things in drawRect:
> that you shouldn't? drawRect: should only draw when the OS calls it. Calling
> drawRect: directly is not supported. Changing state inside drawRect: or
> calling setNeedsDisplay: or moving or resizing views or windows is not
> supported in drawRect:. These things often work by accident though, so I've
> seem lots of code naïvely doing it.
I'm not doing that. Also, this code is years old and worked correctly for many
many users on other systems. I'm supporting (and have users on) all versions of
macOS down to 10.7 and I only get complaints from (some) users on Catalina.
Of-course, this doesn't mean that the code doesn't have issues since I've
already learned the hard way that some things that were forgiven in the past
are no longer tolerated on Catalina (for example, adding more then 256 cursor
rects to a view) so it could be that somewhere, somehow I am doing something
illegitimate but it is showing only now on Catalina. So, to check this theory I
made a special build of the app that allowed turning off drawing of the page
views or of the page container view. Based on a user defaults setting the app
would simply do nothing in drawRect for the page page view or for the container
view. My users tried both of these settings and in both cases the problem
persisted. So, even with drawRect doing nothing, the problem still shows up.
> Similarly, NSView etc. only work when used from the main thread, if you are
> calling methods on views from a secondary thread (like a Dispatch Queue, or a
> callback that isn't guaranteed to be on the main thread), it might work by
> accident, but it is unsupported and unsafe.
I am aware of this. The only thing that could be even remotely related is that
there's a timer that blinks the cursor (triggering an update view
setNeedsDisplay, this code predates dispatch queue by many years and afaik, it
is called on the main thread.
I'm doing most of the work on the main thread anyway but I will review my very
little (unrelated to drawing as far as I can recall) code, maybe somehow...
> Finally, are you maybe forgetting to apply layout constraints to any of your
> views, or forgot to set its translatesAutoresizingMaskIntoConstraints
> properly somewhere? That could cause a view to have the wrong size and clip.
I'm not using auto-layout in this view (I supported 10.6 until recently so this
wasn't available for me). I'm trying to think how this could be related -
perhaps auto-layout is trying to work its magic ignoring the fact that is is
not turned on officially for that view/window but I'm not really seeing it.
Timing-wise, the artifacts are not related to the views being moved, the views
can be moved when resizing the window or when changing the document zoom level
and the container view size can change when adding/removing pages or changing
the zoom level but the artifacts show up when scrolling and only then.
Scrolling also is what usually fixes the artifact, when the user continues to
scroll then subsequent pages will appear and then when he scrolls back to the
trouble area the page will be there.
It does look related to clipping, the page view can be cut in the middle and
the drawing of the shadow (done on the container view) is also cut at the same
place.
Eyal
_______________________________________________
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