apply patch st-glyph-wide-support
This commit is contained in:
parent
08eaa176d5
commit
4b7404dab1
251
patches/st-glyph-wide-support-20230701-5770f2f.diff
Normal file
251
patches/st-glyph-wide-support-20230701-5770f2f.diff
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
From 5770f2fc02afca341c275fc340bbc5003ecc3df8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Iskustvo <iskustvo@yahoo.com>
|
||||||
|
Date: Sat, 7 Jan 2023 01:23:37 +0100
|
||||||
|
Subject: [PATCH] [PATCH] add glyph wide support patch
|
||||||
|
|
||||||
|
---
|
||||||
|
st.c | 3 +-
|
||||||
|
st.h | 6 +++
|
||||||
|
win.h | 2 +-
|
||||||
|
x.c | 141 ++++++++++++++++++++++++++++++----------------------------
|
||||||
|
4 files changed, 81 insertions(+), 71 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/st.c b/st.c
|
||||||
|
index 62def59..cc6c78e 100644
|
||||||
|
--- a/st.c
|
||||||
|
+++ b/st.c
|
||||||
|
@@ -2640,7 +2640,8 @@ draw(void)
|
||||||
|
|
||||||
|
drawregion(0, 0, term.col, term.row);
|
||||||
|
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
||||||
|
- term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
||||||
|
+ term.ocx, term.ocy, term.line[term.ocy][term.ocx],
|
||||||
|
+ term.line[term.ocy], term.col);
|
||||||
|
term.ocx = cx;
|
||||||
|
term.ocy = term.c.y;
|
||||||
|
xfinishdraw();
|
||||||
|
diff --git a/st.h b/st.h
|
||||||
|
index fd3b0d8..0053050 100644
|
||||||
|
--- a/st.h
|
||||||
|
+++ b/st.h
|
||||||
|
@@ -36,6 +36,12 @@ enum glyph_attribute {
|
||||||
|
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
|
||||||
|
};
|
||||||
|
|
||||||
|
+enum drawing_mode {
|
||||||
|
+ DRAW_NONE = 0,
|
||||||
|
+ DRAW_BG = 1 << 0,
|
||||||
|
+ DRAW_FG = 1 << 1,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
enum selection_mode {
|
||||||
|
SEL_IDLE = 0,
|
||||||
|
SEL_EMPTY = 1,
|
||||||
|
diff --git a/win.h b/win.h
|
||||||
|
index 6de960d..94679e4 100644
|
||||||
|
--- a/win.h
|
||||||
|
+++ b/win.h
|
||||||
|
@@ -25,7 +25,7 @@ enum win_mode {
|
||||||
|
|
||||||
|
void xbell(void);
|
||||||
|
void xclipcopy(void);
|
||||||
|
-void xdrawcursor(int, int, Glyph, int, int, Glyph);
|
||||||
|
+void xdrawcursor(int, int, Glyph, int, int, Glyph, Line, int);
|
||||||
|
void xdrawline(Line, int, int, int);
|
||||||
|
void xfinishdraw(void);
|
||||||
|
void xloadcols(void);
|
||||||
|
diff --git a/x.c b/x.c
|
||||||
|
index aa09997..85deee6 100644
|
||||||
|
--- a/x.c
|
||||||
|
+++ b/x.c
|
||||||
|
@@ -142,7 +142,7 @@ typedef struct {
|
||||||
|
|
||||||
|
static inline ushort sixd_to_16bit(int);
|
||||||
|
static int xmakeglyphfontspecs(XftGlyphFontSpec *, const Glyph *, int, int, int);
|
||||||
|
-static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int);
|
||||||
|
+static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int, int);
|
||||||
|
static void xdrawglyph(Glyph, int, int);
|
||||||
|
static void xclear(int, int, int, int);
|
||||||
|
static int xgeommasktogravity(int);
|
||||||
|
@@ -1372,7 +1372,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
-xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
|
||||||
|
+xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y, int dmode)
|
||||||
|
{
|
||||||
|
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
|
||||||
|
int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
|
||||||
|
@@ -1463,47 +1463,40 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
||||||
|
if (base.mode & ATTR_INVISIBLE)
|
||||||
|
fg = bg;
|
||||||
|
|
||||||
|
- /* Intelligent cleaning up of the borders. */
|
||||||
|
- if (x == 0) {
|
||||||
|
- xclear(0, (y == 0)? 0 : winy, borderpx,
|
||||||
|
- winy + win.ch +
|
||||||
|
- ((winy + win.ch >= borderpx + win.th)? win.h : 0));
|
||||||
|
- }
|
||||||
|
- if (winx + width >= borderpx + win.tw) {
|
||||||
|
- xclear(winx + width, (y == 0)? 0 : winy, win.w,
|
||||||
|
- ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
|
||||||
|
- }
|
||||||
|
- if (y == 0)
|
||||||
|
- xclear(winx, 0, winx + width, borderpx);
|
||||||
|
- if (winy + win.ch >= borderpx + win.th)
|
||||||
|
- xclear(winx, winy + win.ch, winx + width, win.h);
|
||||||
|
-
|
||||||
|
- /* Clean up the region we want to draw to. */
|
||||||
|
- XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);
|
||||||
|
-
|
||||||
|
- /* Set the clip region because Xft is sometimes dirty. */
|
||||||
|
- r.x = 0;
|
||||||
|
- r.y = 0;
|
||||||
|
- r.height = win.ch;
|
||||||
|
- r.width = width;
|
||||||
|
- XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
|
||||||
|
-
|
||||||
|
- /* Render the glyphs. */
|
||||||
|
- XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
|
||||||
|
-
|
||||||
|
- /* Render underline and strikethrough. */
|
||||||
|
- if (base.mode & ATTR_UNDERLINE) {
|
||||||
|
- XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1,
|
||||||
|
- width, 1);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (base.mode & ATTR_STRUCK) {
|
||||||
|
- XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent * chscale / 3,
|
||||||
|
- width, 1);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* Reset clip to none. */
|
||||||
|
- XftDrawSetClip(xw.draw, 0);
|
||||||
|
+ if (dmode & DRAW_BG) {
|
||||||
|
+ /* Intelligent cleaning up of the borders. */
|
||||||
|
+ if (x == 0) {
|
||||||
|
+ xclear(0, (y == 0)? 0 : winy, borderpx,
|
||||||
|
+ winy + win.ch +
|
||||||
|
+ ((winy + win.ch >= borderpx + win.th)? win.h : 0));
|
||||||
|
+ }
|
||||||
|
+ if (winx + width >= borderpx + win.tw) {
|
||||||
|
+ xclear(winx + width, (y == 0)? 0 : winy, win.w,
|
||||||
|
+ ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
|
||||||
|
+ }
|
||||||
|
+ if (y == 0)
|
||||||
|
+ xclear(winx, 0, winx + width, borderpx);
|
||||||
|
+ if (winy + win.ch >= borderpx + win.th)
|
||||||
|
+ xclear(winx, winy + win.ch, winx + width, win.h);
|
||||||
|
+ /* Fill the background */
|
||||||
|
+ XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (dmode & DRAW_FG) {
|
||||||
|
+ /* Render the glyphs. */
|
||||||
|
+ XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
|
||||||
|
+
|
||||||
|
+ /* Render underline and strikethrough. */
|
||||||
|
+ if (base.mode & ATTR_UNDERLINE) {
|
||||||
|
+ XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
|
||||||
|
+ width, 1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (base.mode & ATTR_STRUCK) {
|
||||||
|
+ XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3,
|
||||||
|
+ width, 1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -1513,18 +1506,21 @@ xdrawglyph(Glyph g, int x, int y)
|
||||||
|
XftGlyphFontSpec spec;
|
||||||
|
|
||||||
|
numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y);
|
||||||
|
- xdrawglyphfontspecs(&spec, g, numspecs, x, y);
|
||||||
|
+ xdrawglyphfontspecs(&spec, g, numspecs, x, y, DRAW_BG | DRAW_FG);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
-xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
||||||
|
+xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
|
||||||
|
{
|
||||||
|
Color drawcol;
|
||||||
|
|
||||||
|
/* remove the old cursor */
|
||||||
|
if (selected(ox, oy))
|
||||||
|
og.mode ^= ATTR_REVERSE;
|
||||||
|
- xdrawglyph(og, ox, oy);
|
||||||
|
+
|
||||||
|
+ /* Redraw the line where cursor was previously.
|
||||||
|
+ * It will restore wide glyphs and ligatures broken by the cursor. */
|
||||||
|
+ xdrawline(line, 0, oy, len);
|
||||||
|
|
||||||
|
if (IS_SET(MODE_HIDE))
|
||||||
|
return;
|
||||||
|
@@ -1648,32 +1644,39 @@ xstartdraw(void)
|
||||||
|
void
|
||||||
|
xdrawline(Line line, int x1, int y1, int x2)
|
||||||
|
{
|
||||||
|
- int i, x, ox, numspecs;
|
||||||
|
+ int i, x, ox, numspecs, numspecs_cached;
|
||||||
|
Glyph base, new;
|
||||||
|
- XftGlyphFontSpec *specs = xw.specbuf;
|
||||||
|
-
|
||||||
|
- numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1);
|
||||||
|
- i = ox = 0;
|
||||||
|
- for (x = x1; x < x2 && i < numspecs; x++) {
|
||||||
|
- new = line[x];
|
||||||
|
- if (new.mode == ATTR_WDUMMY)
|
||||||
|
- continue;
|
||||||
|
- if (selected(x, y1))
|
||||||
|
- new.mode ^= ATTR_REVERSE;
|
||||||
|
- if (i > 0 && ATTRCMP(base, new)) {
|
||||||
|
- xdrawglyphfontspecs(specs, base, i, ox, y1);
|
||||||
|
- specs += i;
|
||||||
|
- numspecs -= i;
|
||||||
|
- i = 0;
|
||||||
|
- }
|
||||||
|
- if (i == 0) {
|
||||||
|
- ox = x;
|
||||||
|
- base = new;
|
||||||
|
+ XftGlyphFontSpec *specs;
|
||||||
|
+
|
||||||
|
+ numspecs_cached = xmakeglyphfontspecs(xw.specbuf, &line[x1], x2 - x1, x1, y1);
|
||||||
|
+
|
||||||
|
+ /* Draw line in 2 passes: background and foreground. This way wide glyphs
|
||||||
|
+ won't get truncated (#223) */
|
||||||
|
+ for (int dmode = DRAW_BG; dmode <= DRAW_FG; dmode <<= 1) {
|
||||||
|
+ specs = xw.specbuf;
|
||||||
|
+ numspecs = numspecs_cached;
|
||||||
|
+ i = ox = 0;
|
||||||
|
+ for (x = x1; x < x2 && i < numspecs; x++) {
|
||||||
|
+ new = line[x];
|
||||||
|
+ if (new.mode == ATTR_WDUMMY)
|
||||||
|
+ continue;
|
||||||
|
+ if (selected(x, y1))
|
||||||
|
+ new.mode ^= ATTR_REVERSE;
|
||||||
|
+ if (i > 0 && ATTRCMP(base, new)) {
|
||||||
|
+ xdrawglyphfontspecs(specs, base, i, ox, y1, dmode);
|
||||||
|
+ specs += i;
|
||||||
|
+ numspecs -= i;
|
||||||
|
+ i = 0;
|
||||||
|
+ }
|
||||||
|
+ if (i == 0) {
|
||||||
|
+ ox = x;
|
||||||
|
+ base = new;
|
||||||
|
+ }
|
||||||
|
+ i++;
|
||||||
|
}
|
||||||
|
- i++;
|
||||||
|
+ if (i > 0)
|
||||||
|
+ xdrawglyphfontspecs(specs, base, i, ox, y1, dmode);
|
||||||
|
}
|
||||||
|
- if (i > 0)
|
||||||
|
- xdrawglyphfontspecs(specs, base, i, ox, y1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
--
|
||||||
|
2.39.0
|
||||||
|
|
||||||
3
st.c
3
st.c
@ -2654,7 +2654,8 @@ draw(void)
|
|||||||
|
|
||||||
drawregion(0, 0, term.col, term.row);
|
drawregion(0, 0, term.col, term.row);
|
||||||
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
||||||
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
term.ocx, term.ocy, term.line[term.ocy][term.ocx],
|
||||||
|
term.line[term.ocy], term.col);
|
||||||
term.ocx = cx;
|
term.ocx = cx;
|
||||||
term.ocy = term.c.y;
|
term.ocy = term.c.y;
|
||||||
xfinishdraw();
|
xfinishdraw();
|
||||||
|
|||||||
6
st.h
6
st.h
@ -36,6 +36,12 @@ enum glyph_attribute {
|
|||||||
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
|
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum drawing_mode {
|
||||||
|
DRAW_NONE = 0,
|
||||||
|
DRAW_BG = 1 << 0,
|
||||||
|
DRAW_FG = 1 << 1,
|
||||||
|
};
|
||||||
|
|
||||||
enum selection_mode {
|
enum selection_mode {
|
||||||
SEL_IDLE = 0,
|
SEL_IDLE = 0,
|
||||||
SEL_EMPTY = 1,
|
SEL_EMPTY = 1,
|
||||||
|
|||||||
2
win.h
2
win.h
@ -25,7 +25,7 @@ enum win_mode {
|
|||||||
|
|
||||||
void xbell(void);
|
void xbell(void);
|
||||||
void xclipcopy(void);
|
void xclipcopy(void);
|
||||||
void xdrawcursor(int, int, Glyph, int, int, Glyph);
|
void xdrawcursor(int, int, Glyph, int, int, Glyph, Line, int);
|
||||||
void xdrawline(Line, int, int, int);
|
void xdrawline(Line, int, int, int);
|
||||||
void xfinishdraw(void);
|
void xfinishdraw(void);
|
||||||
void xloadcols(void);
|
void xloadcols(void);
|
||||||
|
|||||||
133
x.c
133
x.c
@ -142,7 +142,7 @@ typedef struct {
|
|||||||
|
|
||||||
static inline ushort sixd_to_16bit(int);
|
static inline ushort sixd_to_16bit(int);
|
||||||
static int xmakeglyphfontspecs(XftGlyphFontSpec *, const Glyph *, int, int, int);
|
static int xmakeglyphfontspecs(XftGlyphFontSpec *, const Glyph *, int, int, int);
|
||||||
static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int);
|
static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int, int);
|
||||||
static void xdrawglyph(Glyph, int, int);
|
static void xdrawglyph(Glyph, int, int);
|
||||||
static void xclear(int, int, int, int);
|
static void xclear(int, int, int, int);
|
||||||
static int xgeommasktogravity(int);
|
static int xgeommasktogravity(int);
|
||||||
@ -1372,7 +1372,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
|
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y, int dmode)
|
||||||
{
|
{
|
||||||
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
|
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
|
||||||
int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
|
int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
|
||||||
@ -1463,47 +1463,40 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
|||||||
if (base.mode & ATTR_INVISIBLE)
|
if (base.mode & ATTR_INVISIBLE)
|
||||||
fg = bg;
|
fg = bg;
|
||||||
|
|
||||||
/* Intelligent cleaning up of the borders. */
|
if (dmode & DRAW_BG) {
|
||||||
if (x == 0) {
|
/* Intelligent cleaning up of the borders. */
|
||||||
xclear(0, (y == 0)? 0 : winy, borderpx,
|
if (x == 0) {
|
||||||
winy + win.ch +
|
xclear(0, (y == 0)? 0 : winy, borderpx,
|
||||||
((winy + win.ch >= borderpx + win.th)? win.h : 0));
|
winy + win.ch +
|
||||||
}
|
((winy + win.ch >= borderpx + win.th)? win.h : 0));
|
||||||
if (winx + width >= borderpx + win.tw) {
|
}
|
||||||
xclear(winx + width, (y == 0)? 0 : winy, win.w,
|
if (winx + width >= borderpx + win.tw) {
|
||||||
((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
|
xclear(winx + width, (y == 0)? 0 : winy, win.w,
|
||||||
}
|
((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
|
||||||
if (y == 0)
|
}
|
||||||
xclear(winx, 0, winx + width, borderpx);
|
if (y == 0)
|
||||||
if (winy + win.ch >= borderpx + win.th)
|
xclear(winx, 0, winx + width, borderpx);
|
||||||
xclear(winx, winy + win.ch, winx + width, win.h);
|
if (winy + win.ch >= borderpx + win.th)
|
||||||
|
xclear(winx, winy + win.ch, winx + width, win.h);
|
||||||
|
/* Fill the background */
|
||||||
|
XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);
|
||||||
|
}
|
||||||
|
|
||||||
/* Clean up the region we want to draw to. */
|
if (dmode & DRAW_FG) {
|
||||||
XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);
|
/* Render the glyphs. */
|
||||||
|
XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
|
||||||
|
|
||||||
/* Set the clip region because Xft is sometimes dirty. */
|
/* Render underline and strikethrough. */
|
||||||
r.x = 0;
|
if (base.mode & ATTR_UNDERLINE) {
|
||||||
r.y = 0;
|
XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
|
||||||
r.height = win.ch;
|
width, 1);
|
||||||
r.width = width;
|
}
|
||||||
XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
|
|
||||||
|
|
||||||
/* Render the glyphs. */
|
if (base.mode & ATTR_STRUCK) {
|
||||||
XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
|
XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3,
|
||||||
|
width, 1);
|
||||||
/* Render underline and strikethrough. */
|
}
|
||||||
if (base.mode & ATTR_UNDERLINE) {
|
}
|
||||||
XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1,
|
|
||||||
width, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (base.mode & ATTR_STRUCK) {
|
|
||||||
XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent * chscale / 3,
|
|
||||||
width, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset clip to none. */
|
|
||||||
XftDrawSetClip(xw.draw, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1513,18 +1506,21 @@ xdrawglyph(Glyph g, int x, int y)
|
|||||||
XftGlyphFontSpec spec;
|
XftGlyphFontSpec spec;
|
||||||
|
|
||||||
numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y);
|
numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y);
|
||||||
xdrawglyphfontspecs(&spec, g, numspecs, x, y);
|
xdrawglyphfontspecs(&spec, g, numspecs, x, y, DRAW_BG | DRAW_FG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
|
||||||
{
|
{
|
||||||
Color drawcol;
|
Color drawcol;
|
||||||
|
|
||||||
/* remove the old cursor */
|
/* remove the old cursor */
|
||||||
if (selected(ox, oy))
|
if (selected(ox, oy))
|
||||||
og.mode ^= ATTR_REVERSE;
|
og.mode ^= ATTR_REVERSE;
|
||||||
xdrawglyph(og, ox, oy);
|
|
||||||
|
/* Redraw the line where cursor was previously.
|
||||||
|
* It will restore wide glyphs and ligatures broken by the cursor. */
|
||||||
|
xdrawline(line, 0, oy, len);
|
||||||
|
|
||||||
if (IS_SET(MODE_HIDE))
|
if (IS_SET(MODE_HIDE))
|
||||||
return;
|
return;
|
||||||
@ -1648,32 +1644,39 @@ xstartdraw(void)
|
|||||||
void
|
void
|
||||||
xdrawline(Line line, int x1, int y1, int x2)
|
xdrawline(Line line, int x1, int y1, int x2)
|
||||||
{
|
{
|
||||||
int i, x, ox, numspecs;
|
int i, x, ox, numspecs, numspecs_cached;
|
||||||
Glyph base, new;
|
Glyph base, new;
|
||||||
XftGlyphFontSpec *specs = xw.specbuf;
|
XftGlyphFontSpec *specs;
|
||||||
|
|
||||||
numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1);
|
numspecs_cached = xmakeglyphfontspecs(xw.specbuf, &line[x1], x2 - x1, x1, y1);
|
||||||
i = ox = 0;
|
|
||||||
for (x = x1; x < x2 && i < numspecs; x++) {
|
/* Draw line in 2 passes: background and foreground. This way wide glyphs
|
||||||
new = line[x];
|
won't get truncated (#223) */
|
||||||
if (new.mode == ATTR_WDUMMY)
|
for (int dmode = DRAW_BG; dmode <= DRAW_FG; dmode <<= 1) {
|
||||||
continue;
|
specs = xw.specbuf;
|
||||||
if (selected(x, y1))
|
numspecs = numspecs_cached;
|
||||||
new.mode ^= ATTR_REVERSE;
|
i = ox = 0;
|
||||||
if (i > 0 && ATTRCMP(base, new)) {
|
for (x = x1; x < x2 && i < numspecs; x++) {
|
||||||
xdrawglyphfontspecs(specs, base, i, ox, y1);
|
new = line[x];
|
||||||
specs += i;
|
if (new.mode == ATTR_WDUMMY)
|
||||||
numspecs -= i;
|
continue;
|
||||||
i = 0;
|
if (selected(x, y1))
|
||||||
|
new.mode ^= ATTR_REVERSE;
|
||||||
|
if (i > 0 && ATTRCMP(base, new)) {
|
||||||
|
xdrawglyphfontspecs(specs, base, i, ox, y1, dmode);
|
||||||
|
specs += i;
|
||||||
|
numspecs -= i;
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
if (i == 0) {
|
||||||
|
ox = x;
|
||||||
|
base = new;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
if (i == 0) {
|
if (i > 0)
|
||||||
ox = x;
|
xdrawglyphfontspecs(specs, base, i, ox, y1, dmode);
|
||||||
base = new;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
if (i > 0)
|
|
||||||
xdrawglyphfontspecs(specs, base, i, ox, y1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user