Changed name of the mouse drag functions to be consistent with similar functions in cmd-join-pane.c. Specifically added what these callbacks actually do in the name. Added comment in code so it's clear too.

This commit is contained in:
Michael Grant
2026-06-16 18:27:07 +02:00
parent 6549765930
commit 4f2c162203

View File

@@ -31,10 +31,10 @@ static enum cmd_retval cmd_resize_pane_exec(struct cmd *, struct cmdq_item *);
static enum cmd_retval cmd_resize_pane_mouse_update(struct cmd *, static enum cmd_retval cmd_resize_pane_mouse_update(struct cmd *,
struct cmdq_item *); struct cmdq_item *);
static void cmd_resize_pane_mouse_update_floating(struct client *, static void cmd_resize_pane_mouse_update_resize_move_floating(
struct mouse_event *); struct client *, struct mouse_event *);
static void cmd_resize_pane_mouse_update_tiled(struct client *, static void cmd_resize_pane_mouse_update_resize_tiled(
struct mouse_event *); struct client *, struct mouse_event *);
const struct cmd_entry cmd_resize_pane_entry = { const struct cmd_entry cmd_resize_pane_entry = {
.name = "resize-pane", .name = "resize-pane",
@@ -205,21 +205,36 @@ cmd_resize_pane_mouse_update(__unused struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
if (!window_pane_is_floating(wp)) { if (!window_pane_is_floating(wp)) {
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_tiled; c->tty.mouse_drag_update =
cmd_resize_pane_mouse_update_tiled(c, &event->m); cmd_resize_pane_mouse_update_resize_tiled;
cmd_resize_pane_mouse_update_resize_tiled(c, &event->m);
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
} }
window_redraw_active_switch(w, wp); window_redraw_active_switch(w, wp);
window_set_active_pane(w, wp, 1); window_set_active_pane(w, wp, 1);
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_floating; /* Set up mouse_drag_update callback. */
cmd_resize_pane_mouse_update_floating(c, &event->m); c->tty.mouse_drag_update =
cmd_resize_pane_mouse_update_resize_move_floating;
cmd_resize_pane_mouse_update_resize_move_floating(c, &event->m);
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
} }
/*
* Resizes or moves the pane by dragging.
* server-client.c calls c->tty.mouse_drag_update(c, m) which
* calls this function.
* Resize a floating pane by dragging the borders or corners.
* Grabbing an edge only resizes that axis.
* (Special case) Moves the pane if dragging the top border.
* Since characters are generally rectangular, to make it
* easier to grab the corner, the character next to the corner
* is also considered the corner.
*/
static void static void
cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m) cmd_resize_pane_mouse_update_resize_move_floating(struct client *c,
struct mouse_event *m)
{ {
struct winlink *wl; struct winlink *wl;
struct window *w; struct window *w;
@@ -345,7 +360,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
} }
static void static void
cmd_resize_pane_mouse_update_tiled(struct client *c, struct mouse_event *m) cmd_resize_pane_mouse_update_resize_tiled(struct client *c, struct mouse_event *m)
{ {
struct winlink *wl; struct winlink *wl;
struct window *w; struct window *w;