mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add an option (mouse-select-window) which allows the mouse to be used by
clicking on the status line, written by hsim at gmx dot li.
This commit is contained in:
		
							
								
								
									
										18
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								status.c
									
									
									
									
									
								
							@@ -120,6 +120,23 @@ status_redraw_get_right(struct client *c,
 | 
			
		||||
	return (right);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Set window at window list position. */
 | 
			
		||||
void
 | 
			
		||||
status_set_window_at(struct client *c, u_int x)
 | 
			
		||||
{
 | 
			
		||||
	struct session	*s = c->session;
 | 
			
		||||
	struct winlink	*wl;
 | 
			
		||||
 | 
			
		||||
	x += s->wlmouse;
 | 
			
		||||
	RB_FOREACH(wl, winlinks, &s->windows) {
 | 
			
		||||
		if (x < wl->status_width &&
 | 
			
		||||
			session_select(s, wl->idx) == 0) {
 | 
			
		||||
			server_redraw_session(s);
 | 
			
		||||
		}
 | 
			
		||||
		x -= wl->status_width + 1;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Draw status for client on the last lines of given context. */
 | 
			
		||||
int
 | 
			
		||||
status_redraw(struct client *c)
 | 
			
		||||
@@ -325,6 +342,7 @@ draw:
 | 
			
		||||
		wloffset++;
 | 
			
		||||
 | 
			
		||||
	/* Copy the window list. */
 | 
			
		||||
	s->wlmouse = -wloffset + wlstart;
 | 
			
		||||
	screen_write_cursormove(&ctx, wloffset, 0);
 | 
			
		||||
	screen_write_copy(&ctx, &window_list, wlstart, 0, wlwidth, 1);
 | 
			
		||||
	screen_free(&window_list);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user