From 9503f061f972478b6e19f9946dd0eba4f2988405 Mon Sep 17 00:00:00 2001 From: ketmar Date: Tue, 18 Dec 2012 17:12:29 +0200 Subject: [PATCH] more redraws to get rid of some redraw bugs --- src/termswitch.c | 18 +++++++++++++++--- src/x11evtvis.c | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/termswitch.c b/src/termswitch.c index 3fcfd9a..2973099 100644 --- a/src/termswitch.c +++ b/src/termswitch.c @@ -57,11 +57,23 @@ static void switchToTerm (int idx, int redraw) { updateTabBar = 1; XSetWindowBackground(xw.dpy, xw.win, getColor(curterm->defbg)); xclearunused(); - if (redraw) { k8t_drawTerm(curterm, 1); xdrawTabBar(); } + if (redraw) { + k8t_tmFullDirty(curterm); + k8t_drawTerm(curterm, 1); + if (!updateTabBar) updateTabBar = 1; + xdrawTabBar(); + } //FIXME: optimize memory allocations if (curterm->sel.clip != NULL && curterm->sel.bx >= 0) { - if (lastSelStr != NULL) free(lastSelStr); - lastSelStr = strdup(curterm->sel.clip); + if (lastSelStr != NULL) { + if (strlen(lastSelStr) >= strlen(curterm->sel.clip)) { + strcpy(lastSelStr, curterm->sel.clip); + } else { + free(lastSelStr); + lastSelStr = NULL; + } + } + if (lastSelStr == NULL) lastSelStr = strdup(curterm->sel.clip); //fprintf(stderr, "newsel: [%s]\n", lastSelStr); } xfixsel(); diff --git a/src/x11evtvis.c b/src/x11evtvis.c index 6cbcfa0..9594a65 100644 --- a/src/x11evtvis.c +++ b/src/x11evtvis.c @@ -4,6 +4,10 @@ static void xevtcbexpose (XEvent *ev) { if (xw.state&K8T_WIN_REDRAW) { if (!e->count && curterm != NULL) { xw.state &= ~K8T_WIN_REDRAW; + if (!updateTabBar) updateTabBar = 1; + xdrawTabBar(); + k8t_tmFullDirty(curterm); + k8t_drawTerm(curterm, 1); k8t_drawCopy(curterm, 0, 0, curterm->col, curterm->row); if (!updateTabBar) updateTabBar = -1; } -- 2.11.4.GIT