Subject: bug#79102: 31.0.50; nsterm.m: clearRect undeclared

From: Harald <[email-masked]>
Date: Sat, 26 Jul 2025 18:22:56 +0200

Does this maybe help?

Harald

$ git show -p nsterm.m
commit e3380669ed6db7a1c1574c4b39d58f9200a3ffab (HEAD -> master, origin/master, origin/HEAD)
Author: Alan Third <[email-masked]>
Date:   Fri Jun 6 21:45:20 2025 +0100

    Fix incorrectly nested ns_focus/ns_unfocus calls
    
    * src/nsterm.m (ns_draw_fringe_bitmap): Move the call to ns_focus out of
    the if for overlay_p and rename the rect from clearRect to bmpRect to
    make it's purpose clearer.

diff --git a/src/nsterm.m b/src/nsterm.m
index 38e49406d66..1d86fab3db5 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3035,35 +3035,32 @@ Hide the window (X11 semantics)
 
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct face *face = p->face;
-  NSRect clearRect = NSZeroRect;
+  NSRect bmpRect = NSZeroRect;
   NSRect rowRect = ns_row_rect (w, row, ANY_AREA);
 
   NSTRACE_WHEN (NSTRACE_GROUP_FRINGE, "ns_draw_fringe_bitmap");
   NSTRACE_MSG ("which:%d cursor:%d overlay:%d width:%d height:%d period:%d",
                p->which, p->cursor_p, p->overlay_p, p->wd, p->h, p->dh);
 
-  /* Clear screen unless overlay.  */
-  if (!p->overlay_p)
-    {
-      /* Work out the rectangle we will need to clear.  */
-      clearRect = NSMakeRect (p->x, p->y, p->wd, p->h);
+  /* Work out the rectangle we will need to clear.  */
+  bmpRect = NSMakeRect (p->x, p->y, p->wd, p->h);
 
-      if (p->bx >= 0)
-        clearRect = NSUnionRect (clearRect, NSMakeRect (p->bx, p->by, p->nx, p->ny));
+  if (p->bx >= 0)
+    bmpRect = NSUnionRect (bmpRect, NSMakeRect (p->bx, p->by, p->nx, p->ny));
 
-      /* Handle partially visible rows.  */
-      clearRect = NSIntersectionRect (clearRect, rowRect);
+  /* Handle partially visible rows.  */
+  bmpRect = NSIntersectionRect (bmpRect, rowRect);
 
-      /* The visible portion of imageRect will always be contained
-	 within clearRect.  */
-      ns_focus (f, &clearRect, 1);
-      if (!NSIsEmptyRect (clearRect))
-        {
-          NSTRACE_RECT ("clearRect", clearRect);
+  /* Clip to the bitmap's area.  */
+  ns_focus (f, &bmpRect, 1);
 
-          [[NSColor colorWithUnsignedLong:face->background] set];
-          NSRectFill (clearRect);
-        }
+  /* Clear screen unless overlay.  */
+  if (!p->overlay_p && !NSIsEmptyRect (clearRect))
+    {
+      NSTRACE_RECT ("clearRect", clearRect);
+
+      [[NSColor colorWithUnsignedLong:face->background] set];
+      NSRectFill (clearRect);
     }
 
   NSBezierPath *bmp = [fringe_bmp objectForKey:[NSNumber numberWithInt:p->which]];

> On 26. Jul 2025, at 15:03, Eli Zaretskii <[email-masked]> wrote:
> 
>> From: Harald <[email-masked]>
>> Date: Sat, 26 Jul 2025 13:58:00 +0200
>> 
>> 
>> By building the Nextstep port I am getting the following error:
>>  GEN      globals.h
>>  CC       nsterm.o
>> nsterm.m:3058:40: error: use of undeclared identifier 'clearRect'
>> 3058 |   if (!p->overlay_p && !NSIsEmptyRect (clearRect))
>>      |                                        ^
>> nsterm.m:3063:19: error: use of undeclared identifier 'clearRect'
>> 3063 |       NSRectFill (clearRect);
>>      |                   ^
>> 2 errors generated.
>> make: *** [nsterm.o] Error 1
>> 
>> !!! The previous version worked fine !!!
> 
> What was "the previous version", please>