From d96ab3401960ab4a7c9434dfda1ebdc5204873e0 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 15 Jun 2015 10:58:01 +0000 Subject: Add window_activity format, from Thomas Adam based on a diff originally from propos6 at gmail dot com. --- window.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'window.c') diff --git a/window.c b/window.c index a1d6792b..4639944e 100644 --- a/window.c +++ b/window.c @@ -295,6 +295,9 @@ window_create1(u_int sx, u_int sy) w->sx = sx; w->sy = sy; + if (gettimeofday(&w->activity_time, NULL) != 0) + fatal("gettimeofday failed"); + options_init(&w->options, &global_w_options); if (options_get_number(&w->options, "automatic-rename")) queue_window_name(w); -- cgit From 0ff335961eec019d776f19bd8c26cce7cde0effa Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 17 Jun 2015 16:50:28 +0000 Subject: Move the shuffle code from new-window -a into a function and add a -a flag for move-window too. From Thomas Adam. --- window.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'window.c') diff --git a/window.c b/window.c index 4639944e..82c10606 100644 --- a/window.c +++ b/window.c @@ -1378,3 +1378,28 @@ winlink_clear_flags(struct winlink *wl) } } } + +int +winlink_shuffle_up(struct session *s, struct winlink *wl) +{ + int idx, last; + + idx = wl->idx + 1; + + /* Find the next free index. */ + for (last = idx; last < INT_MAX; last++) { + if (winlink_find_by_index(&s->windows, last) == NULL) + break; + } + if (last == INT_MAX) + return (-1); + + /* Move everything from last - 1 to idx up a bit. */ + for (; last > idx; last--) { + wl = winlink_find_by_index(&s->windows, last - 1); + server_link_window(s, wl, s, last, 0, 0, NULL); + server_unlink_window(s, wl); + } + + return (idx); +} -- cgit