Skip to content

Commit 6bfc5fc

Browse files
committed
Remove display member of glyph_string
This member has little value even on X, and it leaks internal backend details to the glyph_string struct. * src/dispextern.h (glyph_string): Remove X display member. * src/xdisp.c (init_glyph_string): Remove initialization of display. * src/xfont.c (xfont_draw): * src/xterm.c: Use FRAME_X_DISPLAY (s->f) instead of display member.
1 parent 6556348 commit 6bfc5fc

File tree

4 files changed

+90
-74
lines changed

4 files changed

+90
-74
lines changed

src/dispextern.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,9 +1281,6 @@ struct glyph_string
12811281
/* The window on which the glyph string is drawn. */
12821282
struct window *w;
12831283

1284-
/* X display and window for convenience. */
1285-
Display *display;
1286-
12871284
/* The glyph row for which this string was built. It determines the
12881285
y-origin and height of the string. */
12891286
struct glyph_row *row;

src/xdisp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25953,7 +25953,6 @@ init_glyph_string (struct glyph_string *s,
2595325953
#ifdef HAVE_NTGUI
2595425954
s->hdc = hdc;
2595525955
#endif
25956-
s->display = FRAME_X_DISPLAY (s->f);
2595725956
s->char2b = char2b;
2595825957
s->hl = hl;
2595925958
s->row = row;

src/xfont.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,14 +1000,15 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
10001000
bool with_background)
10011001
{
10021002
XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont;
1003+
Display *display = FRAME_X_DISPLAY (s->f);
10031004
int len = to - from;
10041005
GC gc = s->gc;
10051006
int i;
10061007

10071008
if (s->gc != s->face->gc)
10081009
{
10091010
block_input ();
1010-
XSetFont (s->display, gc, xfont->fid);
1011+
XSetFont (display, gc, xfont->fid);
10111012
unblock_input ();
10121013
}
10131014

@@ -1022,20 +1023,20 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
10221023
{
10231024
if (s->padding_p)
10241025
for (i = 0; i < len; i++)
1025-
XDrawImageString (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
1026+
XDrawImageString (display, FRAME_X_DRAWABLE (s->f),
10261027
gc, x + i, y, str + i, 1);
10271028
else
1028-
XDrawImageString (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
1029+
XDrawImageString (display, FRAME_X_DRAWABLE (s->f),
10291030
gc, x, y, str, len);
10301031
}
10311032
else
10321033
{
10331034
if (s->padding_p)
10341035
for (i = 0; i < len; i++)
1035-
XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
1036+
XDrawString (display, FRAME_X_DRAWABLE (s->f),
10361037
gc, x + i, y, str + i, 1);
10371038
else
1038-
XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
1039+
XDrawString (display, FRAME_X_DRAWABLE (s->f),
10391040
gc, x, y, str, len);
10401041
}
10411042
unblock_input ();
@@ -1048,20 +1049,20 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
10481049
{
10491050
if (s->padding_p)
10501051
for (i = 0; i < len; i++)
1051-
XDrawImageString16 (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
1052+
XDrawImageString16 (display, FRAME_X_DRAWABLE (s->f),
10521053
gc, x + i, y, s->char2b + from + i, 1);
10531054
else
1054-
XDrawImageString16 (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
1055+
XDrawImageString16 (display, FRAME_X_DRAWABLE (s->f),
10551056
gc, x, y, s->char2b + from, len);
10561057
}
10571058
else
10581059
{
10591060
if (s->padding_p)
10601061
for (i = 0; i < len; i++)
1061-
XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
1062+
XDrawString16 (display, FRAME_X_DRAWABLE (s->f),
10621063
gc, x + i, y, s->char2b + from + i, 1);
10631064
else
1064-
XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_DRAWABLE (s->f),
1065+
XDrawString16 (display, FRAME_X_DRAWABLE (s->f),
10651066
gc, x, y, s->char2b + from, len);
10661067
}
10671068
unblock_input ();

0 commit comments

Comments
 (0)