1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 07:13:36 +02:00

Add a helper to get pane-border-status for a window for some other

changes to come.
This commit is contained in:
nicm
2026-06-14 19:31:37 +00:00
parent 3f5cf1464b
commit 70f06a5829
7 changed files with 41 additions and 36 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: cmd-resize-pane.c,v 1.57 2026/06/13 16:16:18 nicm Exp $ */
/* $OpenBSD: cmd-resize-pane.c,v 1.58 2026/06/14 19:31:37 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -118,7 +118,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
free(cause);
return (CMD_RETURN_ERROR);
}
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
switch (status) {
case PANE_STATUS_TOP:
if (y != INT_MAX && wp->yoff == 1)
+2 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: format.c,v 1.377 2026/06/13 20:07:30 nicm Exp $ */
/* $OpenBSD: format.c,v 1.378 2026/06/14 19:31:37 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1151,7 +1151,7 @@ format_cb_pane_at_top(struct format_tree *ft)
return (NULL);
w = wp->window;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
if (status == PANE_STATUS_TOP)
flag = (wp->yoff == 1);
else
+5 -5
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: layout.c,v 1.67 2026/06/14 18:59:15 nicm Exp $ */
/* $OpenBSD: layout.c,v 1.68 2026/06/14 19:31:37 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -348,7 +348,7 @@ layout_fix_panes(struct window *w, struct window_pane *skip)
int status, scrollbars, sb_pos, sb_w, sb_pad;
u_int sx, sy;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
scrollbars = options_get_number(w->options, "pane-scrollbars");
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
@@ -426,7 +426,7 @@ layout_resize_check(struct window *w, struct layout_cell *lc,
u_int available, minimum;
int status, scrollbars;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
scrollbars = options_get_number(w->options, "pane-scrollbars");
if (lc->type == LAYOUT_WINDOWPANE) {
@@ -1060,7 +1060,7 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size,
lc = wp->window->layout_root;
else
lc = wp->layout_cell;
status = options_get_number(wp->window->options, "pane-border-status");
status = window_get_pane_status(wp->window);
scrollbars = options_get_number(wp->window->options, "pane-scrollbars");
/* Copy the old cell size. */
@@ -1283,7 +1283,7 @@ layout_spread_cell(struct window *w, struct layout_cell *parent)
number++;
if (number <= 1)
return (0);
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
if (parent->type == LAYOUT_LEFTRIGHT)
size = parent->sx;
+6 -6
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: screen-redraw.c,v 1.133 2026/06/10 14:51:20 nicm Exp $ */
/* $OpenBSD: screen-redraw.c,v 1.134 2026/06/14 19:31:37 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -774,7 +774,6 @@ screen_redraw_set_context(struct client *c, struct screen_redraw_ctx *ctx)
struct session *s = c->session;
struct options *oo = s->options;
struct window *w = s->curw->window;
struct options *wo = w->options;
u_int lines;
memset(ctx, 0, sizeof *ctx);
@@ -787,11 +786,12 @@ screen_redraw_set_context(struct client *c, struct screen_redraw_ctx *ctx)
ctx->statustop = 1;
ctx->statuslines = lines;
ctx->pane_status = options_get_number(wo, "pane-border-status");
ctx->pane_lines = options_get_number(wo, "pane-border-lines");
ctx->pane_status = window_get_pane_status(w);
ctx->pane_lines = options_get_number(w->options, "pane-border-lines");
ctx->pane_scrollbars = options_get_number(wo, "pane-scrollbars");
ctx->pane_scrollbars_pos = options_get_number(wo,
ctx->pane_scrollbars = options_get_number(w->options,
"pane-scrollbars");
ctx->pane_scrollbars_pos = options_get_number(w->options,
"pane-scrollbars-position");
tty_window_offset(&c->tty, &ctx->ox, &ctx->oy, &ctx->sx, &ctx->sy);
+5 -7
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: server-client.c,v 1.467 2026/06/11 19:50:23 nicm Exp $ */
/* $OpenBSD: server-client.c,v 1.468 2026/06/14 19:31:37 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -607,15 +607,14 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
u_int *sl_mpos)
{
struct window *w = wp->window;
struct options *wo = w->options;
struct window_pane *fwp;
int pane_status, sb, sb_pos, sb_w, sb_pad;
int pane_status_line, sl_top, sl_bottom;
int bdr_bottom, bdr_top, bdr_left, bdr_right;
sb = options_get_number(wo, "pane-scrollbars");
sb_pos = options_get_number(wo, "pane-scrollbars-position");
pane_status = options_get_number(wo, "pane-border-status");
sb = options_get_number(w->options, "pane-scrollbars");
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
pane_status = window_get_pane_status(w);
if (window_pane_show_scrollbar(wp, sb)) {
sb_w = wp->scrollbar_style.width;
@@ -919,8 +918,7 @@ have_event:
log_debug("mouse %u,%u on pane %%%u", x, y,
wp->id);
} else if (loc == KEYC_MOUSE_LOCATION_BORDER) {
sr = window_pane_border_status_get_range(wp, px,
py);
sr = window_pane_status_get_range(wp, px, py);
if (sr != NULL) {
n = sr->argument;
loc = KEYC_MOUSE_LOCATION_CONTROL0 + n;
+4 -3
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1348 2026/06/13 10:32:54 nicm Exp $ */
/* $OpenBSD: tmux.h,v 1.1349 2026/06/14 19:31:37 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -3472,8 +3472,9 @@ int window_pane_get_bg_control_client(struct window_pane *);
int window_get_bg_client(struct window_pane *);
enum client_theme window_pane_get_theme(struct window_pane *);
void window_pane_send_theme_update(struct window_pane *);
struct style_range *window_pane_border_status_get_range(struct window_pane *,
u_int, u_int);
int window_get_pane_status(struct window *);
struct style_range *window_pane_status_get_range(struct window_pane *, u_int,
u_int);
int window_pane_is_floating(struct window_pane *);
/* layout.c */
+17 -11
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: window.c,v 1.335 2026/06/11 14:19:59 nicm Exp $ */
/* $OpenBSD: window.c,v 1.336 2026/06/14 19:31:37 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -627,7 +627,7 @@ window_get_active_at(struct window *w, u_int x, u_int y)
int pane_status, xoff, yoff;
u_int sx, sy;
pane_status = options_get_number(w->options, "pane-border-status");
pane_status = window_get_pane_status(w);
if (pane_status == PANE_STATUS_TOP) {
/*
@@ -635,10 +635,12 @@ window_get_active_at(struct window *w, u_int x, u_int y)
* bottom border.
*/
TAILQ_FOREACH(wp, &w->z_index, zentry) {
if (!window_pane_visible(wp) || window_pane_is_floating(wp))
if (!window_pane_visible(wp) ||
window_pane_is_floating(wp))
continue;
window_pane_full_size_offset(wp, &xoff, &yoff, &sx, &sy);
window_pane_full_size_offset(wp, &xoff, &yoff, &sx,
&sy);
if ((int)x < xoff || x > xoff + sx)
continue;
if ((int)y == yoff - 1)
@@ -685,7 +687,7 @@ window_find_string(struct window *w, const char *s)
x = w->sx / 2;
y = w->sy / 2;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
if (status == PANE_STATUS_TOP)
top++;
else if (status == PANE_STATUS_BOTTOM)
@@ -1544,7 +1546,7 @@ window_pane_find_up(struct window_pane *wp)
if (wp == NULL)
return (NULL);
w = wp->window;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
list = NULL;
size = 0;
@@ -1605,7 +1607,7 @@ window_pane_find_down(struct window_pane *wp)
if (wp == NULL)
return (NULL);
w = wp->window;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
list = NULL;
size = 0;
@@ -2121,21 +2123,19 @@ window_pane_send_theme_update(struct window_pane *wp)
}
struct style_range *
window_pane_border_status_get_range(struct window_pane *wp, u_int x, u_int y)
window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y)
{
struct style_ranges *srs;
struct window *w;
struct options *wo;
u_int line;
int pane_status;
if (wp == NULL)
return (NULL);
w = wp->window;
wo = w->options;
srs = &wp->border_status_line.ranges;
pane_status = options_get_number(wo, "pane-border-status");
pane_status = window_get_pane_status(w);
if (pane_status == PANE_STATUS_TOP)
line = wp->yoff - 1;
else if (pane_status == PANE_STATUS_BOTTOM)
@@ -2150,6 +2150,12 @@ window_pane_border_status_get_range(struct window_pane *wp, u_int x, u_int y)
return (style_ranges_get_range(srs, x - wp->xoff - 2));
}
int
window_get_pane_status(struct window *w)
{
return (options_get_number(w->options, "pane-border-status"));
}
int
window_pane_is_floating(struct window_pane *wp)
{