Change scroll/pane redraws to only redraw the single pane affected rather than

the entire window.
This commit is contained in:
Nicholas Marriott 2009-04-02 21:08:15 +00:00
parent 84cde92c8f
commit dbf52facd2
5 changed files with 51 additions and 21 deletions

View File

@ -1,12 +1,12 @@
02 April 2009 02 April 2009
* Change scroll/pane redraws to only redraw the single pane affected rather
than the entire window.
* If redrawing the region would mean redrawing > half the pane, just schedule * If redrawing the region would mean redrawing > half the pane, just schedule
to redraw the entire window. Also add a flag to skip updating the window any to redraw the entire window. Also add a flag to skip updating the window any
further if it is scheduled to be redrawn. This has the effect of batching further if it is scheduled to be redrawn. This has the effect of batching
multiple redraws together. multiple redraws together.
Redraws should be moved to the pane level later.
01 April 2009 01 April 2009
* Basic horizontal splitting and layout management. Still some redraw and other * Basic horizontal splitting and layout management. Still some redraw and other
@ -1194,7 +1194,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other (including mutt, emacs). No status bar yet and no key remapping or other
customisation. customisation.
$Id: CHANGES,v 1.269 2009-04-02 20:30:17 nicm Exp $ $Id: CHANGES,v 1.270 2009-04-02 21:08:13 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms

View File

@ -1,4 +1,4 @@
/* $Id: screen-redraw.c,v 1.33 2009-04-01 21:09:01 nicm Exp $ */ /* $Id: screen-redraw.c,v 1.34 2009-04-02 21:08:13 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -123,14 +123,24 @@ screen_redraw_screen(struct client *c)
} }
/* Draw the pane. */ /* Draw the pane. */
for (i = 0; i < sy; i++) screen_redraw_pane(c, wp);
tty_draw_line(tty, s, i, wp->xoff, wp->yoff);
} }
/* Draw the status line. */ /* Draw the status line. */
screen_redraw_status(c); screen_redraw_status(c);
} }
/* Draw a single pane. */
void
screen_redraw_pane(struct client *c, struct window_pane *wp)
{
u_int i;
for (i = 0; i < wp->sy; i++)
tty_draw_line(&c->tty, wp->screen, i, wp->xoff, wp->yoff);
}
/* Draw the status line. */ /* Draw the status line. */
void void
screen_redraw_status(struct client *c) screen_redraw_status(struct client *c)

View File

@ -1,4 +1,4 @@
/* $Id: server.c,v 1.135 2009-04-02 20:30:20 nicm Exp $ */ /* $Id: server.c,v 1.136 2009-04-02 21:08:13 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -480,9 +480,10 @@ server_handle_windows(struct pollfd **pfd)
void void
server_check_redraw(struct client *c) server_check_redraw(struct client *c)
{ {
struct session *s; struct session *s;
char title[512]; struct window_pane *wp;
int flags, redraw; char title[512];
int flags, redraw;
if (c == NULL || c->session == NULL) if (c == NULL || c->session == NULL)
return; return;
@ -520,6 +521,11 @@ server_check_redraw(struct client *c)
else else
screen_redraw_screen(c); screen_redraw_screen(c);
c->flags &= ~CLIENT_STATUS; c->flags &= ~CLIENT_STATUS;
} else {
TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) {
if (wp->flags & PANE_REDRAW)
screen_redraw_pane(c, wp);
}
} }
if (c->flags & CLIENT_STATUS) if (c->flags & CLIENT_STATUS)
@ -602,8 +608,10 @@ server_check_timers(struct client *c)
void void
server_fill_clients(struct pollfd **pfd) server_fill_clients(struct pollfd **pfd)
{ {
struct client *c; struct client *c;
u_int i; struct window *w;
struct window_pane *wp;
u_int i;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i); c = ARRAY_ITEM(&clients, i);
@ -632,6 +640,20 @@ server_fill_clients(struct pollfd **pfd)
} }
(*pfd)++; (*pfd)++;
} }
/*
* Clear any window redraw flags (will have been redrawn as part of *
* client).
*/
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
w = ARRAY_ITEM(&windows, i);
if (w == NULL)
continue;
w->flags &= ~WINDOW_REDRAW;
TAILQ_FOREACH(wp, &w->panes, entry)
wp->flags &= ~PANE_REDRAW;
}
} }
/* Handle client pollfds. */ /* Handle client pollfds. */
@ -921,8 +943,6 @@ server_check_window(struct window *w)
wp = wq; wp = wq;
} }
w->flags &= ~WINDOW_REDRAW; /* redrawn as part of client */
if (!destroyed) if (!destroyed)
return; return;

4
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.296 2009-04-02 20:30:20 nicm Exp $ */ /* $Id: tmux.h,v 1.297 2009-04-02 21:08:14 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -656,6 +656,7 @@ struct window_pane {
int flags; int flags;
#define PANE_HIDDEN 0x1 #define PANE_HIDDEN 0x1
#define PANE_RESTART 0x2 #define PANE_RESTART 0x2
#define PANE_REDRAW 0x4
char *cmd; char *cmd;
char *cwd; char *cwd;
@ -1466,6 +1467,7 @@ void screen_write_cell(
/* screen-redraw.c */ /* screen-redraw.c */
void screen_redraw_screen(struct client *); void screen_redraw_screen(struct client *);
void screen_redraw_pane(struct client *, struct window_pane *);
void screen_redraw_status(struct client *); void screen_redraw_status(struct client *);
/* screen.c */ /* screen.c */

6
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.91 2009-04-02 20:30:23 nicm Exp $ */ /* $Id: tty.c,v 1.92 2009-04-02 21:08:15 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -395,11 +395,9 @@ tty_redraw_region(struct tty *tty, struct window_pane *wp)
* most cases, this is likely to be followed by some more scrolling - * most cases, this is likely to be followed by some more scrolling -
* without this, the entire pane ends up being redrawn many times which * without this, the entire pane ends up being redrawn many times which
* can be much more data. * can be much more data.
*
* XXX Should just schedule to redraw this pane...
*/ */
if (s->old_rupper - s->old_rlower >= screen_size_y(s) / 2) { if (s->old_rupper - s->old_rlower >= screen_size_y(s) / 2) {
server_redraw_window(wp->window); wp->flags |= PANE_REDRAW;
return; return;
} }