aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-08 23:22:24 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-08 23:22:24 +0000
commitab38d9191343c151607808e58dda4826a10fffab (patch)
treef62e3e1f8628152ff348555a3d26d49b0f7656a9 /window.c
parent915031b0495591fcc53a4edbda14a33815218fdd (diff)
downloadrtmux-ab38d9191343c151607808e58dda4826a10fffab.tar.gz
rtmux-ab38d9191343c151607808e58dda4826a10fffab.tar.bz2
rtmux-ab38d9191343c151607808e58dda4826a10fffab.zip
Sync OpenBSD patchset 506:
Change window name change to use a timer event rather than a gettimeofday() check every loop.
Diffstat (limited to 'window.c')
-rw-r--r--window.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/window.c b/window.c
index 7b8a2a3f..1bdbd4b7 100644
--- a/window.c
+++ b/window.c
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.120 2009-11-08 23:02:56 tcunha Exp $ */
+/* $Id: window.c,v 1.121 2009-11-08 23:22:24 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -210,7 +210,7 @@ window_create1(u_int sx, u_int sy)
struct window *w;
u_int i;
- w = xmalloc(sizeof *w);
+ w = xcalloc(1, sizeof *w);
w->name = NULL;
w->flags = 0;
@@ -223,6 +223,8 @@ window_create1(u_int sx, u_int sy)
w->sx = sx;
w->sy = sy;
+ queue_window_name(w);
+
options_init(&w->options, &global_w_options);
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
@@ -276,6 +278,8 @@ window_destroy(struct window *w)
if (w->layout_root != NULL)
layout_free(w);
+ evtimer_del(&w->name_timer);
+
options_free(&w->options);
window_destroy_panes(w);
@@ -478,7 +482,6 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
ARRAY_DECL(, char *) varlist;
struct environ_entry *envent;
const char *ptr;
- struct timeval tv;
struct termios tio2;
u_int i;
@@ -506,12 +509,6 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
ws.ws_col = screen_size_x(&wp->base);
ws.ws_row = screen_size_y(&wp->base);
- if (gettimeofday(&wp->window->name_timer, NULL) != 0)
- fatal("gettimeofday failed");
- tv.tv_sec = 0;
- tv.tv_usec = NAME_INTERVAL * 1000L;
- timeradd(&wp->window->name_timer, &tv, &wp->window->name_timer);
-
switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) {
case -1:
wp->fd = -1;