mirror of
https://github.com/tmux/tmux.git
synced 2026-06-20 17:25:57 +00:00
Add a helper to get pane-border-status for a window for some other
changes to come.
This commit is contained in:
@@ -118,7 +118,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
free(cause);
|
free(cause);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
status = options_get_number(w->options, "pane-border-status");
|
status = window_get_pane_status(w);
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case PANE_STATUS_TOP:
|
case PANE_STATUS_TOP:
|
||||||
if (y != INT_MAX && wp->yoff == 1)
|
if (y != INT_MAX && wp->yoff == 1)
|
||||||
|
|||||||
2
format.c
2
format.c
@@ -1151,7 +1151,7 @@ format_cb_pane_at_top(struct format_tree *ft)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
w = wp->window;
|
w = wp->window;
|
||||||
|
|
||||||
status = options_get_number(w->options, "pane-border-status");
|
status = window_get_pane_status(w);
|
||||||
if (status == PANE_STATUS_TOP)
|
if (status == PANE_STATUS_TOP)
|
||||||
flag = (wp->yoff == 1);
|
flag = (wp->yoff == 1);
|
||||||
else
|
else
|
||||||
|
|||||||
8
layout.c
8
layout.c
@@ -348,7 +348,7 @@ layout_fix_panes(struct window *w, struct window_pane *skip)
|
|||||||
int status, scrollbars, sb_pos, sb_w, sb_pad;
|
int status, scrollbars, sb_pos, sb_w, sb_pad;
|
||||||
u_int sx, sy;
|
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");
|
scrollbars = options_get_number(w->options, "pane-scrollbars");
|
||||||
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
|
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;
|
u_int available, minimum;
|
||||||
int status, scrollbars;
|
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");
|
scrollbars = options_get_number(w->options, "pane-scrollbars");
|
||||||
|
|
||||||
if (lc->type == LAYOUT_WINDOWPANE) {
|
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;
|
lc = wp->window->layout_root;
|
||||||
else
|
else
|
||||||
lc = wp->layout_cell;
|
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");
|
scrollbars = options_get_number(wp->window->options, "pane-scrollbars");
|
||||||
|
|
||||||
/* Copy the old cell size. */
|
/* Copy the old cell size. */
|
||||||
@@ -1283,7 +1283,7 @@ layout_spread_cell(struct window *w, struct layout_cell *parent)
|
|||||||
number++;
|
number++;
|
||||||
if (number <= 1)
|
if (number <= 1)
|
||||||
return (0);
|
return (0);
|
||||||
status = options_get_number(w->options, "pane-border-status");
|
status = window_get_pane_status(w);
|
||||||
|
|
||||||
if (parent->type == LAYOUT_LEFTRIGHT)
|
if (parent->type == LAYOUT_LEFTRIGHT)
|
||||||
size = parent->sx;
|
size = parent->sx;
|
||||||
|
|||||||
@@ -774,7 +774,6 @@ screen_redraw_set_context(struct client *c, struct screen_redraw_ctx *ctx)
|
|||||||
struct session *s = c->session;
|
struct session *s = c->session;
|
||||||
struct options *oo = s->options;
|
struct options *oo = s->options;
|
||||||
struct window *w = s->curw->window;
|
struct window *w = s->curw->window;
|
||||||
struct options *wo = w->options;
|
|
||||||
u_int lines;
|
u_int lines;
|
||||||
|
|
||||||
memset(ctx, 0, sizeof *ctx);
|
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->statustop = 1;
|
||||||
ctx->statuslines = lines;
|
ctx->statuslines = lines;
|
||||||
|
|
||||||
ctx->pane_status = options_get_number(wo, "pane-border-status");
|
ctx->pane_status = window_get_pane_status(w);
|
||||||
ctx->pane_lines = options_get_number(wo, "pane-border-lines");
|
ctx->pane_lines = options_get_number(w->options, "pane-border-lines");
|
||||||
|
|
||||||
ctx->pane_scrollbars = options_get_number(wo, "pane-scrollbars");
|
ctx->pane_scrollbars = options_get_number(w->options,
|
||||||
ctx->pane_scrollbars_pos = options_get_number(wo,
|
"pane-scrollbars");
|
||||||
|
ctx->pane_scrollbars_pos = options_get_number(w->options,
|
||||||
"pane-scrollbars-position");
|
"pane-scrollbars-position");
|
||||||
|
|
||||||
tty_window_offset(&c->tty, &ctx->ox, &ctx->oy, &ctx->sx, &ctx->sy);
|
tty_window_offset(&c->tty, &ctx->ox, &ctx->oy, &ctx->sx, &ctx->sy);
|
||||||
|
|||||||
@@ -607,15 +607,14 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
|
|||||||
u_int *sl_mpos)
|
u_int *sl_mpos)
|
||||||
{
|
{
|
||||||
struct window *w = wp->window;
|
struct window *w = wp->window;
|
||||||
struct options *wo = w->options;
|
|
||||||
struct window_pane *fwp;
|
struct window_pane *fwp;
|
||||||
int pane_status, sb, sb_pos, sb_w, sb_pad;
|
int pane_status, sb, sb_pos, sb_w, sb_pad;
|
||||||
int pane_status_line, sl_top, sl_bottom;
|
int pane_status_line, sl_top, sl_bottom;
|
||||||
int bdr_bottom, bdr_top, bdr_left, bdr_right;
|
int bdr_bottom, bdr_top, bdr_left, bdr_right;
|
||||||
|
|
||||||
sb = options_get_number(wo, "pane-scrollbars");
|
sb = options_get_number(w->options, "pane-scrollbars");
|
||||||
sb_pos = options_get_number(wo, "pane-scrollbars-position");
|
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
|
||||||
pane_status = options_get_number(wo, "pane-border-status");
|
pane_status = window_get_pane_status(w);
|
||||||
|
|
||||||
if (window_pane_show_scrollbar(wp, sb)) {
|
if (window_pane_show_scrollbar(wp, sb)) {
|
||||||
sb_w = wp->scrollbar_style.width;
|
sb_w = wp->scrollbar_style.width;
|
||||||
@@ -919,8 +918,7 @@ have_event:
|
|||||||
log_debug("mouse %u,%u on pane %%%u", x, y,
|
log_debug("mouse %u,%u on pane %%%u", x, y,
|
||||||
wp->id);
|
wp->id);
|
||||||
} else if (loc == KEYC_MOUSE_LOCATION_BORDER) {
|
} else if (loc == KEYC_MOUSE_LOCATION_BORDER) {
|
||||||
sr = window_pane_border_status_get_range(wp, px,
|
sr = window_pane_status_get_range(wp, px, py);
|
||||||
py);
|
|
||||||
if (sr != NULL) {
|
if (sr != NULL) {
|
||||||
n = sr->argument;
|
n = sr->argument;
|
||||||
loc = KEYC_MOUSE_LOCATION_CONTROL0 + n;
|
loc = KEYC_MOUSE_LOCATION_CONTROL0 + n;
|
||||||
|
|||||||
5
tmux.h
5
tmux.h
@@ -3472,8 +3472,9 @@ int window_pane_get_bg_control_client(struct window_pane *);
|
|||||||
int window_get_bg_client(struct window_pane *);
|
int window_get_bg_client(struct window_pane *);
|
||||||
enum client_theme window_pane_get_theme(struct window_pane *);
|
enum client_theme window_pane_get_theme(struct window_pane *);
|
||||||
void window_pane_send_theme_update(struct window_pane *);
|
void window_pane_send_theme_update(struct window_pane *);
|
||||||
struct style_range *window_pane_border_status_get_range(struct window_pane *,
|
int window_get_pane_status(struct window *);
|
||||||
u_int, u_int);
|
struct style_range *window_pane_status_get_range(struct window_pane *, u_int,
|
||||||
|
u_int);
|
||||||
int window_pane_is_floating(struct window_pane *);
|
int window_pane_is_floating(struct window_pane *);
|
||||||
|
|
||||||
/* layout.c */
|
/* layout.c */
|
||||||
|
|||||||
26
window.c
26
window.c
@@ -627,7 +627,7 @@ window_get_active_at(struct window *w, u_int x, u_int y)
|
|||||||
int pane_status, xoff, yoff;
|
int pane_status, xoff, yoff;
|
||||||
u_int sx, sy;
|
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) {
|
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.
|
* bottom border.
|
||||||
*/
|
*/
|
||||||
TAILQ_FOREACH(wp, &w->z_index, zentry) {
|
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;
|
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)
|
if ((int)x < xoff || x > xoff + sx)
|
||||||
continue;
|
continue;
|
||||||
if ((int)y == yoff - 1)
|
if ((int)y == yoff - 1)
|
||||||
@@ -685,7 +687,7 @@ window_find_string(struct window *w, const char *s)
|
|||||||
x = w->sx / 2;
|
x = w->sx / 2;
|
||||||
y = w->sy / 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)
|
if (status == PANE_STATUS_TOP)
|
||||||
top++;
|
top++;
|
||||||
else if (status == PANE_STATUS_BOTTOM)
|
else if (status == PANE_STATUS_BOTTOM)
|
||||||
@@ -1544,7 +1546,7 @@ window_pane_find_up(struct window_pane *wp)
|
|||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
w = wp->window;
|
w = wp->window;
|
||||||
status = options_get_number(w->options, "pane-border-status");
|
status = window_get_pane_status(w);
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
@@ -1605,7 +1607,7 @@ window_pane_find_down(struct window_pane *wp)
|
|||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
w = wp->window;
|
w = wp->window;
|
||||||
status = options_get_number(w->options, "pane-border-status");
|
status = window_get_pane_status(w);
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
@@ -2121,21 +2123,19 @@ window_pane_send_theme_update(struct window_pane *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct style_range *
|
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 style_ranges *srs;
|
||||||
struct window *w;
|
struct window *w;
|
||||||
struct options *wo;
|
|
||||||
u_int line;
|
u_int line;
|
||||||
int pane_status;
|
int pane_status;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
w = wp->window;
|
w = wp->window;
|
||||||
wo = w->options;
|
|
||||||
srs = &wp->border_status_line.ranges;
|
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)
|
if (pane_status == PANE_STATUS_TOP)
|
||||||
line = wp->yoff - 1;
|
line = wp->yoff - 1;
|
||||||
else if (pane_status == PANE_STATUS_BOTTOM)
|
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));
|
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
|
int
|
||||||
window_pane_is_floating(struct window_pane *wp)
|
window_pane_is_floating(struct window_pane *wp)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user