From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#32932: 27.0.50; render bugs on macOS Mojave Date: Sun, 14 Oct 2018 19:20:12 +0100 Message-ID: <20181014182012.GD87313@breton.holly.idiocy.org> References: <20181004182514.GA5667@breton.holly.idiocy.org> <20181004184549.GC5667@breton.holly.idiocy.org> <20181004215154.GA15008@breton.holly.idiocy.org> <20181010182750.GB18177@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="huq684BweRXVnRxX" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1539541146 28318 195.159.176.226 (14 Oct 2018 18:19:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 14 Oct 2018 18:19:06 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Boris Buliga , 32932@debbugs.gnu.org To: Aaron Jensen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 14 20:19:01 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gBkyj-0007GF-Dd for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Oct 2018 20:19:01 +0200 Original-Received: from localhost ([::1]:49176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBl0p-0003qI-LM for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Oct 2018 14:21:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBl0j-0003qD-FW for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2018 14:21:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBl0g-0007ov-C6 for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2018 14:21:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45261) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gBl0g-0007ol-6U for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2018 14:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gBl0f-0004yh-TN for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2018 14:21:01 -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, 14 Oct 2018 18:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32932 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32932-submit@debbugs.gnu.org id=B32932.153954122419081 (code B ref 32932); Sun, 14 Oct 2018 18:21:01 +0000 Original-Received: (at 32932) by debbugs.gnu.org; 14 Oct 2018 18:20:24 +0000 Original-Received: from localhost ([127.0.0.1]:49519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gBl03-0004xf-SC for submit@debbugs.gnu.org; Sun, 14 Oct 2018 14:20:24 -0400 Original-Received: from mail-wm1-f53.google.com ([209.85.128.53]:39496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gBl02-0004xT-Eu for 32932@debbugs.gnu.org; Sun, 14 Oct 2018 14:20:22 -0400 Original-Received: by mail-wm1-f53.google.com with SMTP id y144-v6so17323381wmd.4 for <32932@debbugs.gnu.org>; Sun, 14 Oct 2018 11:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=JIuYQgRdUmAR+bhB7+T82HlqzyivVDOwxLADxEsv29k=; b=ToDltw9y7YWTfs/g7so1swN2+g+P8pC1veCRrda9/OfwDHJXbpm90L+JBH25M2auCV hD1h44uFPKDi8ysm1BSt418a3g1Qm53VoiKMmPT8XEQTHrh75HF+tXWtT2qit+rAgB+I c8BMrwUCUPiERS+fan53wf+QHRUGtd+jpuBPc/Zc/YUrh2e9GoE+0Jm43TAD0KTgUGwM ONRU/rUpVLWXQbEqYIei7Rmrf1WO41F93ht3q/NqpV84r010oSOhTcirQ/UQu5Dw0FIT PgGGXBr7iL7dc8C6nSjj2ZyWt+qHwguYwWOmWdrvn9NSmMZbQG2Rs6KoDIN5/wcU3IUG ahSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=JIuYQgRdUmAR+bhB7+T82HlqzyivVDOwxLADxEsv29k=; b=fPnnJk4Kz29tkWD05JbHbcvMVbt9GQRQU3EnrnGQCjHwTLfGhN/k9klcTvp1G3l3JH Xcvi/0+Mj923w+JDDMU9wCZWP5kRBYWgiL8QaV3Mp0knv2fn8H+AV9y2oA4bQ7nl4ByV mIxsfAN0OSDlRJAiHc0vq2yCkf+vPJjN9p8rOJE2DzpHIZ+fkPdpcHnXOVbGuW3HDfFe H0XsKMF9AyzGeSaAXXwXIk6DICa4KbzkDbeam71gaMTlJAPRbMkF/N2UO6jAkzkB/pX7 9S8cishQ7QrJnbngiuSSg6Gdtc1mDdXphMOsvAr8MPWNvP0bkdrrwPIDlxZ/DglAaKKr wytw== X-Gm-Message-State: ABuFfogXbZYsIEHe+gcQM78WU+CMlW0FrzUpQ+KqauXe3V2JifxA0VNN Au5YDEtgfTvtaP0UX9dGpl8= X-Google-Smtp-Source: ACcGV61Pn6OKapEhzcdhfELV1+oHvV4FXhlguLNRsCwrXh9urvu56WpRRm7dOdTsL2c6F3Z/kdI/mg== X-Received: by 2002:a1c:7dce:: with SMTP id y197-v6mr11447467wmc.78.1539541216549; Sun, 14 Oct 2018 11:20:16 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-ecac-aadb-4553-060e.holly.idiocy.org. [2001:8b0:3f8:8129:ecac:aadb:4553:60e]) by smtp.gmail.com with ESMTPSA id h2-v6sm6256646wrs.34.2018.10.14.11.20.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Oct 2018 11:20:14 -0700 (PDT) Content-Disposition: inline In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151246 Archived-At: --huq684BweRXVnRxX Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Sun, Oct 14, 2018 at 01:19:50AM -0700, Aaron Jensen wrote: > On October 10, 2018 at 8:40:18 PM, Aaron Jensen > (aaronjensen@gmail.com(mailto:aaronjensen@gmail.com)) wrote: > > > On October 10, 2018 at 11:27:54 AM, Alan Third (alan@idiocy.org(mailto:alan@idiocy.org)) wrote: > > > > > On Tue, Oct 09, 2018 at 10:15:18AM +0300, Boris Buliga wrote: > > > > Usually, it happens during resizing. But I've seen it several times without > > > > resizing. > > > > > > I doubt this will make any difference, but can one of you try removing > > > the called to [window display] in windowWillResize in nsterm.m > > > > I can still repro with this change made. Also, it’s not just on resizing, it happens often just while using it w/ a fixed window size. > > On a whim, I commented out: > >   [FRAME_NS_VIEW (f) displayIfNeeded]; > > In ns_flush_display. I cannot reproduce the problem with that > commented out. I don’t know what ill effects it will have, but so far > it seems like things draw properly. Hmm, could’ve sworn we needed that there... This could all be down to me misunderstanding something. *checks* Oh dammit. Yes. Looks like that flush display is not needed at all. I could’ve sworn it was, but perhaps some other change fixed that... Attached is a patch with this and a couple of other small graphics fixes (I think this breaks GNUstep as is, but I’ll look at that later). Can you please give it a go and see if there are any problems? -- Alan Third --huq684BweRXVnRxX Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-Fix-some-NS-drawing-issues-bug-32932.patch" Content-Transfer-Encoding: 8bit >From 4758870a4a7ebee44264cceeeeb0687002dccb57 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 14 Oct 2018 19:12:00 +0100 Subject: [PATCH] Fix some NS drawing issues (bug#32932) * src/nsterm.m (ns_clip_to_rect): (ns_reset_clipping): Remove gsaved variable and associated code. (ns_flush_display): Remove function. (ns_copy_bits): use translateRectsNeedingDisplayInRect:by: to copy any pending drawing actions along with the image. ([EmacsView windowWillResize:toSize:]): Remove unneeded call. --- src/nsterm.m | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index 8c355a89f8..cff77037d4 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -277,7 +277,6 @@ - (NSColor *)colorUsingDefaultColorSpace /* display update */ static int ns_window_num = 0; -static BOOL gsaved = NO; static BOOL ns_fake_keydown = NO; #ifdef NS_IMPL_COCOA static BOOL ns_menu_bar_is_hidden = NO; @@ -1180,7 +1179,6 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) NSRectClipList (r, 2); else NSRectClip (*r); - gsaved = YES; return YES; } @@ -1204,11 +1202,7 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) { NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_reset_clipping"); - if (gsaved) - { - [[NSGraphicsContext currentContext] restoreGraphicsState]; - gsaved = NO; - } + [[NSGraphicsContext currentContext] restoreGraphicsState]; } @@ -1234,19 +1228,6 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) return ns_clip_to_rect (f, &clip_rect, 1); } - -static void -ns_flush_display (struct frame *f) -/* Force the frame to redisplay. If areas have previously been marked - dirty by setNeedsDisplayInRect (in ns_clip_to_rect), then this will call - draw_rect: which will "expose" those areas. */ -{ - block_input (); - [FRAME_NS_VIEW (f) displayIfNeeded]; - unblock_input (); -} - - /* ========================================================================== Visible bell and beep. @@ -2710,6 +2691,8 @@ so some key presses (TAB) are swallowed by the system. */ static void ns_copy_bits (struct frame *f, NSRect src, NSRect dest) { + NSSize delta = NSMakeSize (dest.origin.x - src.origin.x, + dest.origin.y - src.origin.y) NSTRACE ("ns_copy_bits"); if (FRAME_NS_VIEW (f)) @@ -2718,10 +2701,17 @@ so some key presses (TAB) are swallowed by the system. */ /* FIXME: scrollRect:by: is deprecated in macOS 10.14. There is no obvious replacement so we may have to come up with our own. */ - [FRAME_NS_VIEW (f) scrollRect: src - by: NSMakeSize (dest.origin.x - src.origin.x, - dest.origin.y - src.origin.y)]; - [FRAME_NS_VIEW (f) setNeedsDisplay:YES]; + [FRAME_NS_VIEW (f) scrollRect: src by: delta]; + + /* As far as I can tell from the documentation, scrollRect:by:, + above, should copy the dirty rectangles from our source + rectangle to our destination, however it appears it clips the + operation to src. As a result we need to use + translateRectsNeedingDisplayInRect:by: below, and we have to + union src and dest so it can pick up the dirty rectangles, + and place them, as it also clips to the rectangle. */ + [FRAME_NS_VIEW (f) translateRectsNeedingDisplayInRect:NSUnionRect (src, dest) + by:delta]; } } @@ -4977,7 +4967,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) ns_after_update_window_line, ns_update_window_begin, ns_update_window_end, - ns_flush_display, /* flush_display */ + 0, /* flush_display */ x_clear_window_mouse_face, x_get_glyph_overhangs, x_fix_overlapping_area, @@ -7046,7 +7036,6 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize size_title = xmalloc (strlen (old_title) + 40); esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows); [window setTitle: [NSString stringWithUTF8String: size_title]]; - [window display]; xfree (size_title); } } -- 2.18.0 --huq684BweRXVnRxX--