bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62573: 29.0.60; Cursor color not being inverted in emacs-29


From: Daniel Martín
Subject: bug#62573: 29.0.60; Cursor color not being inverted in emacs-29
Date: Sun, 02 Apr 2023 23:24:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)

Po Lu <luangruo@yahoo.com> writes:

> Daniel Martín <mardani29@yahoo.es> writes:
>
>> I've solved the bug by replicating that logic in the appropriate places,
>> nsterm.m and macfont.m:
>
> Nice, thanks.
>
>> +              CGColorRef colorref = get_cgcolor_from_nscolor 
>> (FRAME_CURSOR_COLOR (f), f);
>
> This row is now wider than 80 columns.  Please wrap it.
>

Alright, I have also extracted a couple of macros because there were
already some macros for similar code patterns.

>>            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);
>>
>
> Please write:
>
>   (face && (NS_FACE_BACKGROUND (face)
>           == [(NSColor *) FRAME_CURSOR_COLOR (s->f)
>                   unsignedLong]))
>
> instead.

Done.

>
>> Could you give it a try on macOS and GNUstep?  Thank you.
>
> Works for me, thanks.
>
> P.S. I think what needs to be done is to make the NS port keep track of
> glyph string colors through GCs, so that the relevant code can be easily
> synchronized with X.

Yes, I agree that we should refactor the code to use GCs in order to
avoid these differences with X.  Maybe I can work on that and suggest a
patch for the master branch.

Attachment: 0001-Change-cursor-color-on-NS-port-when-it-matches-the-f.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]