mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	We no longer need the terminal service class, so don't bother asking for it.
This commit is contained in:
		
							
								
								
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1082,9 +1082,7 @@ LIST_HEAD(tty_terms, tty_term);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct tty {
 | 
					struct tty {
 | 
				
			||||||
	struct client	*client;
 | 
						struct client	*client;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	char		*path;
 | 
						char		*path;
 | 
				
			||||||
	u_int		 class;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	u_int		 sx;
 | 
						u_int		 sx;
 | 
				
			||||||
	u_int		 sy;
 | 
						u_int		 sy;
 | 
				
			||||||
@@ -1564,7 +1562,6 @@ void	tty_putn(struct tty *, const void *, size_t, u_int);
 | 
				
			|||||||
int	tty_init(struct tty *, struct client *, int, char *);
 | 
					int	tty_init(struct tty *, struct client *, int, char *);
 | 
				
			||||||
int	tty_resize(struct tty *);
 | 
					int	tty_resize(struct tty *);
 | 
				
			||||||
int	tty_set_size(struct tty *, u_int, u_int);
 | 
					int	tty_set_size(struct tty *, u_int, u_int);
 | 
				
			||||||
void	tty_set_class(struct tty *, u_int);
 | 
					 | 
				
			||||||
void	tty_start_tty(struct tty *);
 | 
					void	tty_start_tty(struct tty *);
 | 
				
			||||||
void	tty_stop_tty(struct tty *);
 | 
					void	tty_stop_tty(struct tty *);
 | 
				
			||||||
void	tty_set_title(struct tty *, const char *);
 | 
					void	tty_set_title(struct tty *, const char *);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										69
									
								
								tty-keys.c
									
									
									
									
									
								
							
							
						
						
									
										69
									
								
								tty-keys.c
									
									
									
									
									
								
							@@ -41,7 +41,6 @@ struct tty_key *tty_keys_find1(
 | 
				
			|||||||
struct tty_key *tty_keys_find(struct tty *, const char *, size_t, size_t *);
 | 
					struct tty_key *tty_keys_find(struct tty *, const char *, size_t, size_t *);
 | 
				
			||||||
void		tty_keys_callback(int, short, void *);
 | 
					void		tty_keys_callback(int, short, void *);
 | 
				
			||||||
int		tty_keys_mouse(struct tty *, const char *, size_t, size_t *);
 | 
					int		tty_keys_mouse(struct tty *, const char *, size_t, size_t *);
 | 
				
			||||||
int		tty_keys_device(struct tty *, const char *, size_t, size_t *);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Default raw keys. */
 | 
					/* Default raw keys. */
 | 
				
			||||||
struct tty_default_key_raw {
 | 
					struct tty_default_key_raw {
 | 
				
			||||||
@@ -482,17 +481,6 @@ tty_keys_next(struct tty *tty)
 | 
				
			|||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
	log_debug("keys are %zu (%.*s)", len, (int) len, buf);
 | 
						log_debug("keys are %zu (%.*s)", len, (int) len, buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Is this device attributes response? */
 | 
					 | 
				
			||||||
	switch (tty_keys_device(tty, buf, len, &size)) {
 | 
					 | 
				
			||||||
	case 0:		/* yes */
 | 
					 | 
				
			||||||
		key = KEYC_NONE;
 | 
					 | 
				
			||||||
		goto complete_key;
 | 
					 | 
				
			||||||
	case -1:	/* no, or not valid */
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 1:		/* partial */
 | 
					 | 
				
			||||||
		goto partial_key;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Is this a mouse key press? */
 | 
						/* Is this a mouse key press? */
 | 
				
			||||||
	switch (tty_keys_mouse(tty, buf, len, &size)) {
 | 
						switch (tty_keys_mouse(tty, buf, len, &size)) {
 | 
				
			||||||
	case 0:		/* yes */
 | 
						case 0:		/* yes */
 | 
				
			||||||
@@ -794,60 +782,3 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return (0);
 | 
						return (0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Handle device attributes input. Returns 0 for success, -1 for failure, 1 for
 | 
					 | 
				
			||||||
 * partial.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
int
 | 
					 | 
				
			||||||
tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	u_int i, class;
 | 
					 | 
				
			||||||
	char  tmp[64], *endptr;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Primary device attributes are \033[?a;b and secondary are
 | 
					 | 
				
			||||||
	 * \033[>a;b;c.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	*size = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* First three bytes are always \033[?. */
 | 
					 | 
				
			||||||
	if (buf[0] != '\033')
 | 
					 | 
				
			||||||
		return (-1);
 | 
					 | 
				
			||||||
	if (len == 1)
 | 
					 | 
				
			||||||
		return (1);
 | 
					 | 
				
			||||||
	if (buf[1] != '[')
 | 
					 | 
				
			||||||
		return (-1);
 | 
					 | 
				
			||||||
	if (len == 2)
 | 
					 | 
				
			||||||
		return (1);
 | 
					 | 
				
			||||||
	if (buf[2] != '>' && buf[2] != '?')
 | 
					 | 
				
			||||||
		return (-1);
 | 
					 | 
				
			||||||
	if (len == 3)
 | 
					 | 
				
			||||||
		return (1);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Copy the rest up to a 'c'. */
 | 
					 | 
				
			||||||
	for (i = 0; i < (sizeof tmp) - 1 && buf[3 + i] != 'c'; i++) {
 | 
					 | 
				
			||||||
		if (3 + i == len)
 | 
					 | 
				
			||||||
			return (1);
 | 
					 | 
				
			||||||
		tmp[i] = buf[3 + i];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (i == (sizeof tmp) - 1)
 | 
					 | 
				
			||||||
		return (-1);
 | 
					 | 
				
			||||||
	tmp[i] = '\0';
 | 
					 | 
				
			||||||
	*size = 4 + i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Only primary is of interest. */
 | 
					 | 
				
			||||||
	if (buf[2] != '?')
 | 
					 | 
				
			||||||
		return (0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Convert service class. */
 | 
					 | 
				
			||||||
	class = strtoul(tmp, &endptr, 10);
 | 
					 | 
				
			||||||
	if (*endptr != ';')
 | 
					 | 
				
			||||||
		class = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	log_debug("received service class %u", class);
 | 
					 | 
				
			||||||
	tty_set_class(tty, class);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return (0);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								tty.c
									
									
									
									
									
								
							@@ -233,7 +233,6 @@ tty_start_tty(struct tty *tty)
 | 
				
			|||||||
			tty->flags |= TTY_FOCUS;
 | 
								tty->flags |= TTY_FOCUS;
 | 
				
			||||||
			tty_puts(tty, "\033[?1004h");
 | 
								tty_puts(tty, "\033[?1004h");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		tty_puts(tty, "\033[c");
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tty->cx = UINT_MAX;
 | 
						tty->cx = UINT_MAX;
 | 
				
			||||||
@@ -253,14 +252,6 @@ tty_start_tty(struct tty *tty)
 | 
				
			|||||||
	tty->mouse_drag_release = NULL;
 | 
						tty->mouse_drag_release = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
tty_set_class(struct tty *tty, u_int class)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (tty->class != 0)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	tty->class = class;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
tty_stop_tty(struct tty *tty)
 | 
					tty_stop_tty(struct tty *tty)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user