Merge branch 'obsd-master'

Sync from OpenBSD.
pull/1/head
Thomas Adam 2013-04-23 08:26:04 +01:00
commit cd60e57b6a
8 changed files with 31 additions and 18 deletions

View File

@ -78,8 +78,8 @@ client_get_lock(char *lockfile)
if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1)
fatal("open failed");
if (flock(lockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
while (flock(lockfd, LOCK_EX) == -1 && errno == EINTR)
if (lockf(lockfd, F_TLOCK, 0) == -1 && errno == EAGAIN) {
while (lockf(lockfd, F_LOCK, 0) == -1 && errno == EINTR)
/* nothing */;
close(lockfd);
return (-1);

View File

@ -89,10 +89,7 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR);
}
if ((s = c->session) == NULL)
return (CMD_RETURN_ERROR);
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), NULL)) == NULL)
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL)
return (CMD_RETURN_ERROR);
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
@ -231,9 +228,12 @@ windows_only:
free(final_win_template_last);
window_choose_ready(wl->window->active, cur_win, NULL);
window_choose_collapse_all(wl->window->active);
if (args_has(args, 'u'))
if (args_has(args, 'u')) {
window_choose_expand_all(wl->window->active);
window_choose_set_current(wl->window->active, cur_win);
}
return (CMD_RETURN_NORMAL);
}

View File

@ -288,7 +288,7 @@ format_session(struct format_tree *ft, struct session *s)
format_add(ft, "session_group", "%u", session_group_index(sg));
t = s->creation_time.tv_sec;
format_add(ft, "session_created", "%ld", (long) t);
format_add(ft, "session_created", "%lld", (long long) t);
tim = ctime(&t);
*strchr(tim, '\n') = '\0';
format_add(ft, "session_created_string", "%s", tim);
@ -314,13 +314,13 @@ format_client(struct format_tree *ft, struct client *c)
format_add(ft, "client_termname", "%s", c->tty.termname);
t = c->creation_time.tv_sec;
format_add(ft, "client_created", "%ld", (long) t);
format_add(ft, "client_created", "%lld", (long long) t);
tim = ctime(&t);
*strchr(tim, '\n') = '\0';
format_add(ft, "client_created_string", "%s", tim);
t = c->activity_time.tv_sec;
format_add(ft, "client_activity", "%ld", (long) t);
format_add(ft, "client_activity", "%lld", (long long) t);
tim = ctime(&t);
*strchr(tim, '\n') = '\0';
format_add(ft, "client_activity_string", "%s", tim);

4
job.c
View File

@ -143,8 +143,8 @@ job_write_callback(unused struct bufferevent *bufev, void *data)
struct job *job = data;
size_t len = EVBUFFER_LENGTH(EVBUFFER_OUTPUT(job->event));
log_debug("job write %p: %s, pid %ld, output left %lu", job, job->cmd,
(long) job->pid, (unsigned long) len);
log_debug("job write %p: %s, pid %ld, output left %zu", job, job->cmd,
(long) job->pid, len);
if (len == 0) {
shutdown(job->fd, SHUT_WR);

View File

@ -514,8 +514,10 @@ server_client_loop(void)
w->flags &= ~WINDOW_REDRAW;
TAILQ_FOREACH(wp, &w->panes, entry) {
server_client_check_focus(wp);
server_client_check_resize(wp);
if (wp->fd != -1) {
server_client_check_focus(wp);
server_client_check_resize(wp);
}
wp->flags &= ~PANE_REDRAW;
}
}
@ -527,7 +529,7 @@ server_client_check_resize(struct window_pane *wp)
{
struct winsize ws;
if (wp->fd == -1 || !(wp->flags & PANE_RESIZE))
if (!(wp->flags & PANE_RESIZE))
return;
memset(&ws, 0, sizeof ws);

View File

@ -283,6 +283,7 @@ server_kill_window(struct window *w)
if (options_get_number(&s->options, "renumber-windows"))
session_renumber_windows(s);
}
recalculate_sizes();
}
int

2
tmux.h
View File

@ -2253,6 +2253,8 @@ struct window_choose_data *window_choose_add_item(struct window_pane *,
struct client *, struct winlink *, const char *,
const char *, u_int);
void window_choose_expand_all(struct window_pane *);
void window_choose_collapse_all(struct window_pane *);
void window_choose_set_current(struct window_pane *, u_int);
/* names.c */
void queue_window_name(struct window *);

View File

@ -44,7 +44,6 @@ void window_choose_scroll_down(struct window_pane *);
void window_choose_collapse(struct window_pane *, struct session *);
void window_choose_expand(struct window_pane *, struct session *, u_int);
void window_choose_collapse_all(struct window_pane *);
enum window_choose_input_type {
WINDOW_CHOOSE_NORMAL = -1,
@ -102,8 +101,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
}
void
window_choose_ready(struct window_pane *wp, u_int cur,
void (*callbackfn)(struct window_choose_data *))
window_choose_set_current(struct window_pane *wp, u_int cur)
{
struct window_choose_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
@ -112,12 +110,22 @@ window_choose_ready(struct window_pane *wp, u_int cur,
if (data->selected > screen_size_y(s) - 1)
data->top = ARRAY_LENGTH(&data->list) - screen_size_y(s);
window_choose_redraw_screen(wp);
}
void
window_choose_ready(struct window_pane *wp, u_int cur,
void (*callbackfn)(struct window_choose_data *))
{
struct window_choose_mode_data *data = wp->modedata;
data->callbackfn = callbackfn;
if (data->callbackfn == NULL)
data->callbackfn = window_choose_default_callback;
ARRAY_CONCAT(&data->old_list, &data->list);
window_choose_set_current(wp, cur);
window_choose_collapse_all(wp);
}