mirror of
https://github.com/tmux/tmux.git
synced 2026-01-11 00:10:24 +00:00
Add separate z-index list. Each window has its own z-order list of panes now.
This commit is contained in:
@@ -104,9 +104,9 @@ screen_redraw_two_panes(struct window *w, int direction)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
|
||||
wp = TAILQ_FIRST(&w->panes);
|
||||
wp = TAILQ_FIRST(&w->z_index);
|
||||
do {
|
||||
wp = TAILQ_NEXT(wp, entry);
|
||||
wp = TAILQ_NEXT(wp, zentry);
|
||||
} while (wp && wp->layout_cell == NULL);
|
||||
|
||||
if (wp == NULL)
|
||||
@@ -234,7 +234,7 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, u_int px, u_int py)
|
||||
return (1);
|
||||
|
||||
/* Check all the panes. */
|
||||
TAILQ_FOREACH_REVERSE(wp, &w->panes, window_panes, entry) {
|
||||
TAILQ_FOREACH(wp, &w->z_index, zentry) {
|
||||
if (!window_pane_visible(wp))
|
||||
continue;
|
||||
switch (screen_redraw_pane_border(ctx, wp, px, py)) {
|
||||
@@ -356,7 +356,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py,
|
||||
|
||||
if (pane_status != PANE_STATUS_OFF) {
|
||||
/* Look for higest z-index window at px,py. xxxx scrollbars? */
|
||||
TAILQ_FOREACH_REVERSE(wp, &w->panes, window_panes, entry) {
|
||||
TAILQ_FOREACH(wp, &w->z_index, zentry) {
|
||||
if (! (wp->flags & PANE_MINIMISED) &&
|
||||
(px >= wp->xoff - 1 && px<= wp->xoff + wp->sx + 1) &&
|
||||
(py >= wp->yoff - 1 && py<= wp->yoff + wp->sy + 1))
|
||||
@@ -390,7 +390,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py,
|
||||
|
||||
|
||||
/* Look for higest z-index window at px,py. */
|
||||
TAILQ_FOREACH_REVERSE(wp, &w->panes, window_panes, entry) {
|
||||
TAILQ_FOREACH(wp, &w->z_index, zentry) {
|
||||
sb_w = wp->scrollbar_style.width +
|
||||
wp->scrollbar_style.pad;
|
||||
if (! (wp->flags & PANE_MINIMISED) &&
|
||||
@@ -971,7 +971,7 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
|
||||
pane_scrollbars = options_get_number(w->options, "pane-scrollbars");
|
||||
|
||||
found_self = 0;
|
||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||
TAILQ_FOREACH_REVERSE(wp, &w->z_index, window_panes_zindex, zentry) {
|
||||
if (wp == base_wp) {
|
||||
found_self = 1;
|
||||
continue;
|
||||
|
||||
@@ -1783,7 +1783,7 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only,
|
||||
u_int r_start, r_end, ci_start, ci_end;
|
||||
u_int wr_start, wr_end, wr_length, sx, xoff, yoff;
|
||||
struct tty_ctx ttyctx;
|
||||
struct visible_ranges *vr;
|
||||
struct visible_ranges *vr;
|
||||
struct window_pane *wp = ctx->wp;
|
||||
|
||||
if (ctx->scrolled != 0) {
|
||||
@@ -2023,7 +2023,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
w = base_wp->window;
|
||||
px = ctx->s->cx;
|
||||
py = ctx->s->cy;
|
||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||
TAILQ_FOREACH(wp, &w->panes, zentry) {
|
||||
if (wp == base_wp) {
|
||||
found_self = 1;
|
||||
continue;
|
||||
|
||||
3
tmux.h
3
tmux.h
@@ -1230,9 +1230,11 @@ struct window_pane {
|
||||
|
||||
TAILQ_ENTRY(window_pane) entry; /* link in list of all panes */
|
||||
TAILQ_ENTRY(window_pane) sentry; /* link in list of last visited */
|
||||
TAILQ_ENTRY(window_pane) zentry; /* z-index link in list of all panes */
|
||||
RB_ENTRY(window_pane) tree_entry;
|
||||
};
|
||||
TAILQ_HEAD(window_panes, window_pane);
|
||||
TAILQ_HEAD(window_panes_zindex, window_pane);
|
||||
RB_HEAD(window_pane_tree, window_pane);
|
||||
|
||||
/* Window structure. */
|
||||
@@ -1251,6 +1253,7 @@ struct window {
|
||||
|
||||
struct window_pane *active;
|
||||
struct window_panes last_panes;
|
||||
struct window_panes z_index;
|
||||
struct window_panes panes;
|
||||
|
||||
int lastlayout;
|
||||
|
||||
2
tty.c
2
tty.c
@@ -2041,7 +2041,7 @@ tty_is_obscured(const struct tty_ctx *ctx)
|
||||
w = base_wp->window;
|
||||
|
||||
/* Check if there is a floating pane. xxxx borders? scrollbars? */
|
||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||
TAILQ_FOREACH_REVERSE(wp, &w->z_index, window_panes_zindex, zentry) {
|
||||
if (wp == base_wp) {
|
||||
found_self = 1;
|
||||
continue;
|
||||
|
||||
10
window.c
10
window.c
@@ -306,6 +306,7 @@ window_create(u_int sx, u_int sy, u_int xpixel, u_int ypixel)
|
||||
w->flags = 0;
|
||||
|
||||
TAILQ_INIT(&w->panes);
|
||||
TAILQ_INIT(&w->z_index);
|
||||
TAILQ_INIT(&w->last_panes);
|
||||
w->active = NULL;
|
||||
|
||||
@@ -586,8 +587,8 @@ window_redraw_active_switch(struct window *w, struct window_pane *wp)
|
||||
if (wp == w->active)
|
||||
break;
|
||||
if (wp->layout_cell == NULL) {
|
||||
TAILQ_REMOVE(&w->panes, wp, entry);
|
||||
TAILQ_INSERT_TAIL(&w->panes, wp, entry);
|
||||
TAILQ_REMOVE(&w->z_index, wp, zentry);
|
||||
TAILQ_INSERT_HEAD(&w->z_index, wp, zentry);
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
wp = w->active;
|
||||
@@ -600,7 +601,7 @@ window_get_active_at(struct window *w, u_int x, u_int y)
|
||||
struct window_pane *wp;
|
||||
u_int xoff, yoff, sx, sy;
|
||||
|
||||
TAILQ_FOREACH_REVERSE(wp, &w->panes, window_panes, entry) {
|
||||
TAILQ_FOREACH(wp, &w->z_index, zentry) {
|
||||
if (!window_pane_visible(wp))
|
||||
continue;
|
||||
window_pane_full_size_offset(wp, &xoff, &yoff, &sx, &sy);
|
||||
@@ -765,6 +766,7 @@ window_add_pane(struct window *w, struct window_pane *other, u_int hlimit,
|
||||
else
|
||||
TAILQ_INSERT_AFTER(&w->panes, other, wp, entry);
|
||||
}
|
||||
TAILQ_INSERT_HEAD(&w->z_index, wp, zentry);
|
||||
return (wp);
|
||||
}
|
||||
|
||||
@@ -799,6 +801,7 @@ window_remove_pane(struct window *w, struct window_pane *wp)
|
||||
window_lost_pane(w, wp);
|
||||
|
||||
TAILQ_REMOVE(&w->panes, wp, entry);
|
||||
TAILQ_REMOVE(&w->z_index, wp, zentry);
|
||||
window_pane_destroy(wp);
|
||||
}
|
||||
|
||||
@@ -882,6 +885,7 @@ window_destroy_panes(struct window *w)
|
||||
while (!TAILQ_EMPTY(&w->panes)) {
|
||||
wp = TAILQ_FIRST(&w->panes);
|
||||
TAILQ_REMOVE(&w->panes, wp, entry);
|
||||
TAILQ_REMOVE(&w->z_index, wp, zentry);
|
||||
window_pane_destroy(wp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user