X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=x.c;h=df2a88c6e53c9a624e920513cb30343614c1529d;hb=3e44ee5569a81ba6f06e1ecd19bf0ceb1e97f18d;hp=b7339e93f209ebbf31c3a17a0ea0e0ae5803d6e1;hpb=f2bfd513b14a2aa27796670235557a550b4189db;p=st.git diff --git a/x.c b/x.c index b7339e9..df2a88c 100644 --- a/x.c +++ b/x.c @@ -89,6 +89,7 @@ static void xdrawcursor(void); static int xgeommasktogravity(int); static int xloadfont(Font *, FcPattern *); static void xunloadfont(Font *); +static void xsetenv(void); static void expose(XEvent *); static void visibility(XEvent *); @@ -1092,6 +1093,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x frc[frclen].font = XftFontOpenPattern(xw.dpy, fontpattern); + if (!frc[frclen].font) + die("XftFontOpenPattern failed seeking fallback font: %s\n", + strerror(errno)); frc[frclen].flags = frcflags; frc[frclen].unicodep = rune; @@ -1186,20 +1190,22 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i } } - if (base.mode & ATTR_REVERSE) { - temp = fg; - fg = bg; - bg = temp; - } - if ((base.mode & ATTR_BOLD_FAINT) == ATTR_FAINT) { colfg.red = fg->color.red / 2; colfg.green = fg->color.green / 2; colfg.blue = fg->color.blue / 2; + colfg.alpha = fg->color.alpha; XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg, &revfg); fg = &revfg; } + + if (base.mode & ATTR_REVERSE) { + temp = fg; + fg = bg; + bg = temp; + } + if (base.mode & ATTR_BLINK && term.mode & MODE_BLINK) fg = bg; @@ -1266,7 +1272,6 @@ xdrawcursor(void) Glyph g = {' ', ATTR_NULL, defaultbg, defaultcs}, og; int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN); Color drawcol; - unsigned attr; LIMIT(oldx, 0, term.col-1); LIMIT(oldy, 0, term.row-1); @@ -1286,8 +1291,8 @@ xdrawcursor(void) xdrawglyph(og, oldx, oldy); g.u = term.line[term.c.y][term.c.x].u; - attr = ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK; - g.mode |= term.line[term.c.y][term.c.x].mode & attr; + g.mode |= term.line[term.c.y][term.c.x].mode & + (ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK); /* * Select the right color for the right mode. @@ -1483,12 +1488,6 @@ xbell(int vol) XkbBell(xw.dpy, xw.win, vol, (Atom)NULL); } -unsigned long -xwinid(void) -{ - return xw.win; -} - void focus(XEvent *ev) { @@ -1761,6 +1760,7 @@ run: XSetLocaleModifiers(""); tnew(MAX(cols, 1), MAX(rows, 1)); xinit(); + xsetenv(); selinit(); run();