mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Some Linux fixes; some code tidying. Don't redraw status bar so often.
This commit is contained in:
		@@ -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
 | 
					.PHONY: clean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -63,7 +63,7 @@ SRCS+= compat/strlcpy.c compat/strlcat.c compat/strtonum.c
 | 
				
			|||||||
CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
 | 
					CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
 | 
				
			||||||
         -DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM -DNO_SETPROCTITLE \
 | 
					         -DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM -DNO_SETPROCTITLE \
 | 
				
			||||||
         -DNO_QUEUE_H -DNO_TREE_H -DUSE_PTY_H
 | 
					         -DNO_QUEUE_H -DNO_TREE_H -DUSE_PTY_H
 | 
				
			||||||
LDFLAGS+= -lresolv -lutil
 | 
					LDFLAGS+= -lrt -lutil
 | 
				
			||||||
# Required for LLONG_MAX and friends
 | 
					# Required for LLONG_MAX and friends
 | 
				
			||||||
CFLAGS+= -std=c99
 | 
					CFLAGS+= -std=c99
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -66,6 +66,7 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wl_dst = NULL;
 | 
				
			||||||
	if (idx != -1)
 | 
						if (idx != -1)
 | 
				
			||||||
		wl_dst = winlink_find_by_index(&s->windows, idx);
 | 
							wl_dst = winlink_find_by_index(&s->windows, idx);
 | 
				
			||||||
	if (wl_dst != NULL) {
 | 
						if (wl_dst != NULL) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										20
									
								
								input-keys.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								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 <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -28,6 +28,8 @@ struct {
 | 
				
			|||||||
	int		 key;
 | 
						int		 key;
 | 
				
			||||||
	const char	*data;
 | 
						const char	*data;
 | 
				
			||||||
} input_keys[] = {
 | 
					} input_keys[] = {
 | 
				
			||||||
 | 
					/*	{ KEYC_BACKSPACE, "\010" }, */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ KEYC_DC,     "\e[3~" },
 | 
						{ KEYC_DC,     "\e[3~" },
 | 
				
			||||||
	{ KEYC_F1,     "\eOP" },
 | 
						{ KEYC_F1,     "\eOP" },
 | 
				
			||||||
	{ KEYC_F10,    "\e[21~" },
 | 
						{ KEYC_F10,    "\e[21~" },
 | 
				
			||||||
@@ -108,12 +110,14 @@ input_key(struct window *w, int key)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	for (i = 0; i < NINPUTKEYS; i++) {
 | 
						for (i = 0; i < NINPUTKEYS; i++) {
 | 
				
			||||||
		if (input_keys[i].key == key) {
 | 
							if (input_keys[i].key == key)
 | 
				
			||||||
			log_debug2(
 | 
								break;
 | 
				
			||||||
			    "found key %d: \"%s\"", key, input_keys[i].data);
 | 
					 | 
				
			||||||
			buffer_write(w->out,
 | 
					 | 
				
			||||||
			    input_keys[i].data, strlen(input_keys[i].data));
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						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));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								server.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								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 <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -32,6 +32,7 @@
 | 
				
			|||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <syslog.h>
 | 
					#include <syslog.h>
 | 
				
			||||||
#include <termios.h>
 | 
					#include <termios.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
@@ -415,19 +416,21 @@ server_handle_window(struct window *w)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct session	*s;
 | 
						struct session	*s;
 | 
				
			||||||
	u_int		 i;
 | 
						u_int		 i;
 | 
				
			||||||
	int		 action;
 | 
						int		 action, update;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	window_parse(w);
 | 
						window_parse(w);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(w->flags & WINDOW_BELL) && !(w->flags & WINDOW_ACTIVITY))
 | 
						if (!(w->flags & WINDOW_BELL) && !(w->flags & WINDOW_ACTIVITY))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						update = 0;
 | 
				
			||||||
	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
 | 
						for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
 | 
				
			||||||
		s = ARRAY_ITEM(&sessions, i);
 | 
							s = ARRAY_ITEM(&sessions, i);
 | 
				
			||||||
		if (s == NULL || !session_has(s, w))
 | 
							if (s == NULL || !session_has(s, w))
 | 
				
			||||||
			continue;
 | 
								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);
 | 
								session_alert_add(s, w, WINDOW_BELL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			action = options_get_number(&s->options, "bell-action");
 | 
								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');
 | 
									tty_write_session(s, TTY_CHARACTER, '\007');
 | 
				
			||||||
				break;
 | 
									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);
 | 
								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);
 | 
						w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -17,10 +17,10 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <sys/time.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								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 <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -17,10 +17,10 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <sys/time.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdarg.h>
 | 
					#include <stdarg.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								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 <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -174,7 +174,7 @@ main(int argc, char **argv)
 | 
				
			|||||||
	int	 		 n, opt;
 | 
						int	 		 n, opt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	client = path = name = NULL;
 | 
						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) {
 | 
					                switch (opt) {
 | 
				
			||||||
		case 'f':
 | 
							case 'f':
 | 
				
			||||||
			cfg_file = xstrdup(optarg);
 | 
								cfg_file = xstrdup(optarg);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								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 <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -59,6 +59,13 @@ extern char    *__progname;
 | 
				
			|||||||
#define __packed __attribute__ ((__packed__))
 | 
					#define __packed __attribute__ ((__packed__))
 | 
				
			||||||
#endif
 | 
					#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
 | 
					#ifndef TTY_NAME_MAX
 | 
				
			||||||
#define TTY_NAME_MAX 32
 | 
					#define TTY_NAME_MAX 32
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -115,7 +122,7 @@ struct buffer {
 | 
				
			|||||||
#define KEYC_A1 -1
 | 
					#define KEYC_A1 -1
 | 
				
			||||||
#define KEYC_A3 -2
 | 
					#define KEYC_A3 -2
 | 
				
			||||||
#define KEYC_B2 -3
 | 
					#define KEYC_B2 -3
 | 
				
			||||||
/* XXX #define KEYC_BACKSPACE -4 */
 | 
					/* #define KEYC_BACKSPACE -4 */
 | 
				
			||||||
#define KEYC_BEG -5
 | 
					#define KEYC_BEG -5
 | 
				
			||||||
#define KEYC_BTAB -6
 | 
					#define KEYC_BTAB -6
 | 
				
			||||||
#define KEYC_C1 -7
 | 
					#define KEYC_C1 -7
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -26,6 +26,7 @@ struct {
 | 
				
			|||||||
	const char	*name;
 | 
						const char	*name;
 | 
				
			||||||
	int	 	 code;
 | 
						int	 	 code;
 | 
				
			||||||
} tty_keys[] = {
 | 
					} tty_keys[] = {
 | 
				
			||||||
 | 
					/*	{ "kb",	   KEYC_BACKSPACE }, */
 | 
				
			||||||
	{ "kBEG",  KEYC_SBEG },
 | 
						{ "kBEG",  KEYC_SBEG },
 | 
				
			||||||
	{ "kCAN",  KEYC_SCANCEL },
 | 
						{ "kCAN",  KEYC_SCANCEL },
 | 
				
			||||||
	{ "kCMD",  KEYC_SCOMMAND },
 | 
						{ "kCMD",  KEYC_SCOMMAND },
 | 
				
			||||||
@@ -259,6 +260,11 @@ tty_keys_next(struct tty *tty, int *code)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	xfree(s);
 | 
						xfree(s);
 | 
				
			||||||
	if (tk == NULL) {
 | 
						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.
 | 
							 * XXX Pass through unchanged.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user