Subject: bug#32932: 27.0.50; render bugs on macOS Mojave

From: Alan Third <[email-masked]>
Date: Thu, 4 Oct 2018 22:51:54 +0100

On Thu, Oct 04, 2018 at 07:45:49PM +0100, Alan Third wrote:
> You lost the bug tracker again.
> 
> On Thu, Oct 04, 2018 at 11:34:41AM -0700, Aaron Jensen wrote:
> > On October 4, 2018 at 11:25:19 AM, Alan Third
> > ([email-masked](mailto:[email-masked])) wrote:
> > 
> > > Is it possible that ‘one line’ is the same as the height of the title
> > > bar?
> > 
> > That’s possible, yes.
> > 
> > > Sorry, I was unclear. I meant the compiler warnings etc. But since
> > > Charles sees this on 10.6 it’s unlikely it’s something new in the
> > > compilation.
> > >
> > > All I can think of to do is enable NSTRACE and see if you can spot
> > > some commonality when the problem happens.
> > 
> > Any particular groups you want me to include in the trace?
> 
> No. It’s possible that updates and focus could give some extra clue,
> but they also might just end up littering the output with nonsense.

Can you try the attached patch? I noticed that nested calls to
ns_clip_to_row would probably fail to reset the graphics context
correctly (and therefore the clipping areas for drawing). I’ve no idea
if that’s actually a problem for us, though.
-- 
Alan Third
>From e81bf671f31663359e2572e8c183f3a4d7e5f708 Mon Sep 17 00:00:00 2001
From: Alan Third <[email-masked]>
Date: Thu, 4 Oct 2018 22:47:23 +0100
Subject: [PATCH] Fix occasional redraw error (bug#32932)

* src/nsterm.m (ns_clip_to_rect, ns_reset_clipping): Always pop the
graphics state.
---
 src/nsterm.m | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index d92d6c3244..72ad57c64d 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];
 }

-- 
2.18.0