Add support for clicking on a floating pane border to make it active. Including bugfix to click bottom border of floating panes.

This commit is contained in:
Michael Grant 2025-11-07 11:43:41 +01:00
parent 9c45dd693b
commit 329e9d54ab
4 changed files with 14 additions and 3 deletions

View File

@ -86,6 +86,8 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_tiled; c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_tiled;
cmd_resize_pane_mouse_update_tiled(c, &event->m); cmd_resize_pane_mouse_update_tiled(c, &event->m);
} else { } else {
window_redraw_active_switch(w, c->tty.mouse_wp);
window_set_active_pane(w, c->tty.mouse_wp, 1);
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_floating; c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_floating;
cmd_resize_pane_mouse_update_floating(c, &event->m); cmd_resize_pane_mouse_update_floating(c, &event->m);
} }

View File

@ -160,6 +160,10 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
server_redraw_window_borders(markedwp->window); server_redraw_window_borders(markedwp->window);
server_status_window(markedwp->window); server_status_window(markedwp->window);
} }
if (wp->layout_cell == NULL) {
window_redraw_active_switch(w, wp);
window_set_active_pane(w, wp, 1);
}
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
} }

View File

@ -455,6 +455,9 @@ key_bindings_init(void)
/* Mouse button 1 triple click on pane. */ /* Mouse button 1 triple click on pane. */
"bind -n TripleClick1Pane { select-pane -t=; if -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' { send -M } { copy-mode -H; send -X select-line; run -d0.3; send -X copy-pipe-and-cancel } }", "bind -n TripleClick1Pane { select-pane -t=; if -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' { send -M } { copy-mode -H; send -X select-line; run -d0.3; send -X copy-pipe-and-cancel } }",
/* Mouse button 1 on border. */
"bind -n MouseDown1Border { select-pane -M }",
/* Mouse button 1 drag on border. */ /* Mouse button 1 drag on border. */
"bind -n MouseDrag1Border { resize-pane -M }", "bind -n MouseDrag1Border { resize-pane -M }",

View File

@ -606,7 +606,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, u_int px, u_int py,
sb_pad = 0; sb_pad = 0;
} }
/* xxxx isn't this only for tiled panes at the top or bottom of the window? */ /* xxxx isn't this only for tiled panes at the top or bottom of the window? */
if (pane_status == PANE_STATUS_TOP) if (pane_status == PANE_STATUS_TOP && wp->layout_cell != NULL)
line = wp->yoff - 1; line = wp->yoff - 1;
else if (pane_status == PANE_STATUS_BOTTOM) else if (pane_status == PANE_STATUS_BOTTOM)
line = wp->yoff + wp->sy; line = wp->yoff + wp->sy;
@ -639,8 +639,10 @@ server_client_check_mouse_in_pane(struct window_pane *wp, u_int px, u_int py,
} else /* py > sl_bottom */ } else /* py > sl_bottom */
return (SCROLLBAR_DOWN); return (SCROLLBAR_DOWN);
} else if (wp->layout_cell == NULL && } else if (wp->layout_cell == NULL &&
((int)px == wp->xoff - 1 || (int)py == wp->yoff -1)) { ((int)px == wp->xoff - 1 ||
/* Floating pane left or top border. */ (int)py == wp->yoff -1 ||
(int)py == wp->yoff + (int)wp->sy)) {
/* Floating pane left, bottom or top border. */
return (BORDER); return (BORDER);
} else { } else {
/* Must be inside the pane. */ /* Must be inside the pane. */