version 1.285, 2023/03/27 08:47:57 |
version 1.286, 2023/07/10 09:24:53 |
|
|
|
|
winlink_stack_remove(stack, wl); |
winlink_stack_remove(stack, wl); |
TAILQ_INSERT_HEAD(stack, wl, sentry); |
TAILQ_INSERT_HEAD(stack, wl, sentry); |
|
wl->flags |= WINLINK_VISITED; |
} |
} |
|
|
void |
void |
winlink_stack_remove(struct winlink_stack *stack, struct winlink *wl) |
winlink_stack_remove(struct winlink_stack *stack, struct winlink *wl) |
{ |
{ |
struct winlink *wl2; |
if (wl != NULL && (wl->flags & WINLINK_VISITED)) { |
|
TAILQ_REMOVE(stack, wl, sentry); |
if (wl == NULL) |
wl->flags &= ~WINLINK_VISITED; |
return; |
|
|
|
TAILQ_FOREACH(wl2, stack, sentry) { |
|
if (wl2 == wl) { |
|
TAILQ_REMOVE(stack, wl, sentry); |
|
return; |
|
} |
|
} |
} |
} |
} |
|
|
|
|
w->flags = 0; |
w->flags = 0; |
|
|
TAILQ_INIT(&w->panes); |
TAILQ_INIT(&w->panes); |
|
TAILQ_INIT(&w->last_panes); |
w->active = NULL; |
w->active = NULL; |
|
|
w->lastlayout = -1; |
w->lastlayout = -1; |
|
|
int |
int |
window_set_active_pane(struct window *w, struct window_pane *wp, int notify) |
window_set_active_pane(struct window *w, struct window_pane *wp, int notify) |
{ |
{ |
|
struct window_pane *lastwp; |
|
|
log_debug("%s: pane %%%u", __func__, wp->id); |
log_debug("%s: pane %%%u", __func__, wp->id); |
|
|
if (wp == w->active) |
if (wp == w->active) |
return (0); |
return (0); |
w->last = w->active; |
lastwp = w->active; |
|
|
|
window_pane_stack_remove(&w->last_panes, wp); |
|
window_pane_stack_push(&w->last_panes, lastwp); |
|
|
w->active = wp; |
w->active = wp; |
w->active->active_point = next_active_point++; |
w->active->active_point = next_active_point++; |
w->active->flags |= PANE_CHANGED; |
w->active->flags |= PANE_CHANGED; |
|
|
if (options_get_number(global_options, "focus-events")) { |
if (options_get_number(global_options, "focus-events")) { |
window_pane_update_focus(w->last); |
window_pane_update_focus(lastwp); |
window_pane_update_focus(w->active); |
window_pane_update_focus(w->active); |
} |
} |
|
|
|
|
if (wp == marked_pane.wp) |
if (wp == marked_pane.wp) |
server_clear_marked(); |
server_clear_marked(); |
|
|
|
window_pane_stack_remove(&w->last_panes, wp); |
if (wp == w->active) { |
if (wp == w->active) { |
w->active = w->last; |
w->active = TAILQ_FIRST(&w->last_panes); |
w->last = NULL; |
|
if (w->active == NULL) { |
if (w->active == NULL) { |
w->active = TAILQ_PREV(wp, window_panes, entry); |
w->active = TAILQ_PREV(wp, window_panes, entry); |
if (w->active == NULL) |
if (w->active == NULL) |
w->active = TAILQ_NEXT(wp, entry); |
w->active = TAILQ_NEXT(wp, entry); |
} |
} |
if (w->active != NULL) { |
if (w->active != NULL) { |
|
window_pane_stack_remove(&w->last_panes, w->active); |
w->active->flags |= PANE_CHANGED; |
w->active->flags |= PANE_CHANGED; |
notify_window("window-pane-changed", w); |
notify_window("window-pane-changed", w); |
window_update_focus(w); |
window_update_focus(w); |
} |
} |
} else if (wp == w->last) |
} |
w->last = NULL; |
|
} |
} |
|
|
void |
void |
|
|
{ |
{ |
struct window_pane *wp; |
struct window_pane *wp; |
|
|
|
while (!TAILQ_EMPTY(&w->last_panes)) { |
|
wp = TAILQ_FIRST(&w->last_panes); |
|
window_pane_stack_remove(&w->last_panes, wp); |
|
} |
|
|
while (!TAILQ_EMPTY(&w->panes)) { |
while (!TAILQ_EMPTY(&w->panes)) { |
wp = TAILQ_FIRST(&w->panes); |
wp = TAILQ_FIRST(&w->panes); |
TAILQ_REMOVE(&w->panes, wp, entry); |
TAILQ_REMOVE(&w->panes, wp, entry); |
|
|
best = window_pane_choose_best(list, size); |
best = window_pane_choose_best(list, size); |
free(list); |
free(list); |
return (best); |
return (best); |
|
} |
|
|
|
void |
|
window_pane_stack_push(struct window_panes *stack, struct window_pane *wp) |
|
{ |
|
if (wp != NULL) { |
|
window_pane_stack_remove(stack, wp); |
|
TAILQ_INSERT_HEAD(stack, wp, sentry); |
|
wp->flags |= PANE_VISITED; |
|
} |
|
} |
|
|
|
void |
|
window_pane_stack_remove(struct window_panes *stack, struct window_pane *wp) |
|
{ |
|
if (wp != NULL && (wp->flags & PANE_VISITED)) { |
|
TAILQ_REMOVE(stack, wp, sentry); |
|
wp->flags &= ~PANE_VISITED; |
|
} |
} |
} |
|
|
/* Clear alert flags for a winlink */ |
/* Clear alert flags for a winlink */ |