diff --git a/GNUmakefile b/GNUmakefile index 533350b4..4cad2d5a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,4 +1,4 @@ -# $Id: GNUmakefile,v 1.16 2008-06-05 21:25:00 nicm Exp $ +# $Id: GNUmakefile,v 1.17 2008-06-06 17:20:15 nicm Exp $ .PHONY: clean @@ -63,7 +63,7 @@ SRCS+= compat/strlcpy.c compat/strlcat.c compat/strtonum.c CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \ -DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM -DNO_SETPROCTITLE \ -DNO_QUEUE_H -DNO_TREE_H -DUSE_PTY_H -LDFLAGS+= -lresolv -lutil +LDFLAGS+= -lrt -lutil # Required for LLONG_MAX and friends CFLAGS+= -std=c99 endif diff --git a/cmd-link-window.c b/cmd-link-window.c index 54ea5dc3..ac947054 100644 --- a/cmd-link-window.c +++ b/cmd-link-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-link-window.c,v 1.20 2008-06-05 22:59:38 nicm Exp $ */ +/* $Id: cmd-link-window.c,v 1.21 2008-06-06 17:20:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -66,6 +66,7 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx) return; } + wl_dst = NULL; if (idx != -1) wl_dst = winlink_find_by_index(&s->windows, idx); if (wl_dst != NULL) { diff --git a/input-keys.c b/input-keys.c index c24eed94..51920578 100644 --- a/input-keys.c +++ b/input-keys.c @@ -1,4 +1,4 @@ -/* $Id: input-keys.c,v 1.6 2008-01-03 21:32:11 nicm Exp $ */ +/* $Id: input-keys.c,v 1.7 2008-06-06 17:20:29 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -28,6 +28,8 @@ struct { int key; const char *data; } input_keys[] = { +/* { KEYC_BACKSPACE, "\010" }, */ + { KEYC_DC, "\e[3~" }, { KEYC_F1, "\eOP" }, { KEYC_F10, "\e[21~" }, @@ -108,12 +110,14 @@ input_key(struct window *w, int key) #endif for (i = 0; i < NINPUTKEYS; i++) { - if (input_keys[i].key == key) { - log_debug2( - "found key %d: \"%s\"", key, input_keys[i].data); - buffer_write(w->out, - input_keys[i].data, strlen(input_keys[i].data)); - return; - } + if (input_keys[i].key == key) + break; } + if (i == NINPUTKEYS) { + log_debug2("key %d missing", key); + return; + } + + log_debug2("found key %d: \"%s\"", key, input_keys[i].data); + buffer_write(w->out, input_keys[i].data, strlen(input_keys[i].data)); } diff --git a/server.c b/server.c index 688a89f4..cda95dde 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.53 2008-06-04 17:54:26 nicm Exp $ */ +/* $Id: server.c,v 1.54 2008-06-06 17:20:29 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "tmux.h" @@ -415,19 +416,21 @@ server_handle_window(struct window *w) { struct session *s; u_int i; - int action; + int action, update; window_parse(w); if (!(w->flags & WINDOW_BELL) && !(w->flags & WINDOW_ACTIVITY)) return; + update = 0; for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { s = ARRAY_ITEM(&sessions, i); if (s == NULL || !session_has(s, w)) continue; - if (w->flags & WINDOW_BELL) { + if (w->flags & WINDOW_BELL && + !session_alert_has(s, w, WINDOW_BELL)) { session_alert_add(s, w, WINDOW_BELL); action = options_get_number(&s->options, "bell-action"); @@ -441,12 +444,18 @@ server_handle_window(struct window *w) tty_write_session(s, TTY_CHARACTER, '\007'); break; } + update = 1; } - if ((w->flags & WINDOW_MONITOR) && (w->flags & WINDOW_ACTIVITY)) + if ((w->flags & WINDOW_MONITOR) && + (w->flags & WINDOW_ACTIVITY) && + !session_alert_has(s, w, WINDOW_ACTIVITY)) { session_alert_add(s, w, WINDOW_ACTIVITY); + update = 1; + } } - server_status_window(w); + if (update) + server_status_window(w); w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY); } diff --git a/session.c b/session.c index 52d7fd0f..c2680492 100644 --- a/session.c +++ b/session.c @@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.34 2008-06-04 16:46:23 nicm Exp $ */ +/* $Id: session.c,v 1.35 2008-06-06 17:20:29 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -17,10 +17,10 @@ */ #include -#include #include #include +#include #include #include "tmux.h" diff --git a/status.c b/status.c index 4b934382..1bec6f35 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.21 2008-06-04 16:46:23 nicm Exp $ */ +/* $Id: status.c,v 1.22 2008-06-06 17:20:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -17,10 +17,10 @@ */ #include -#include #include #include +#include #include "tmux.h" diff --git a/tmux.c b/tmux.c index 6bb55dcc..be11763a 100644 --- a/tmux.c +++ b/tmux.c @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.53 2008-06-05 16:35:32 nicm Exp $ */ +/* $Id: tmux.c,v 1.54 2008-06-06 17:20:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -174,7 +174,7 @@ main(int argc, char **argv) int n, opt; client = path = name = NULL; - while ((opt = getopt(argc, argv, "c:f:S:s:vV")) != EOF) { + while ((opt = getopt(argc, argv, "f:S:vV")) != EOF) { switch (opt) { case 'f': cfg_file = xstrdup(optarg); diff --git a/tmux.h b/tmux.h index 1d3eb913..de2fafd6 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.133 2008-06-05 21:25:00 nicm Exp $ */ +/* $Id: tmux.h,v 1.134 2008-06-06 17:20:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -59,6 +59,13 @@ extern char *__progname; #define __packed __attribute__ ((__packed__)) #endif +#ifndef timespeccmp +#define timespeccmp(tsp, usp, cmp) \ + (((tsp)->tv_sec == (usp)->tv_sec) ? \ + ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \ + ((tsp)->tv_sec cmp (usp)->tv_sec)) +#endif + #ifndef TTY_NAME_MAX #define TTY_NAME_MAX 32 #endif @@ -115,7 +122,7 @@ struct buffer { #define KEYC_A1 -1 #define KEYC_A3 -2 #define KEYC_B2 -3 -/* XXX #define KEYC_BACKSPACE -4 */ +/* #define KEYC_BACKSPACE -4 */ #define KEYC_BEG -5 #define KEYC_BTAB -6 #define KEYC_C1 -7 diff --git a/tty-keys.c b/tty-keys.c index 42c3e34f..ea5f46ae 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -1,4 +1,4 @@ -/* $Id: tty-keys.c,v 1.2 2007-12-06 09:46:23 nicm Exp $ */ +/* $Id: tty-keys.c,v 1.3 2008-06-06 17:20:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -26,6 +26,7 @@ struct { const char *name; int code; } tty_keys[] = { +/* { "kb", KEYC_BACKSPACE }, */ { "kBEG", KEYC_SBEG }, { "kCAN", KEYC_SCANCEL }, { "kCMD", KEYC_SCOMMAND }, @@ -259,6 +260,11 @@ tty_keys_next(struct tty *tty, int *code) } xfree(s); if (tk == NULL) { + size = tty->ksize; + if (size > BUFFER_USED(tty->in)) + size = BUFFER_USED(tty->in); + log_debug( + "unmatched key: %.*s", (int) size, BUFFER_OUT(tty->in)); /* * XXX Pass through unchanged. */