[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mode-line display bug in XFT_JHD_BRANCH
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: Mode-line display bug in XFT_JHD_BRANCH |
Date: |
Tue, 25 Apr 2006 17:11:41 +0900 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
>>>>> On Mon, 17 Apr 2006 13:09:16 +0530, Baishampayan Ghose <address@hidden>
>>>>> said:
> Hello, I am using the Emacs XFT_JHD_BRANCH and there is a weird
> mode-line display bug in it. When the file has variable width fonts
> like in LaTeX mode, the mode-line becomes garbled on scrolling. A
> screen shot [0] is attached. I guess now that the XFT & Unicode
> branches have been merged, this critical bug will be fixed. I can
> help with testing the branch by doing daily builds, if it's being
> developed actively. Miles, what do you think about this? Regards,
> BG
> [0] http://people.ubuntu-in.org/~ghoseb/emacs_xft_mode-line_bug.png
I tried to make a small patch for some problems that don't require too
many changes to fix (or workaround). This is for XFT_JHD_BRANCH, not
for unicode-xft. I don't have a plan to work for Xft support, but I
simply ported some results from my previous ATSUI support on Mac to
Xft.
YAMAMOTO Mitsuharu
address@hidden
Index: src/xfaces.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfaces.c,v
retrieving revision 1.316.2.4
diff -c -r1.316.2.4 xfaces.c
*** src/xfaces.c 12 Jan 2006 10:25:47 -0000 1.316.2.4
--- src/xfaces.c 25 Apr 2006 07:37:07 -0000
***************
*** 5282,5288 ****
XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->cmap,
colors, 2);
! face->xft_fg.color.alpha = face->xft_fg.color.alpha = 0xffff;
face->xft_fg.color.red = colors[0].red;
face->xft_fg.color.green = colors[0].green;
face->xft_fg.color.blue = colors[0].blue;
--- 5282,5288 ----
XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->cmap,
colors, 2);
! face->xft_fg.color.alpha = face->xft_bg.color.alpha = 0xffff;
face->xft_fg.color.red = colors[0].red;
face->xft_fg.color.green = colors[0].green;
face->xft_fg.color.blue = colors[0].blue;
***************
*** 7243,7248 ****
--- 7243,7251 ----
{
bcopy (base_face, face, sizeof *face);
face->gc = 0;
+ #ifdef HAVE_XFT
+ face->xft_draw = NULL;
+ #endif
/* Don't try to free the colors copied bitwise from BASE_FACE. */
face->colors_copied_bitwise_p = 1;
Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.861.2.4
diff -c -r1.861.2.4 xterm.c
*** src/xterm.c 12 Jan 2006 10:25:47 -0000 1.861.2.4
--- src/xterm.c 25 Apr 2006 07:37:08 -0000
***************
*** 1202,1210 ****
x_set_glyph_string_clipping (s)
struct glyph_string *s;
{
! XRectangle r;
! get_glyph_string_clip_rect (s, &r);
! XSetClipRectangles (s->display, s->gc, 0, 0, &r, 1, Unsorted);
}
--- 1202,1216 ----
x_set_glyph_string_clipping (s)
struct glyph_string *s;
{
! #define MAX_CLIP_RECTS 2
! XRectangle r[MAX_CLIP_RECTS];
! int n;
!
! n = get_glyph_string_clip_rects (s, r, MAX_CLIP_RECTS);
! XSetClipRectangles (s->display, s->gc, 0, 0, r, n, Unsorted);
! #ifdef HAVE_XFT
! XftDrawSetClipRectangles (s->face->xft_draw, 0, 0, r, n);
! #endif
}
***************
*** 1382,1392 ****
strlen (weight_name) +
strlen (slant_name) +
5 + /* pixel */
! 9 + /* stars */
14 + /* dashes */
1); /* null */
xlfd = malloc (len);
! sprintf(xlfd, "-%s-%s-%s-%s-*-*-%d-*-*-*-*-0-*-*",
foundry, family, weight_name, slant_name,
(int) (pixel + 0.5));
return xlfd;
--- 1388,1398 ----
strlen (weight_name) +
strlen (slant_name) +
5 + /* pixel */
! 6 + 1 + 8 + 1 + /* stars, "0", "iso10646", "1" */
14 + /* dashes */
1); /* null */
xlfd = malloc (len);
! sprintf(xlfd, "-%s-%s-%s-%s-*-*-%d-*-*-*-*-0-iso10646-1",
foundry, family, weight_name, slant_name,
(int) (pixel + 0.5));
return xlfd;
***************
*** 1551,1589 ****
use XDrawImageString when drawing the cursor so that there is
no chance that characters under a box cursor are invisible. */
#ifdef HAVE_XFT
! /* KOKO: Always clear background for now, there are some redraw problems
! otherwise. */
! if (1 || ! (s->for_overlaps
! || (s->background_filled_p && s->hl != DRAW_CURSOR)))
! XftDrawRect (s->face->xft_draw,
! s->hl == DRAW_CURSOR ? &s->face->xft_fg :
&s->face->xft_bg,
! s->x,
! s->y,
! s->width + s->right_overhang,
! s->height);
! if (s->two_byte_p)
! {
! XftChar16 ch[s->nchars];
! int i;
! for (i = 0; i < s->nchars; ++i)
! ch[i] = s->char2b[i].byte2 | (s->char2b[i].byte1 << 8);
! XftDrawString16 (s->face->xft_draw,
! &s->face->xft_fg,
! s->face->font,
! x,
! s->ybase - boff,
! ch,
! s->nchars);
! }
! else
! XftDrawString8 (s->face->xft_draw,
! &s->face->xft_fg,
! s->face->font,
! x,
! s->ybase - boff,
! char1b,
! s->nchars);
#else
if (s->for_overlaps
|| (s->background_filled_p && s->hl != DRAW_CURSOR))
--- 1557,1629 ----
use XDrawImageString when drawing the cursor so that there is
no chance that characters under a box cursor are invisible. */
#ifdef HAVE_XFT
! {
! XftColor *fg, *bg, xft_fg, xft_bg;
! if (s->hl != DRAW_CURSOR)
! {
! /* Usually s->gc == s->face->gc. At least, colors
! coincide. */
! fg = &s->face->xft_fg;
! bg = &s->face->xft_bg;
! }
! else
! {
! /* A little bit inefficient, but only occurs when drawing
! a cursor. */
! XGCValues xgcv;
! XColor colors[2];
!
! XGetGCValues (s->display, s->gc, GCForeground | GCBackground,
! &xgcv);
! colors[0].pixel = xft_fg.pixel = xgcv.foreground;
! colors[1].pixel = xft_bg.pixel = xgcv.background;
! XQueryColors (FRAME_X_DISPLAY (s->f),
! FRAME_X_DISPLAY_INFO (s->f)->cmap,
! colors, 2);
! xft_fg.color.alpha = xft_bg.color.alpha = 0xffff;
! xft_fg.color.red = colors[0].red;
! xft_fg.color.green = colors[0].green;
! xft_fg.color.blue = colors[0].blue;
! xft_bg.color.red = colors[1].red;
! xft_bg.color.green = colors[1].green;
! xft_bg.color.blue = colors[1].blue;
! fg = &xft_fg;
! bg = &xft_bg;
! }
!
! if (! (s->for_overlaps
! || (s->background_filled_p && s->hl != DRAW_CURSOR)))
! XftDrawRect (s->face->xft_draw,
! bg,
! s->x,
! s->y,
! s->background_width,
! s->height);
!
! if (s->two_byte_p)
! {
! XftChar16 ch[s->nchars];
! int i;
! for (i = 0; i < s->nchars; ++i)
! ch[i] = s->char2b[i].byte2 | (s->char2b[i].byte1 << 8);
! XftDrawString16 (s->face->xft_draw,
! fg,
! s->face->font,
! x,
! s->ybase - boff,
! ch,
! s->nchars);
! }
! else
! XftDrawString8 (s->face->xft_draw,
! fg,
! s->face->font,
! x,
! s->ybase - boff,
! char1b,
! s->nchars);
! }
#else
if (s->for_overlaps
|| (s->background_filled_p && s->hl != DRAW_CURSOR))