mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Merge IDENTIFY_* flags with CLIENT_* flags.
This commit is contained in:
		
							
								
								
									
										16
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								client.c
									
									
									
									
									
								
							@@ -236,7 +236,7 @@ client_main(int argc, char **argv, int flags)
 | 
			
		||||
	setblocking(STDIN_FILENO, 0);
 | 
			
		||||
	event_set(&client_stdin, STDIN_FILENO, EV_READ|EV_PERSIST,
 | 
			
		||||
	    client_stdin_callback, NULL);
 | 
			
		||||
	if (flags & IDENTIFY_TERMIOS) {
 | 
			
		||||
	if (flags & CLIENT_CONTROLCONTROL) {
 | 
			
		||||
		if (tcgetattr(STDIN_FILENO, &saved_tio) != 0) {
 | 
			
		||||
			fprintf(stderr, "tcgetattr failed: %s\n",
 | 
			
		||||
			    strerror(errno));
 | 
			
		||||
@@ -293,14 +293,12 @@ client_main(int argc, char **argv, int flags)
 | 
			
		||||
		ppid = getppid();
 | 
			
		||||
		if (client_exittype == MSG_DETACHKILL && ppid > 1)
 | 
			
		||||
			kill(ppid, SIGHUP);
 | 
			
		||||
	} else if (flags & IDENTIFY_TERMIOS) {
 | 
			
		||||
		if (flags & IDENTIFY_CONTROL) {
 | 
			
		||||
			if (client_exitreason != CLIENT_EXIT_NONE)
 | 
			
		||||
			    printf("%%exit %s\n", client_exit_message());
 | 
			
		||||
			else
 | 
			
		||||
			    printf("%%exit\n");
 | 
			
		||||
			printf("\033\\");
 | 
			
		||||
		}
 | 
			
		||||
	} else if (flags & CLIENT_CONTROLCONTROL) {
 | 
			
		||||
		if (client_exitreason != CLIENT_EXIT_NONE)
 | 
			
		||||
			printf("%%exit %s\n", client_exit_message());
 | 
			
		||||
		else
 | 
			
		||||
			printf("%%exit\n");
 | 
			
		||||
		printf("\033\\");
 | 
			
		||||
		tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio);
 | 
			
		||||
	}
 | 
			
		||||
	setblocking(STDIN_FILENO, 1);
 | 
			
		||||
 
 | 
			
		||||
@@ -956,12 +956,12 @@ server_client_msg_identify(
 | 
			
		||||
	if (*data->cwd != '\0')
 | 
			
		||||
		c->cwd = xstrdup(data->cwd);
 | 
			
		||||
 | 
			
		||||
	if (data->flags & IDENTIFY_CONTROL) {
 | 
			
		||||
	if (data->flags & CLIENT_CONTROL) {
 | 
			
		||||
		c->stdin_callback = control_callback;
 | 
			
		||||
		evbuffer_free(c->stderr_data);
 | 
			
		||||
		c->stderr_data = c->stdout_data;
 | 
			
		||||
		c->flags |= CLIENT_CONTROL;
 | 
			
		||||
		if (data->flags & IDENTIFY_TERMIOS)
 | 
			
		||||
		if (data->flags & CLIENT_CONTROLCONTROL)
 | 
			
		||||
			evbuffer_add_printf(c->stdout_data, "\033P1000p");
 | 
			
		||||
		server_write_client(c, MSG_STDIN, NULL, 0);
 | 
			
		||||
 | 
			
		||||
@@ -980,14 +980,14 @@ server_client_msg_identify(
 | 
			
		||||
	}
 | 
			
		||||
	data->term[(sizeof data->term) - 1] = '\0';
 | 
			
		||||
	tty_init(&c->tty, c, fd, data->term);
 | 
			
		||||
	if (data->flags & IDENTIFY_UTF8)
 | 
			
		||||
	if (data->flags & CLIENT_UTF8)
 | 
			
		||||
		c->tty.flags |= TTY_UTF8;
 | 
			
		||||
	if (data->flags & IDENTIFY_256COLOURS)
 | 
			
		||||
	if (data->flags & CLIENT_256COLOURS)
 | 
			
		||||
		c->tty.term_flags |= TERM_256COLOURS;
 | 
			
		||||
 | 
			
		||||
	tty_resize(&c->tty);
 | 
			
		||||
 | 
			
		||||
	if (!(data->flags & IDENTIFY_CONTROL))
 | 
			
		||||
	if (!(data->flags & CLIENT_CONTROL))
 | 
			
		||||
		c->flags |= CLIENT_TERMINAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								tmux.c
									
									
									
									
									
								
							@@ -264,17 +264,17 @@ main(int argc, char **argv)
 | 
			
		||||
	while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUVv")) != -1) {
 | 
			
		||||
		switch (opt) {
 | 
			
		||||
		case '2':
 | 
			
		||||
			flags |= IDENTIFY_256COLOURS;
 | 
			
		||||
			flags |= CLIENT_256COLOURS;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'c':
 | 
			
		||||
			free(shell_cmd);
 | 
			
		||||
			shell_cmd = xstrdup(optarg);
 | 
			
		||||
			break;
 | 
			
		||||
		case 'C':
 | 
			
		||||
			if (flags & IDENTIFY_CONTROL)
 | 
			
		||||
				flags |= IDENTIFY_TERMIOS;
 | 
			
		||||
			if (flags & CLIENT_CONTROL)
 | 
			
		||||
				flags |= CLIENT_CONTROLCONTROL;
 | 
			
		||||
			else
 | 
			
		||||
				flags |= IDENTIFY_CONTROL;
 | 
			
		||||
				flags |= CLIENT_CONTROL;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			printf("%s %s\n", __progname, VERSION);
 | 
			
		||||
@@ -298,7 +298,7 @@ main(int argc, char **argv)
 | 
			
		||||
			path = xstrdup(optarg);
 | 
			
		||||
			break;
 | 
			
		||||
		case 'u':
 | 
			
		||||
			flags |= IDENTIFY_UTF8;
 | 
			
		||||
			flags |= CLIENT_UTF8;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'v':
 | 
			
		||||
			debug_level++;
 | 
			
		||||
@@ -313,7 +313,7 @@ main(int argc, char **argv)
 | 
			
		||||
	if (shell_cmd != NULL && argc != 0)
 | 
			
		||||
		usage();
 | 
			
		||||
 | 
			
		||||
	if (!(flags & IDENTIFY_UTF8)) {
 | 
			
		||||
	if (!(flags & CLIENT_UTF8)) {
 | 
			
		||||
		/*
 | 
			
		||||
		 * If the user has set whichever of LC_ALL, LC_CTYPE or LANG
 | 
			
		||||
		 * exist (in that order) to contain UTF-8, it is a safe
 | 
			
		||||
@@ -327,7 +327,7 @@ main(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
		if (s != NULL && (strcasestr(s, "UTF-8") != NULL ||
 | 
			
		||||
		    strcasestr(s, "UTF8") != NULL))
 | 
			
		||||
			flags |= IDENTIFY_UTF8;
 | 
			
		||||
			flags |= CLIENT_UTF8;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	environ_init(&global_environ);
 | 
			
		||||
@@ -346,7 +346,7 @@ main(int argc, char **argv)
 | 
			
		||||
	options_table_populate_tree(window_options_table, &global_w_options);
 | 
			
		||||
 | 
			
		||||
	/* Enable UTF-8 if the first client is on UTF-8 terminal. */
 | 
			
		||||
	if (flags & IDENTIFY_UTF8) {
 | 
			
		||||
	if (flags & CLIENT_UTF8) {
 | 
			
		||||
		options_set_number(&global_s_options, "status-utf8", 1);
 | 
			
		||||
		options_set_number(&global_s_options, "mouse-utf8", 1);
 | 
			
		||||
		options_set_number(&global_w_options, "utf8", 1);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tmux.h
									
									
									
									
									
								
							@@ -484,11 +484,6 @@ struct msg_identify_data {
 | 
			
		||||
	char		ttyname[TTY_NAME_MAX];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define IDENTIFY_UTF8 0x1
 | 
			
		||||
#define IDENTIFY_256COLOURS 0x2
 | 
			
		||||
/* 0x4 unused */
 | 
			
		||||
#define IDENTIFY_CONTROL 0x8
 | 
			
		||||
#define IDENTIFY_TERMIOS 0x10
 | 
			
		||||
	int		flags;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -1341,7 +1336,11 @@ struct client {
 | 
			
		||||
#define CLIENT_READONLY 0x800
 | 
			
		||||
#define CLIENT_REDRAWWINDOW 0x1000
 | 
			
		||||
#define CLIENT_CONTROL 0x2000
 | 
			
		||||
#define CLIENT_FOCUSED 0x4000
 | 
			
		||||
#define CLIENT_CONTROLCONTROL 0x4000
 | 
			
		||||
#define CLIENT_FOCUSED 0x8000
 | 
			
		||||
#define CLIENT_UTF8 0x10000
 | 
			
		||||
#define CLIENT_256COLOURS 0x20000
 | 
			
		||||
#define CLIENT_IDENTIFIED 0x40000
 | 
			
		||||
	int		 flags;
 | 
			
		||||
 | 
			
		||||
	struct event	 identify_timer;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user