emacs-diffs
[Top][All Lists]
Advanced

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

master b0fd3ec2c0: Ensure bar cursors are always visible on Haiku


From: Po Lu
Subject: master b0fd3ec2c0: Ensure bar cursors are always visible on Haiku
Date: Sun, 6 Feb 2022 08:08:54 -0500 (EST)

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

    Ensure bar cursors are always visible on Haiku
    
    * src/haikuterm.c (haiku_draw_window_cursor): Adjust bar cursor
    colors like X.
---
 src/haikuterm.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/haikuterm.c b/src/haikuterm.c
index 2436558e31..0c7e08585e 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -1687,7 +1687,7 @@ haiku_draw_window_cursor (struct window *w,
                          int cursor_width, bool on_p, bool active_p)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
-
+  struct face *face;
   struct glyph *phys_cursor_glyph;
   struct glyph *cursor_glyph;
 
@@ -1741,7 +1741,26 @@ haiku_draw_window_cursor (struct window *w,
 
   BView_draw_lock (view);
   BView_StartClip (view);
-  BView_SetHighColor (view, FRAME_CURSOR_COLOR (f).pixel);
+
+  if (cursor_type == BAR_CURSOR)
+    {
+      cursor_glyph = get_phys_cursor_glyph (w);
+      face = FACE_FROM_ID (f, cursor_glyph->face_id);
+    }
+
+  /* If the glyph's background equals the color we normally draw the
+     bar cursor in, our cursor in its normal color is invisible.  Use
+     the glyph's foreground color instead in this case, on the
+     assumption that the glyph's colors are chosen so that the glyph
+     is legible.  */
+
+  /* xterm.c only does this for bar cursors, and nobody has
+     complained, so it would be best to do that here as well.  */
+  if (cursor_type == BAR_CURSOR
+      && face->background == FRAME_CURSOR_COLOR (f).pixel)
+    BView_SetHighColor (view, face->foreground);
+  else
+    BView_SetHighColor (view, FRAME_CURSOR_COLOR (f).pixel);
   haiku_clip_to_row (w, glyph_row, TEXT_AREA);
 
   switch (cursor_type)
@@ -1754,7 +1773,6 @@ haiku_draw_window_cursor (struct window *w,
       BView_FillRectangle (view, fx, fy, w->phys_cursor_width, h);
       break;
     case BAR_CURSOR:
-      cursor_glyph = get_phys_cursor_glyph (w);
       if (cursor_glyph->resolved_level & 1)
        BView_FillRectangle (view, fx + cursor_glyph->pixel_width - 
w->phys_cursor_width,
                             fy, w->phys_cursor_width, h);



reply via email to

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