From d9b313332186b0c99ec6a9b7585db8188bb35cfc Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 28 Aug 2015 17:11:12 +0000 Subject: [PATCH] Only set default title to hostname on screens that are being used for a window pane, no point in calling gethostname() for temporary screens. --- screen.c | 8 +------- window.c | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/screen.c b/screen.c index 1b841eed..f487cc67 100644 --- a/screen.c +++ b/screen.c @@ -31,14 +31,8 @@ void screen_resize_y(struct screen *, u_int); void screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit) { - char host[HOST_NAME_MAX+1]; - s->grid = grid_create(sx, sy, hlimit); - - if (gethostname(host, sizeof(host)) == 0) - s->title = xstrdup(host); - else - s->title = xstrdup(""); + s->title = xstrdup(""); s->cstyle = 0; s->ccolour = xstrdup(""); diff --git a/window.c b/window.c index 77c7a633..ff3ccfb8 100644 --- a/window.c +++ b/window.c @@ -704,6 +704,7 @@ struct window_pane * window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit) { struct window_pane *wp; + char host[HOST_NAME_MAX + 1]; wp = xcalloc(1, sizeof *wp); wp->window = w; @@ -740,6 +741,9 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit) screen_init(&wp->base, sx, sy, hlimit); wp->screen = &wp->base; + if (gethostname(host, sizeof host) == 0) + screen_set_title(&wp->base, host); + input_init(wp); return (wp);