From 620402a833a4e42590a26390d2b7a39fd39e3ea9 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 19 Aug 2009 09:00:06 +0000 Subject: [PATCH] This is a better fix for OS X stupidity. --- buffer-poll.c | 5 ++--- client.c | 4 +--- compat.h | 4 +++- input.c | 12 ++++++------ names.c | 7 ++++--- server.c | 11 ++++------- tmux.h | 3 ++- tty.c | 4 +--- 8 files changed, 23 insertions(+), 27 deletions(-) diff --git a/buffer-poll.c b/buffer-poll.c index 566f2a01..cafddff7 100644 --- a/buffer-poll.c +++ b/buffer-poll.c @@ -1,4 +1,4 @@ -/* $Id: buffer-poll.c,v 1.14 2009-06-25 16:22:36 nicm Exp $ */ +/* $Id: buffer-poll.c,v 1.15 2009-08-19 09:00:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -29,10 +29,9 @@ buffer_poll(struct pollfd *pfd, struct buffer *in, struct buffer *out) { ssize_t n; -#ifdef HAVE_POLL if (pfd->revents & (POLLERR|POLLNVAL|POLLHUP)) return (-1); -#endif + if (pfd->revents & POLLIN) { buffer_ensure(in, BUFSIZ); n = read(pfd->fd, BUFFER_IN(in), BUFFER_FREE(in)); diff --git a/client.c b/client.c index 48cf35bf..f738873d 100644 --- a/client.c +++ b/client.c @@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.65 2009-08-19 08:36:45 nicm Exp $ */ +/* $Id: client.c,v 1.66 2009-08-19 09:00:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -190,10 +190,8 @@ client_main(struct client_ctx *cctx) if (nfds == 0) continue; -#ifdef HAVE_POLL if (pfd.revents & (POLLERR|POLLHUP|POLLNVAL)) fatalx("socket error"); -#endif if (pfd.revents & POLLIN) { if (client_msg_dispatch(cctx) != 0) diff --git a/compat.h b/compat.h index b04386f6..7f914b89 100644 --- a/compat.h +++ b/compat.h @@ -1,4 +1,4 @@ -/* $Id: compat.h,v 1.10 2009-08-16 16:15:53 nicm Exp $ */ +/* $Id: compat.h,v 1.11 2009-08-19 09:00:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -45,6 +45,8 @@ #ifdef HAVE_POLL #include #else +#define POLLNVAL 0 +#define POLLHUP 0 #include "compat/bsd-poll.h" #endif diff --git a/input.c b/input.c index fcb42667..0fb7f552 100644 --- a/input.c +++ b/input.c @@ -1,4 +1,4 @@ -/* $Id: input.c,v 1.90 2009-08-09 17:32:06 tcunha Exp $ */ +/* $OpenBSD: input.c,v 1.13 2009/08/18 21:41:13 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -235,6 +235,8 @@ input_init(struct window_pane *wp) ictx->saved_cy = 0; input_state(ictx, input_state_first); + + ictx->was = 0; } void @@ -252,8 +254,9 @@ input_parse(struct window_pane *wp) struct input_ctx *ictx = &wp->ictx; u_char ch; - if (BUFFER_USED(wp->in) == 0) + if (BUFFER_USED(wp->in) == ictx->was) return; + wp->window->flags |= WINDOW_ACTIVITY; ictx->buf = BUFFER_OUT(wp->in); ictx->len = BUFFER_USED(wp->in); @@ -261,15 +264,11 @@ input_parse(struct window_pane *wp) ictx->wp = wp; - log_debug2("entry; buffer=%zu", ictx->len); - if (wp->mode == NULL) screen_write_start(&ictx->ctx, wp, &wp->base); else screen_write_start(&ictx->ctx, NULL, &wp->base); - if (ictx->off != ictx->len) - wp->window->flags |= WINDOW_ACTIVITY; while (ictx->off < ictx->len) { ch = ictx->buf[ictx->off++]; ictx->state(ch, ictx); @@ -278,6 +277,7 @@ input_parse(struct window_pane *wp) screen_write_stop(&ictx->ctx); buffer_remove(wp->in, ictx->len); + ictx->was = BUFFER_USED(wp->in); } void diff --git a/names.c b/names.c index 744013a9..e7c95f14 100644 --- a/names.c +++ b/names.c @@ -1,4 +1,4 @@ -/* $Id: names.c,v 1.11 2009-07-02 18:26:55 nicm Exp $ */ +/* $OpenBSD: names.c,v 1.5 2009/08/18 21:18:20 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -42,8 +42,6 @@ set_window_names(void) w = ARRAY_ITEM(&windows, i); if (w == NULL || w->active == NULL) continue; - if (!options_get_number(&w->options, "automatic-rename")) - continue; if (timercmp(&tv, &w->name_timer, <)) continue; @@ -52,6 +50,9 @@ set_window_names(void) tv2.tv_usec = NAME_INTERVAL * 1000L; timeradd(&w->name_timer, &tv2, &w->name_timer); + if (!options_get_number(&w->options, "automatic-rename")) + continue; + if (w->active->screen != &w->active->base) name = NULL; else diff --git a/server.c b/server.c index 436d55bb..7eb43875 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.170 2009-08-16 19:33:49 tcunha Exp $ */ +/* $OpenBSD: server.c,v 1.23 2009/08/18 21:37:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -319,10 +319,8 @@ server_main(int srv_fd) pfd = pfds; /* Handle server socket. */ -#ifdef HAVE_POLL if (pfd->revents & (POLLERR|POLLNVAL|POLLHUP)) fatalx("lost server socket"); -#endif if (pfd->revents & POLLIN) { server_accept_client(srv_fd); continue; @@ -1111,13 +1109,12 @@ void server_check_window(struct window *w) { struct window_pane *wp, *wq; + struct options *oo = &w->options; struct client *c; struct session *s; struct winlink *wl; u_int i, j; - int destroyed, flag; - - flag = options_get_number(&w->options, "remain-on-exit"); + int destroyed; destroyed = 1; @@ -1130,7 +1127,7 @@ server_check_window(struct window *w) * the window to be destroyed (or it'll close when the last * pane dies). */ - if (wp->fd == -1 && !flag) { + if (wp->fd == -1 && !options_get_number(oo, "remain-on-exit")) { layout_close_pane(wp); window_remove_pane(w, wp); server_redraw_window(w); diff --git a/tmux.h b/tmux.h index e5c1d860..db789cc9 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.418 2009-08-16 19:26:49 tcunha Exp $ */ +/* $OpenBSD: tmux.h,v 1.86 2009/08/18 21:41:13 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -610,6 +610,7 @@ struct input_ctx { u_char *buf; size_t len; size_t off; + size_t was; struct grid_cell cell; diff --git a/tty.c b/tty.c index 2047fbe1..ef47391c 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.128 2009-08-16 19:31:37 tcunha Exp $ */ +/* $Id: tty.c,v 1.129 2009-08-19 09:00:06 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -252,10 +252,8 @@ tty_detect_utf8(struct tty *tty) } if (nfds == 0) break; -#ifdef HAVE_POLL if (pfd.revents & (POLLERR|POLLNVAL|POLLHUP)) break; -#endif if (!(pfd.revents & POLLIN)) continue;