From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#51411: NS port cleanups Date: Sun, 31 Oct 2021 10:22:50 +0000 Message-ID: References: <87mtmwt3mc.fsf.ref@yahoo.com> <87mtmwt3mc.fsf@yahoo.com> <87h7d4t0er.fsf@yahoo.com> <87ee86q7jm.fsf@yahoo.com> <87ilxhmlwc.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26382"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51411@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 31 11:23:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mh7za-0006d2-VE for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Oct 2021 11:23:11 +0100 Original-Received: from localhost ([::1]:59384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mh7zZ-0001lE-Q8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Oct 2021 06:23:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mh7zT-0001ku-5H for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2021 06:23:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mh7zS-00036C-TA for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2021 06:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mh7zS-0001gb-I2 for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2021 06:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Oct 2021 10:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51411 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51411-submit@debbugs.gnu.org id=B51411.16356757766455 (code B ref 51411); Sun, 31 Oct 2021 10:23:02 +0000 Original-Received: (at 51411) by debbugs.gnu.org; 31 Oct 2021 10:22:56 +0000 Original-Received: from localhost ([127.0.0.1]:59084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mh7zL-0001g3-W0 for submit@debbugs.gnu.org; Sun, 31 Oct 2021 06:22:56 -0400 Original-Received: from outbound.soverin.net ([116.202.126.228]:43713) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mh7zK-0001fv-H8 for 51411@debbugs.gnu.org; Sun, 31 Oct 2021 06:22:55 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 5CA5692; Sun, 31 Oct 2021 10:22:53 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1635675772; bh=3SxL2+1J03YMTjQAzPigZTUsWHoiu/mHf5YcV9t8Ab0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HhtF0BzIqEnd1UUvHzh5Je4LWeTAydUIfbKrSOIEv2PxgF4ylWz0nGyEA1GldPK+O dQkSP5fHKjOT8HCcgKdPPOD/B2xnRtBEu3kGwRbdrkCx8x9alr6d6uajdGCzf/HA5t CDpl9Wp8BVquf9AH4vueywGKjFizDwircqAevXRQDf1KXH9f5u+j8htBsdx8RsQCf8 N4c8TnG5MUc6rteMY6fwpB6z5+e03SsseNe9HgK6ZX2yF5WewFhSw+7GP8UzhmFmou VDWF3MNY2vbgQ8uSvXVmKEs+q2opydv8akoX5QswQJYJLnWfL0hcH26xcvox+/jCCN UjL9/Op5Feufw== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95-RC2) (envelope-from ) id 1mh7zG-0002Ox-6q; Sun, 31 Oct 2021 10:22:50 +0000 Mail-Followup-To: Alan Third , Po Lu , 51411@debbugs.gnu.org Content-Disposition: inline In-Reply-To: <87ilxhmlwc.fsf@yahoo.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:218669 Archived-At: On Thu, Oct 28, 2021 at 07:25:23PM +0800, Po Lu wrote: > Alan Third 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