int from, int to, int x, int y, bool with_background)
{
struct frame *f = s->f;
- struct face *face = s->face;
struct font_info *ftcrfont_info = (struct font_info *) s->font;
cairo_t *cr;
cairo_glyph_t *glyphs;
int len = to - from;
int i;
+#ifdef USE_BE_CAIRO
+ unsigned long be_foreground, be_background;
+
+ if (s->hl != DRAW_CURSOR)
+ {
+ be_foreground = s->face->foreground;
+ be_background = s->face->background;
+ }
+ else
+ haiku_merge_cursor_foreground (s, &be_foreground,
+ &be_background);
+#endif
block_input ();
#else
struct face *face = s->face;
- uint32_t col = s->hl == DRAW_CURSOR ?
- FRAME_CURSOR_COLOR (s->f).pixel : face->background;
+ uint32_t col = be_background;
cairo_set_source_rgb (cr, RED_FROM_ULONG (col) / 255.0,
GREEN_FROM_ULONG (col) / 255.0,
pgtk_set_cr_source_with_color (f, s->xgcv.foreground, false);
#endif
#else
- uint32_t col = s->hl == DRAW_CURSOR ?
- FRAME_OUTPUT_DATA (s->f)->cursor_fg : face->foreground;
+ uint32_t col = be_foreground;
cairo_set_source_rgb (cr, RED_FROM_ULONG (col) / 255.0,
GREEN_FROM_ULONG (col) / 255.0,
struct font_info *info = (struct font_info *) s->font;
unsigned char mb[MAX_MULTIBYTE_LENGTH];
void *view = FRAME_HAIKU_VIEW (f);
+ unsigned long foreground, background;
block_input ();
prepare_face_for_display (s->f, face);
+ if (s->hl != DRAW_CURSOR)
+ {
+ foreground = s->face->foreground;
+ background = s->face->background;
+ }
+ else
+ haiku_merge_cursor_foreground (s, &foreground, &background);
+
/* Presumably the draw lock is already held by
haiku_draw_glyph_string; */
if (with_background)
s->first_glyph->slice.glyphless.lower_yoff
- s->first_glyph->slice.glyphless.upper_yoff;
- BView_SetHighColor (view, s->hl == DRAW_CURSOR ?
- FRAME_CURSOR_COLOR (s->f).pixel : face->background);
-
+ BView_SetHighColor (view, background);
BView_FillRectangle (view, x, y - ascent, s->width, height);
s->background_filled_p = 1;
}
- if (s->hl == DRAW_CURSOR)
- BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
- else
- BView_SetHighColor (view, face->foreground);
-
+ BView_SetHighColor (view, foreground);
BView_MovePenTo (view, x, y);
BView_SetFont (view, ((struct haikufont_info *) info)->be_font);
}
#endif
+void
+haiku_merge_cursor_foreground (struct glyph_string *s,
+ unsigned long *foreground_out,
+ unsigned long *background_out)
+{
+ unsigned long background = FRAME_CURSOR_COLOR (s->f).pixel;
+ unsigned long foreground = s->face->background;
+
+ if (background == foreground)
+ foreground = s->face->background;
+ if (background == foreground)
+ foreground = FRAME_OUTPUT_DATA (s->f)->cursor_fg;
+ if (background == foreground)
+ foreground = s->face->foreground;
+
+ if (background == s->face->background
+ || foreground == s->face->foreground)
+ {
+ background = s->face->foreground;
+ foreground = s->face->background;
+ }
+
+ *foreground_out = foreground;
+ *background_out = background;
+}
+
void
syms_of_haikuterm (void)
{
extern void
haiku_end_cr_clip (cairo_t *cr);
#endif
+
+extern void haiku_merge_cursor_foreground (struct glyph_string *, unsigned long *,
+ unsigned long *);
#endif /* _HAIKU_TERM_H_ */