From 958069575dc663595d37a37a8273db73a4e99aa1 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 7 Jun 2008 07:13:08 +0000 Subject: [PATCH] Clear clients with flag too. --- resize.c | 12 +++++++++--- server-fn.c | 41 +---------------------------------------- server.c | 13 +++++++++++-- tmux.h | 6 ++---- 4 files changed, 23 insertions(+), 49 deletions(-) diff --git a/resize.c b/resize.c index 733156db..22011d2b 100644 --- a/resize.c +++ b/resize.c @@ -1,4 +1,4 @@ -/* $Id: resize.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */ +/* $Id: resize.c,v 1.13 2008-06-07 07:13:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -121,8 +121,14 @@ recalculate_sizes(void) log_debug("window size %u,%u (was %u,%u)", ssx, ssy, screen_size_x(&w->base), screen_size_y(&w->base)); - server_clear_window(w); window_resize(w, ssx, ssy); - server_redraw_window(w); + + for (i = 0; i < ARRAY_LENGTH(&clients); i++) { + c = ARRAY_ITEM(&clients, i); + if (c == NULL || c->session == NULL) + continue; + if (c->session->curw->window == w) + c->flags |= (CLIENT_CLEAR|CLIENT_REDRAW); + } } } diff --git a/server-fn.c b/server-fn.c index 46e9a7c9..4df9aee5 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.39 2008-06-07 06:47:38 nicm Exp $ */ +/* $Id: server-fn.c,v 1.40 2008-06-07 07:13:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -71,19 +71,6 @@ server_write_window( } } -void -server_clear_client(struct client *c) -{ - struct screen_redraw_ctx ctx; - - screen_redraw_start_client(&ctx, c); - screen_redraw_set_attributes(&ctx, SCREEN_DEFATTR, SCREEN_DEFCOLR); - screen_redraw_clear_screen(&ctx); - screen_redraw_stop(&ctx); - - status_write_client(c); -} - void server_redraw_client(struct client *c) { @@ -96,19 +83,6 @@ server_status_client(struct client *c) c->flags |= CLIENT_STATUS; } -void -server_clear_session(struct session *s) -{ - struct screen_redraw_ctx ctx; - - screen_redraw_start_session(&ctx, s); - screen_redraw_set_attributes(&ctx, SCREEN_DEFATTR, SCREEN_DEFCOLR); - screen_redraw_clear_screen(&ctx); - screen_redraw_stop(&ctx); - - status_write_session(s); -} - void server_redraw_session(struct session *s) { @@ -139,19 +113,6 @@ server_status_session(struct session *s) } } -void -server_clear_window(struct window *w) -{ - struct screen_redraw_ctx ctx; - - screen_redraw_start_window(&ctx, w); - screen_redraw_set_attributes(&ctx, SCREEN_DEFATTR, SCREEN_DEFCOLR); - screen_redraw_clear_screen(&ctx); - screen_redraw_stop(&ctx); - - status_write_window(w); -} - void server_redraw_window(struct window *w) { diff --git a/server.c b/server.c index e2a4db74..12f12d53 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.57 2008-06-07 06:47:38 nicm Exp $ */ +/* $Id: server.c,v 1.58 2008-06-07 07:13:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -275,9 +275,18 @@ void server_check_redraw(struct client *c) { struct screen_redraw_ctx ctx; + struct screen screen; if (c == NULL || c->session == NULL) return; + + if (c->flags & CLIENT_CLEAR) { + screen_create(&screen, c->sx, c->sy - 1, 0); + screen_redraw_start(&ctx, &screen, tty_write_client, c); + screen_redraw_clear_screen(&ctx); + screen_redraw_stop(&ctx); + screen_destroy(&screen); + } if (c->flags & CLIENT_REDRAW) { screen_redraw_start_client(&ctx, c); @@ -287,7 +296,7 @@ server_check_redraw(struct client *c) } else if (c->flags & CLIENT_STATUS) status_write_client(c); - c->flags &= ~(CLIENT_REDRAW|CLIENT_STATUS); + c->flags &= ~(CLIENT_CLEAR|CLIENT_REDRAW|CLIENT_STATUS); } /* Check for status line redraw on client. */ diff --git a/tmux.h b/tmux.h index 58d17a9d..b4d285db 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.137 2008-06-07 06:47:38 nicm Exp $ */ +/* $Id: tmux.h,v 1.138 2008-06-07 07:13:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -651,6 +651,7 @@ struct client { #define CLIENT_MOUSE 0x4 #define CLIENT_REDRAW 0x8 #define CLIENT_STATUS 0x10 +#define CLIENT_CLEAR 0x20 int flags; struct session *session; @@ -908,13 +909,10 @@ void server_write_session( struct session *, enum hdrtype, const void *, size_t); void server_write_window( struct window *, enum hdrtype, const void *, size_t); -void server_clear_client(struct client *); void server_redraw_client(struct client *); void server_status_client(struct client *); -void server_clear_session(struct session *); void server_redraw_session(struct session *); void server_status_session(struct session *); -void server_clear_window(struct window *); void server_redraw_window(struct window *); void server_status_window(struct window *); void printflike2 server_write_message(struct client *, const char *, ...);