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: Thu, 8 Nov 2018 23:21:13 +0000 Message-ID: <20181108232113.GA15030@breton.holly.idiocy.org> References: <20181104132404.GA58336@breton.holly.idiocy.org> <20181104201148.GA70884@breton.holly.idiocy.org> <20181105185516.GA71125@breton.holly.idiocy.org> <20181108152117.GA98842@breton.holly.idiocy.org> <83va57bmzq.fsf@gnu.org> <20181108161715.GA99392@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1541719210 15802 195.159.176.226 (8 Nov 2018 23:20:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Nov 2018 23:20:10 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 32932@debbugs.gnu.org, boris@d12frosted.io To: Aaron Jensen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 09 00:20:06 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 1gKtan-0003yO-Bn for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Nov 2018 00:20:05 +0100 Original-Received: from localhost ([::1]:59449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKtct-0000MV-8C for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Nov 2018 18:22:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKtcn-0000MO-As for bug-gnu-emacs@gnu.org; Thu, 08 Nov 2018 18:22:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKtch-0005ke-LP for bug-gnu-emacs@gnu.org; Thu, 08 Nov 2018 18:22:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37746) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKtcg-0005kD-KE for bug-gnu-emacs@gnu.org; Thu, 08 Nov 2018 18:22:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gKtcg-0005IS-Be for bug-gnu-emacs@gnu.org; Thu, 08 Nov 2018 18:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Nov 2018 23:22:02 +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.154171928720315 (code B ref 32932); Thu, 08 Nov 2018 23:22:02 +0000 Original-Received: (at 32932) by debbugs.gnu.org; 8 Nov 2018 23:21:27 +0000 Original-Received: from localhost ([127.0.0.1]:42004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gKtc6-0005Hb-Qc for submit@debbugs.gnu.org; Thu, 08 Nov 2018 18:21:27 -0500 Original-Received: from mail-wr1-f49.google.com ([209.85.221.49]:41837) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gKtc4-0005HL-0Z for 32932@debbugs.gnu.org; Thu, 08 Nov 2018 18:21:24 -0500 Original-Received: by mail-wr1-f49.google.com with SMTP id v18-v6so3723327wrt.8 for <32932@debbugs.gnu.org>; Thu, 08 Nov 2018 15:21:23 -0800 (PST) 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=uenM9YnDqZoJJyhaIOo6Ew+B49TqQIw3PADjnhjz4xM=; b=QM0MMonHX7PDbyowXEazpcsT+24aW0Nlq4sTd72kbU0/CpV4EPj/l9bvcGtbmeKyyy 3FssI5t2PZwaHiKy6nrR/sBCWxMEnxocOYavWV4P4UHuQkaeJwP1wGbuEjmTE8e2P9SX ds9NjYyFgpRlpUG1hPcmDSc5J33MXQluntXPX4iz6eaFYk5y+vLUfHku3vhTZcFIFHNd 8gUMhJd5AZhHln/ZkysWHibQvf2mjYrz956jiC3fvMMFmToL7VWEuEGM1goh3fiyBSW/ ygS0WvFuFVy8qIYg8Eby4pCe+gA/H5Q4bMXmA5SQ5EMQGiyz9eKFqsGz5Qtlsu8jxMlO 42MQ== 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=uenM9YnDqZoJJyhaIOo6Ew+B49TqQIw3PADjnhjz4xM=; b=tzKax0tcBF/3XbT65MTXnAYm8ZFYP1aPv/wcPBKEw0MVee5bW0t6y7fcCENbZ0Jf7M pgeLgR5iciUVXEPmhaTB5MF9kUk6U+EMn5exhkBciJL66nm4Qq0oGUVPuPRv3RW/tF0C JmqCZC/wFbklhEcy7UvsqlVp8L+Vxys+JmKNm3JawYBr4/48kPfWC58tsDHV/sjhRUi0 8wXu3CoyUL6jCo/7n+DPfXob8hwncuzlmngfNv6QZtVSZY6C2j1KBURNRRtAA2scqNjG Ft5VKiLvTGhqs7gGQS5q/pFl6HpDlusrblLaW5vFrW03di7oKvqJy4ALgStVlZQI+6eY ogSg== X-Gm-Message-State: AGRZ1gIKeCVOveraq988b7j1LkNfXblfFWK4xUxryZwyP+wj/+3RKIk0 rPTmCzp600Dih85R/l26lpg= X-Google-Smtp-Source: AJdET5dkflFvCrcyp5RYjJdybf4k0d1o+9ZG9RfqSipXENWZtVF1C/xJ1NwolylgU2AaFqOlcXTXRA== X-Received: by 2002:a05:6000:1009:: with SMTP id a9mr5760257wrx.271.1541719278081; Thu, 08 Nov 2018 15:21:18 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-8cfe-35d9-62a3-d426.holly.idiocy.org. [2001:8b0:3f8:8129:8cfe:35d9:62a3:d426]) by smtp.gmail.com with ESMTPSA id e10-v6sm7023481wrp.56.2018.11.08.15.21.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 15:21:16 -0800 (PST) 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:152183 Archived-At: --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Thu, Nov 08, 2018 at 08:28:03AM -0800, Aaron Jensen wrote: > On November 8, 2018 at 8:17:21 AM, Alan Third > (alan@idiocy.org(mailto:alan@idiocy.org)) wrote: > > > If I could suppress the clearing action that would solve the problem. > > > > If expose_frame could draw the rectangle as it was before the > > frame/window was marked garbaged, that would also solve the problem. > > > > I don’t believe the former is possible, and I don’t know if the latter > > is possible. > > I’m only partially following this now, so I’m sorry if this idea > doesn’t make sense—but if there’s a spot where the repaint actually > happens, could you dirty the rects right before the repaint. In other > words, queue into a queue the rect dirtying in all the places it > happens and only actually process the dirty queue once you know you > can paint. Yes, and I hadn’t thought of that option. It makes a lot more sense than queueing the clears. I’ve got another patch for you to try first, though. This one requires the previous one (i.e. you should be able to just apply it without the removing anything). -- Alan Third --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Further-changes-to-NS-drawing-bug-32932.patch" >From 171713fb172911416ac4615f4bf3ae1802a4e756 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Thu, 8 Nov 2018 23:11:31 +0000 Subject: [PATCH] Further changes to NS drawing (bug#32932) * src/nsterm.m (ns_update_begin): Get rid of the display at the start of redisplay. (ns_update_window_begin): Remove redundant code that never executes. (ns_draw_window_cursor): Perform a display when not in redisplay. ([EmacsView drawRect:]): Show the rectangle being exposed. * src/xdisp.c (expose_window_tree) [HAVE_NS]: (expose_frame) [HAVE_NS]: Redraw even if the frame is garbaged. --- src/nsterm.m | 43 +++++++++---------------------------------- src/xdisp.c | 8 +++++++- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index bb21be4a18..9e6779d4a3 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1061,17 +1061,6 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) ns_update_auto_hide_menu_bar (); - /* Flush any existing changes to screen before redisplay gets going. - If we don't do this then it's possible for redisplay to mark - areas as garbaged so they won't be redrawn in the next drawRect - call. - - Is this a bad thing to do since we're effectively calling - frame_expose from within redisplay? */ - block_input (); - [FRAME_NS_VIEW (f) displayIfNeeded]; - unblock_input (); - if ([view isFullscreen] && [view fsIsNative]) { // Fix reappearing tool bar in fullscreen for Mac OS X 10.7 @@ -1080,29 +1069,6 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) if (! tbar_visible != ! [toolbar isVisible]) [toolbar setVisible: tbar_visible]; } - - /* drawRect may have been called for say the minibuffer, and then clip path - is for the minibuffer. But the display engine may draw more because - we have set the frame as garbaged. So reset clip path to the whole - view. */ - /* FIXME: I don't think we need to do this. */ - if ([NSView focusView] == FRAME_NS_VIEW (f)) - { - NSBezierPath *bp; - NSRect r = [view frame]; - NSRect cr = [[view window] frame]; - /* If a large frame size is set, r may be larger than the window frame - before constrained. In that case don't change the clip path, as we - will clear in to the tool bar and title bar. */ - if (r.size.height - + FRAME_NS_TITLEBAR_HEIGHT (f) - + FRAME_TOOLBAR_HEIGHT (f) <= cr.size.height) - { - bp = [[NSBezierPath bezierPathWithRect: r] retain]; - [bp setClip]; - [bp release]; - } - } #endif } @@ -3158,6 +3124,12 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. ns_reset_clipping (f); } + else if (! redisplaying_p) + { + /* If this function is called outside redisplay, it probably + means we need an immediate update. */ + [FRAME_NS_VIEW (f) display]; + } } @@ -8120,6 +8092,9 @@ - (void)drawRect: (NSRect)rect for (int i = 0 ; i < numRects ; i++) { NSRect r = rectList[i]; + + NSTRACE_RECT ("r", r); + expose_frame (emacsframe, NSMinX (r), NSMinY (r), NSWidth (r), NSHeight (r)); diff --git a/src/xdisp.c b/src/xdisp.c index 357f0fb30c..a59a62fb93 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -32258,7 +32258,11 @@ expose_window_tree (struct window *w, XRectangle *r) struct frame *f = XFRAME (w->frame); bool mouse_face_overwritten_p = false; - while (w && !FRAME_GARBAGED_P (f)) + while (w +#if !defined (HAVE_NS) + && !FRAME_GARBAGED_P (f) +#endif + ) { mouse_face_overwritten_p |= (WINDOWP (w->contents) @@ -32286,12 +32290,14 @@ expose_frame (struct frame *f, int x, int y, int w, int h) TRACE ((stderr, "expose_frame ")); +#if !defined (HAVE_NS) /* No need to redraw if frame will be redrawn soon. */ if (FRAME_GARBAGED_P (f)) { TRACE ((stderr, " garbaged\n")); return; } +#endif /* If basic faces haven't been realized yet, there is no point in trying to redraw anything. This can happen when we get an expose -- 2.19.1 --M9NhX3UHpAaciwkO--