Removing the xclearborders() hack. St now cleans up the parts of the border,

if something needs to be drawn close to it.
master
Christoph Lohmann 12 years ago
parent 4eddf19fdc
commit 0cc7ee5e73

39
st.c

@ -224,7 +224,9 @@ typedef struct {
int mode; int mode;
int bx, by; int bx, by;
int ex, ey; int ex, ey;
struct {int x, y;} b, e; struct {
int x, y;
} b, e;
char *clip; char *clip;
Atom xtarget; Atom xtarget;
bool alt; bool alt;
@ -1031,7 +1033,8 @@ treset(void) {
memset(term.tabs, 0, term.col * sizeof(*term.tabs)); memset(term.tabs, 0, term.col * sizeof(*term.tabs));
for(i = TAB; i < term.col; i += TAB) for(i = TAB; i < term.col; i += TAB)
term.tabs[i] = 1; term.tabs[i] = 1;
term.top = 0, term.bot = term.row - 1; term.top = 0;
term.bot = term.row - 1;
term.mode = MODE_WRAP; term.mode = MODE_WRAP;
tclearregion(0, 0, term.col-1, term.row-1); tclearregion(0, 0, term.col-1, term.row-1);
@ -1040,7 +1043,8 @@ treset(void) {
void void
tnew(int col, int row) { tnew(int col, int row) {
/* set screen size */ /* set screen size */
term.row = row, term.col = col; term.row = row;
term.col = col;
term.line = xmalloc(term.row * sizeof(Line)); term.line = xmalloc(term.row * sizeof(Line));
term.alt = xmalloc(term.row * sizeof(Line)); term.alt = xmalloc(term.row * sizeof(Line));
term.dirty = xmalloc(term.row * sizeof(*term.dirty)); term.dirty = xmalloc(term.row * sizeof(*term.dirty));
@ -1909,7 +1913,6 @@ tputc(char *c, int len) {
case 'c': /* RIS -- Reset to inital state */ case 'c': /* RIS -- Reset to inital state */
treset(); treset();
term.esc = 0; term.esc = 0;
xclearborders();
xresettitle(); xresettitle();
break; break;
case '=': /* DECPAM -- Application keypad */ case '=': /* DECPAM -- Application keypad */
@ -2090,18 +2093,6 @@ xclear(int x1, int y1, int x2, int y2) {
x1, y1, x2-x1, y2-y1); x1, y1, x2-x1, y2-y1);
} }
void
xclearborders(void) {
/* top and left border */
xclear(0, 0, BORDER, xw.h);
xclear(0, 0, xw.w, BORDER);
/* lower and right border */
xclear(BORDER, xw.th - 1, xw.w, xw.h);
/* Will just draw what hasn't been drawn by the previous call. */
xclear(xw.tw - 1, BORDER, xw.w, xw.h - xw.th - 2);
}
void void
xhints(void) { xhints(void) {
XClassHint class = {opt_class ? opt_class : TNAME, TNAME}; XClassHint class = {opt_class ? opt_class : TNAME, TNAME};
@ -2328,6 +2319,20 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
&extents); &extents);
width = extents.xOff; width = extents.xOff;
/* Intelligent cleaning up of the borders. */
if(x == 0) {
xclear(0, (y == 0)? 0 : winy, BORDER,
winy + xw.ch + (y == term.row-1)? xw.h : 0);
}
if(x + charlen >= term.col-1) {
xclear(winx + width, (y == 0)? 0 : winy, xw.w,
winy + xw.ch + (y == term.row-1)? xw.h : 0);
}
if(y == 0)
xclear(winx, 0, winx + width, BORDER);
if(y == term.row-1)
xclear(winx, winy + xw.ch, winx + width, xw.h);
XftDrawRect(xw.xft_draw, bg, winx, winy, width, xw.ch); XftDrawRect(xw.xft_draw, bg, winx, winy, width, xw.ch);
XftDrawStringUtf8(xw.xft_draw, fg, font->xft_set, winx, XftDrawStringUtf8(xw.xft_draw, fg, font->xft_set, winx,
winy + font->ascent, (FcChar8 *)s, bytelen); winy + font->ascent, (FcChar8 *)s, bytelen);
@ -2382,7 +2387,6 @@ void
redraw(void) { redraw(void) {
struct timespec tv = {0, REDRAW_TIMEOUT * 1000}; struct timespec tv = {0, REDRAW_TIMEOUT * 1000};
xclearborders();
tfulldirt(); tfulldirt();
draw(); draw();
XSync(xw.dpy, False); /* necessary for a good tput flash */ XSync(xw.dpy, False); /* necessary for a good tput flash */
@ -2598,7 +2602,6 @@ resize(XEvent *e) {
tresize(col, row); tresize(col, row);
xresize(col, row); xresize(col, row);
xclearborders();
ttyresize(); ttyresize();
} }

Loading…
Cancel
Save