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

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

bug#35468: [PATCH] Refactor draw_glyph_string on X and w32


From: Eli Zaretskii
Subject: bug#35468: [PATCH] Refactor draw_glyph_string on X and w32
Date: Tue, 30 Apr 2019 07:59:37 +0300

> From: Alex Gramiak <agrambot@gmail.com>
> Cc: 35468@debbugs.gnu.org
> Date: Mon, 29 Apr 2019 11:43:23 -0600
> 
> I'm in {x,w32}_draw_box_rect right now, trying to generalize both
> versions. The issue is that the fill command in each accepts different
> arguments; specifically the w32 version takes in the color explicitly
> and uses s->hdc instead of s->gc. So I think there will have to be 2
> different fill_rectangle interface procedures: one for glyph strings (so
> that the w32 version can access s->hdc), and another for other
> procedures like *_draw_bar_cursor.

Would it be possible to generalize this into a single interface?  The
GC vs HDC part can be generalized by passing both (HDC will be NULL in
the X and NS cases), and the color will be passed as in the w32
version, with the X version doing its thing with GCForeground
internally.  Alternatively, we could have a set_foreground interface
that will do nothing for w32 and for X call XGetGCValues and
XSetForeground, to set up s->gc.  The second alternative will probably
be more efficient.

If this doesn't work, can you tell why?

> It doesn't work for NS partially because of the following section only
> present in the NS equivalent of gui_draw_glyph_string_box. Would you be
> okay with putting this in the generic version inside a FRAME_NS_P (s->f)
> check? I don't know why only NS has this, though...
> 
>   if (s->hl == DRAW_MOUSE_FACE)
>     {
>       face = FACE_FROM_ID_OR_NULL (s->f,
>                                  MOUSE_HL_INFO (s->f)->mouse_face_face_id);
>       if (!face)
>         face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
>     }
>   else
>     face = s->face;

I don't know why this is TRT, either.  We could ask Alan to look into
this, or we could simply remove that, as other terminals don't use
box_line_width from the mouse face, they use s->face instead.

Thanks.





reply via email to

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