emacs-diffs
[Top][All Lists]
Advanced

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

master adf1ba578d: Finish up cursor color merging on Haiku


From: Po Lu
Subject: master adf1ba578d: Finish up cursor color merging on Haiku
Date: Sat, 5 Feb 2022 00:08:41 -0500 (EST)

branch: master
commit adf1ba578d1d5533382270919ddde77413aec906
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Finish up cursor color merging on Haiku
    
    * src/haikuterm.c (haiku_draw_text_decoration):
    (haiku_draw_plain_background):
    (haiku_draw_stretch_glyph_string):
    (haiku_merge_cursor_foreground): Use merged cursor colors.
---
 src/haikuterm.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/haikuterm.c b/src/haikuterm.c
index 6707340ca0..2436558e31 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -606,15 +606,20 @@ static void
 haiku_draw_text_decoration (struct glyph_string *s, struct face *face,
                            int width, int x)
 {
+  unsigned long cursor_color;
+
   if (s->for_overlaps)
     return;
 
+  if (s->hl == DRAW_CURSOR)
+    haiku_merge_cursor_foreground (s, &cursor_color, NULL);
+
   void *view = FRAME_HAIKU_VIEW (s->f);
 
   if (face->underline)
     {
       if (s->hl == DRAW_CURSOR)
-       BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
+       BView_SetHighColor (view, cursor_color);
       else if (!face->underline_defaulted_p)
        BView_SetHighColor (view, face->underline_color);
       else
@@ -711,7 +716,7 @@ haiku_draw_text_decoration (struct glyph_string *s, struct 
face *face,
     {
       unsigned long dy = 0, h = 1;
       if (s->hl == DRAW_CURSOR)
-       BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
+       BView_SetHighColor (view, cursor_color);
       else if (!face->overline_color_defaulted_p)
        BView_SetHighColor (view, face->overline_color);
       else
@@ -735,7 +740,7 @@ haiku_draw_text_decoration (struct glyph_string *s, struct 
face *face,
       unsigned long dy = (glyph_height - h) / 2;
 
       if (s->hl == DRAW_CURSOR)
-       BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
+       BView_SetHighColor (view, cursor_color);
       else if (!face->strike_through_color_defaulted_p)
        BView_SetHighColor (view, face->strike_through_color);
       else
@@ -812,8 +817,12 @@ haiku_draw_plain_background (struct glyph_string *s, 
struct face *face,
                             int box_line_hwidth, int box_line_vwidth)
 {
   void *view = FRAME_HAIKU_VIEW (s->f);
+  unsigned long cursor_color;
   if (s->hl == DRAW_CURSOR)
-    BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel);
+    {
+      haiku_merge_cursor_foreground (s, NULL, &cursor_color);
+      BView_SetHighColor (view, cursor_color);
+    }
   else
     BView_SetHighColor (view, face->background_defaulted_p ?
                        FRAME_BACKGROUND_PIXEL (s->f) :
@@ -1045,7 +1054,10 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
        x -= width;
 
       void *view = FRAME_HAIKU_VIEW (s->f);
-      BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel);
+      unsigned long cursor_color;
+
+      haiku_merge_cursor_foreground (s, NULL, &cursor_color);
+      BView_SetHighColor (view, cursor_color);
       BView_FillRectangle (view, x, s->y, width, s->height);
 
       if (width < background_width)
@@ -1088,9 +1100,9 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
       if (background_width > 0)
        {
          void *view = FRAME_HAIKU_VIEW (s->f);
-         uint32_t bkg;
+         unsigned long bkg;
          if (s->hl == DRAW_CURSOR)
-           bkg = FRAME_CURSOR_COLOR (s->f).pixel;
+           haiku_merge_cursor_foreground (s, NULL, &bkg);
          else
            bkg = s->face->background;
 
@@ -3665,8 +3677,10 @@ haiku_merge_cursor_foreground (struct glyph_string *s,
       foreground = s->face->background;
     }
 
-  *foreground_out = foreground;
-  *background_out = background;
+  if (foreground_out)
+    *foreground_out = foreground;
+  if (background_out)
+    *background_out = background;
 }
 
 void



reply via email to

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