[v2] riched20: allow setting background text color

Huw Davies huw at codeweavers.com
Wed Aug 10 03:05:00 CDT 2016


On Tue, Aug 09, 2016 at 03:17:36PM -0600, Kenneth Haley wrote:
> --- a/dlls/riched20/paint.c
> +++ b/dlls/riched20/paint.c
> @@ -318,10 +318,23 @@ static void get_selection_rect( ME_Context *c, ME_Run *run, int from, int to, in
>  static void draw_text( ME_Context *c, ME_Run *run, int x, int y, BOOL selected, RECT *sel_rect )
>  {
>      COLORREF text_color = get_text_color( c, run->style, selected );
> -    COLORREF back_color = selected ? ITextHost_TxGetSysColor( c->editor->texthost, COLOR_HIGHLIGHT ) : 0;
> +    COLORREF back_color = 0;
>      COLORREF old_text, old_back = 0;
>      const WCHAR *text = get_text( run, 0 );
>      ME_String *masked = NULL;
> +    BOOL paint_bg = FALSE;
> +
> +    if (selected)
> +    {
> +        back_color = ITextHost_TxGetSysColor(c->editor->texthost, COLOR_HIGHLIGHT);
> +        paint_bg = TRUE;
> +    }
> +    else if (run->style->fmt.dwMask & CFM_BACKCOLOR &&
> +             !(CFE_AUTOBACKCOLOR & run->style->fmt.dwEffects))
> +    {
> +        back_color = run->style->fmt.crBackColor;
> +        paint_bg = TRUE;
> +    }

This doesn't work for me.  You need to use the new paint_bg boolean to
trigger the ETO_OPAQUE flags below.

Also there's some odd behaviour if you select text in a run with
background colour - the selection is correctly highlighted, but the
rest of the run loses its background colour.

Huw.



More information about the wine-devel mailing list