]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix incorrectly nested ns_focus/ns_unfocus calls
authorAlan Third <alan@idiocy.org>
Fri, 6 Jun 2025 20:45:20 +0000 (21:45 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 26 Jul 2025 15:25:08 +0000 (17:25 +0200)
* 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.

(cherry picked from commit e3380669ed6db7a1c1574c4b39d58f9200a3ffab)

src/nsterm.m

index 38e49406d6661f7c321d90da6843bd99ebbe8ba4..1d86fab3db513134d87f4632ff9b63c5acd195b6 100644 (file)
@@ -3035,35 +3035,32 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
 
   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]];