GNU bug report logs - #62573
29.0.60; Cursor color not being inverted in emacs-29

Previous Next

Package: emacs;

Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>

Date: Fri, 31 Mar 2023 18:35:02 UTC

Severity: normal

Found in version 29.0.60

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Po Lu <luangruo <at> yahoo.com>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 62573 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Subject: bug#62573: 29.0.60; Cursor color not being inverted in emacs-29
Date: Mon, 03 Apr 2023 08:07:24 +0800
Daniel Martín <mardani29 <at> yahoo.es> writes:

> +#define CG_SET_FILL_COLOR_WITH_FRAME_CURSOR(context, frame)             \
> +  do {                                                                  \
> +    CGColorRef refcol_ =                                                \
> +      get_cgcolor_from_nscolor (FRAME_CURSOR_COLOR (frame), frame);     \
> +    CGContextSetFillColorWithColor (context, refcol_);                  \
> +    CGColorRelease (refcol_);                                           \
> +  } while (0)
> +#define CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND(context, frame)         \
> +  do {                                                                  \
> +    CGColorRef refcol_ =                                                \
> +      get_cgcolor_from_nscolor (FRAME_BACKGROUND_COLOR (frame), frame); \
> +    CGContextSetFillColorWithColor (context, refcol_);                  \
> +    CGColorRelease (refcol_);                                           \
> +  } while (0)

Thanks.  The GNU Coding Standards split expressions, before operators.
So this should read:

  do {
    CGColorRef refcol
      = ...

also, since you put this in a separate block, you don't have to worry
about shadowing, so there's no need to use names with a trailing
underscore.

>  #define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face)         \
>    do {                                                                  \
>      CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face));       \
> @@ -2933,9 +2947,12 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
>      {
>        if (s->hl == DRAW_CURSOR)
>          {
> -	  CGColorRef colorref = get_cgcolor_from_nscolor (FRAME_CURSOR_COLOR (f), f);
> -	  CGContextSetFillColorWithColor (context, colorref);
> -	  CGColorRelease (colorref);
> +          if (face && (NS_FACE_BACKGROUND (face)
> +                       == [(NSColor *) FRAME_CURSOR_COLOR (f)
> +                                       unsignedLong]))
> +            CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face);
> +          else
> +            CG_SET_FILL_COLOR_WITH_FRAME_CURSOR (context, f);
>          }
>        else
>          CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face);
> @@ -2949,9 +2966,12 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
>        CGContextScaleCTM (context, 1, -1);
>        if (s->hl == DRAW_CURSOR)
>          {
> -	  CGColorRef colorref = get_cgcolor_from_nscolor (FRAME_BACKGROUND_COLOR (f), f);
> -	  CGContextSetFillColorWithColor (context, colorref);
> -	  CGColorRelease (colorref);
> +          if (face && (NS_FACE_BACKGROUND (face)
> +                       == [(NSColor *) FRAME_CURSOR_COLOR (f)
> +                                       unsignedLong]))
> +            CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face);
> +          else
> +            CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND (context, f);
>          }
>        else
>          CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face);
> diff --git a/src/nsterm.m b/src/nsterm.m
> index 46007ec4fcb..637bc4b6419 100644
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -3750,14 +3750,18 @@ Function modeled after x_draw_glyph_string_box ().
>  	{
>            struct face *face = s->face;
>            if (!face->stipple)
> -	    {
> -	      if (s->hl != DRAW_CURSOR)
> -		[(NS_FACE_BACKGROUND (face) != 0
> -		  ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
> -		  : FRAME_BACKGROUND_COLOR (s->f)) set];
> -	      else
> -		[FRAME_CURSOR_COLOR (s->f) set];
> -	    }
> +            {
> +              if (s->hl != DRAW_CURSOR)
> +                [(NS_FACE_BACKGROUND (face) != 0
> +                  ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
> +                  : FRAME_BACKGROUND_COLOR (s->f)) set];
> +              else if (face && (NS_FACE_BACKGROUND (face)
> +                                == [(NSColor *) FRAME_CURSOR_COLOR (s->f)
> +                                                unsignedLong]))
> +                [[NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)] set];
> +              else
> +                [FRAME_CURSOR_COLOR (s->f) set];
> +            }
>            else
>              {
>                struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f);

LGTM.  Thanks.




This bug report was last modified 2 years and 104 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.