Subject: Re: bug#51411: NS port cleanups

From: Po Lu <[email-masked]>
Date: Sun, 31 Oct 2021 18:34:15 +0800

Alan Third <[email-masked]> writes:

> I think what you'll need to do is union the two rectangles and then
> clip to that, rather than clipping them both separately. That will
> then provide the same clipping as the NSClipRect code does.

I meant to say that DPSrectclip intersects (IOW, behaves just as
NSClipRect does).  Unless that's incorrect, I think what I'm doing right
now should work fine.

> I must be failing to communicate well, we keep seeming to
> misunderstand each other.

It could be my problem as well: my reading comprehension is nowhere near
as good as I would rather it be.  Thanks a lot for tolerating it.

> You still need to focus, however you don't have to clip when you
> focus.

After I unfocus here:

  /* Draw box if not done already.  */
  if (!s->for_overlaps && !box_drawn_p && s->face->box != FACE_NO_BOX)
    ns_dumpglyphs_box_or_relief (s);

-> ns_unfocus (s->f);

I make sure to focus again if an overhang might be drawn again (inside
if (s->prev) and if (s->next)), like so:

  /* Draw surrounding overhangs. */
  if (s->prev)
    {
->    ns_focus (s->f, NULL, 0);
      struct glyph_string *prev;

There is, of course, a matching unfocus.  Is that not adequate, and if
so, could you please explain how?

Thanks for the feedback, I really appreciate it.