#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg)
#define IS_SET(flag) ((term.mode & (flag)) != 0)
#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + (t1.tv_usec-t2.tv_usec)/1000)
+#define CEIL(x) (((x) != (int) (x)) ? (x) + 1 : (x))
#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
#define IS_TRUECOL(x) (1 << 24 & (x))
static void tsetmode(bool, bool, int *, int);
static void tfulldirt(void);
static void techo(char *, int);
-static ulong tdefcolor(int *, int *, int);
+static long tdefcolor(int *, int *, int);
static inline bool match(uint, uint);
static void ttynew(void);
static void ttyread(void);
tscrollup(term.c.y, n);
}
-ulong
+long
tdefcolor(int *attr, int *npar, int l) {
long idx = -1;
uint r, g, b;
void
tsetattr(int *attr, int l) {
int i;
- ulong idx;
+ long idx;
for(i = 0; i < l; i++) {
switch(attr[i]) {
treset();
term.esc = 0;
xresettitle();
+ xloadcols();
break;
case '=': /* DECPAM -- Application keypad */
term.mode |= MODE_APPKEYPAD;
xloadcols(void) {
int i, r, g, b;
XRenderColor color = { .alpha = 0xffff };
+ static bool loaded;
+ Colour *cp;
+
+ if(loaded) {
+ for (cp = dc.col; cp < dc.col + LEN(dc.col); ++cp)
+ XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);
+ }
/* load colors [0-15] colors and [256-LEN(colorname)[ (config.h) */
for(i = 0; i < LEN(colorname); i++) {
die("Could not allocate color %d\n", i);
}
}
+ loaded = true;
}
int
die("st: can't open font %s\n", fontstr);
/* Setting character width and height. */
- xw.cw = dc.font.width;
- xw.ch = dc.font.height;
+ xw.cw = CEIL(dc.font.width * cwscale);
+ xw.ch = CEIL(dc.font.height * chscale);
FcPatternDel(pattern, FC_SLANT);
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
Colour *fg, *bg, *temp, revfg, revbg, truefg, truebg;
XRenderColor colfg, colbg;
Rectangle r;
+ int oneatatime;
frcflags = FRC_NORMAL;
u8fs = s;
u8fblen = 0;
u8fl = 0;
+ oneatatime = font->width != xw.cw;
for(;;) {
u8c = s;
u8cblen = utf8decode(s, &u8char);
bytelen -= u8cblen;
doesexist = XftCharExists(xw.dpy, font->match, u8char);
- if(!doesexist || bytelen <= 0) {
- if(bytelen <= 0) {
+ if(oneatatime || !doesexist || bytelen <= 0) {
+ if(oneatatime || bytelen <= 0) {
if(doesexist) {
u8fl++;
u8fblen += u8cblen;
winy + font->ascent,
(FcChar8 *)u8fs,
u8fblen);
- xp += font->width * u8fl;
+ xp += xw.cw * u8fl;
}
break;
u8fl++;
u8fblen += u8cblen;
}
- if(doesexist)
+ if(doesexist) {
+ if (oneatatime)
+ continue;
break;
+ }
/* Search the font cache. */
for(i = 0; i < frclen; i++) {
xp, winy + frc[i].font->ascent,
(FcChar8 *)u8c, u8cblen);
- xp += font->width;
+ xp += xw.cw;
}
/*
Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
&prop);
XSetWMName(xw.dpy, xw.win, &prop);
+ XFree(prop.value);
}
void
ttyread();
if(blinktimeout) {
blinkset = tattrset(ATTR_BLINK);
- if(!blinkset && term.mode & ATTR_BLINK)
- term.mode &= ~(MODE_BLINK);
+ if(!blinkset)
+ MODBIT(term.mode, 0, MODE_BLINK);
}
}
xw.fh = (int)hr;
if(bitm & XNegative && xw.fx == 0)
xw.fx = -1;
- if(bitm & XNegative && xw.fy == 0)
+ if(bitm & YNegative && xw.fy == 0)
xw.fy = -1;
if(xw.fh != 0 && xw.fw != 0)