Subject: bug#38083: 27.0.50; Deprecation warnings in NS build

From: Po Lu <[email-masked]>
Date: Fri, 20 May 2022 19:52:58 +0800

Lars Ingebrigtsen <[email-masked]> writes:

>> There are several deprecation warnings in NS build. Good thing is that,
>> these are confined to just two files - nsterm.o and nsselect.o. I've
>> copied following warnings from the build output,
>>
>> CC       nsterm.o
>> nsterm.m:2771:26: warning: 'scrollRect:by:' is deprecated: first deprecated in macOS 10.14 - Use NSScrollView to achieve scrolling views. [-Wdeprecated-declarations]
>>       [FRAME_NS_VIEW (f) scrollRect: src by: delta];
>
> [etc]
>
> I haven't checked whether these are still present in Emacs 29, but
> perhaps Po Lu has some input here; added to the CCs.

I don't know about the nsselect ones, but we have this in nsterm.m now:

#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
  double scale = [[self window] backingScaleFactor];
  CGContextRef context = [(EmacsLayer *)[self layer] getContext];
  int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
  void *pixels = CGBitmapContextGetData (context);
  int rowSize = CGBitmapContextGetBytesPerRow (context);
  int srcRowSize = NSWidth (srcRect) * scale * bpp;
  void *srcPixels = (char *) pixels
    + (int) (NSMinY (srcRect) * scale * rowSize
             + NSMinX (srcRect) * scale * bpp);
  void *dstPixels = (char *) pixels
    + (int) (dest.y * scale * rowSize
             + dest.x * scale * bpp);

  if (NSIntersectsRect (srcRect, dstRect)
      && NSMinY (srcRect) < NSMinY (dstRect))
    for (int y = NSHeight (srcRect) * scale - 1 ; y >= 0 ; y--)
      memmove ((char *) dstPixels + y * rowSize,
               (char *) srcPixels + y * rowSize,
               srcRowSize);
  else
    for (int y = 0 ; y < NSHeight (srcRect) * scale ; y++)
      memmove ((char *) dstPixels + y * rowSize,
               (char *) srcPixels + y * rowSize,
               srcRowSize);

#else

So we are off the hook now, since scrollRect is no longer used on Mac OS
X 10.14 and later.