GNU bug report logs - #51411
NS port cleanups

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Tue, 26 Oct 2021 11:43:01 UTC

Severity: normal

Tags: patch

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Third <alan <at> idiocy.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 51411 <at> debbugs.gnu.org
Subject: bug#51411: NS port cleanups
Date: Sun, 31 Oct 2021 10:22:50 +0000
On Thu, Oct 28, 2021 at 07:25:23PM +0800, Po Lu wrote:
> Alan Third <alan <at> idiocy.org> writes:
> 
> > NSRectClipList creates a union of the passed rectangles and then sets
> > the clipping rectangle to that, so it contains all of them. That's
> > useful because NSRectClip uses the intersection of the current
> > clipping rectangle and the new one.
> >
> > Does DPSrectclip use the intersection? If so this may not work as
> > intended and it might be better to union the rectangles ourselves.
> 
> It does intersect the rectangle with the current clipping.  I determined
> that from a cursory examination of the source code, as the function
> appeared in the documentation as documented, but no documentation was
> actually written for it.

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.

> >> @@ -4195,13 +4091,88 @@ overwriting cursor (usually when cursor on a tab) */
> >>  
> >>    /* 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);
> 
> > You unfocus here, then continue working on the frame here. You either
> > need to focus again or extend the original focus. Remember you can
> > focus without setting the clipping, then save and reset the graphics
> > state as required if you prefer.
> 
> Hmm.  Will this work better?  Thanks.

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

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

For example you could do something like:

    ns_focus (f, nil, 0);
    [[NSGraphicsContext currentContext] saveGraphicsState];
    NSClipRect (r1);
    // do something
    [[NSGraphicsContext currentContext] restoreGraphicsState]

    [[NSGraphicsContext currentContext] saveGraphicsState];
    NSClipRect (r2);
    // do something else
    [[NSGraphicsContext currentContext] restoreGraphicsState]
    ns_unfocus (f);

The only time you don't need to focus is when you can guarantee the
calling function (or its caller, etc.) has already focused the view.
-- 
Alan Third




This bug report was last modified 3 years and 194 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.