=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window.c,v retrieving revision 1.212 retrieving revision 1.213 diff -c -r1.212 -r1.213 *** src/usr.bin/tmux/window.c 2018/08/05 08:59:30 1.212 --- src/usr.bin/tmux/window.c 2018/10/18 08:38:01 1.213 *************** *** 1,4 **** ! /* $OpenBSD: window.c,v 1.212 2018/08/05 08:59:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: window.c,v 1.213 2018/10/18 08:38:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 380,385 **** --- 380,387 ---- if (event_initialized(&w->alerts_timer)) evtimer_del(&w->alerts_timer); + if (event_initialized(&w->offset_timer)) + event_del(&w->offset_timer); options_free(w->options); *************** *** 458,474 **** return (0); w->last = w->active; w->active = wp; - while (!window_pane_visible(w->active)) { - w->active = TAILQ_PREV(w->active, window_panes, entry); - if (w->active == NULL) - w->active = TAILQ_LAST(&w->panes, window_panes); - if (w->active == wp) { - notify_window("window-pane-changed", w); - return (1); - } - } w->active->active_point = next_active_point++; w->active->flags |= PANE_CHANGED; notify_window("window-pane-changed", w); return (1); } --- 460,468 ---- return (0); w->last = w->active; w->active = wp; w->active->active_point = next_active_point++; w->active->flags |= PANE_CHANGED; + tty_update_window_offset(w); notify_window("window-pane-changed", w); return (1); } *************** *** 509,516 **** struct window_pane *wp; TAILQ_FOREACH(wp, &w->panes, entry) { ! if (!window_pane_visible(wp)) ! continue; if (x < wp->xoff || x > wp->xoff + wp->sx) continue; if (y < wp->yoff || y > wp->yoff + wp->sy) --- 503,510 ---- struct window_pane *wp; TAILQ_FOREACH(wp, &w->panes, entry) { ! if (!window_pane_visible(wp)) ! continue; if (x < wp->xoff || x > wp->xoff + wp->sx) continue; if (y < wp->yoff || y > wp->yoff + wp->sy) *************** *** 563,571 **** if (w->flags & WINDOW_ZOOMED) return (-1); - if (!window_pane_visible(wp)) - return (-1); - if (window_count_panes(w) == 1) return (-1); --- 557,562 ---- *************** *** 602,608 **** wp->layout_cell = wp->saved_layout_cell; wp->saved_layout_cell = NULL; } ! layout_fix_panes(w, w->sx, w->sy); notify_window("window-layout-changed", w); return (0); --- 593,599 ---- wp->layout_cell = wp->saved_layout_cell; wp->saved_layout_cell = NULL; } ! layout_fix_panes(w); notify_window("window-layout-changed", w); return (0); *************** *** 1284,1294 **** return; if (options_get_number(wp->window->options, "synchronize-panes")) { TAILQ_FOREACH(wp2, &wp->window->panes, entry) { ! if (wp2 == wp || wp2->mode != NULL) ! continue; ! if (wp2->fd == -1 || wp2->flags & PANE_INPUTOFF) ! continue; ! if (window_pane_visible(wp2)) input_key(wp2, key, NULL); } } --- 1275,1285 ---- return; if (options_get_number(wp->window->options, "synchronize-panes")) { TAILQ_FOREACH(wp2, &wp->window->panes, entry) { ! if (wp2 != wp && ! wp2->mode == NULL && ! wp2->fd != -1 && ! (~wp2->flags & PANE_INPUTOFF) && ! window_pane_visible(wp2)) input_key(wp2, key, NULL); } } *************** *** 1297,1312 **** int window_pane_visible(struct window_pane *wp) { ! struct window *w = wp->window; ! ! if (wp->layout_cell == NULL) ! return (0); ! ! if (wp->xoff >= w->sx || wp->yoff >= w->sy) ! return (0); ! if (wp->xoff + wp->sx > w->sx || wp->yoff + wp->sy > w->sy) ! return (0); ! return (1); } u_int --- 1288,1296 ---- int window_pane_visible(struct window_pane *wp) { ! if (~wp->window->flags & WINDOW_ZOOMED) ! return (1); ! return (wp == wp->window->active); } u_int *************** *** 1363,1369 **** u_int edge, left, right, end, size; int status, found; ! if (wp == NULL || !window_pane_visible(wp)) return (NULL); status = options_get_number(wp->window->options, "pane-border-status"); --- 1347,1353 ---- u_int edge, left, right, end, size; int status, found; ! if (wp == NULL) return (NULL); status = options_get_number(wp->window->options, "pane-border-status"); *************** *** 1378,1384 **** right = wp->xoff + wp->sx; TAILQ_FOREACH(next, &wp->window->panes, entry) { ! if (next == wp || !window_pane_visible(next)) continue; if (next->yoff + next->sy + 1 != edge) continue; --- 1362,1368 ---- right = wp->xoff + wp->sx; TAILQ_FOREACH(next, &wp->window->panes, entry) { ! if (next == wp) continue; if (next->yoff + next->sy + 1 != edge) continue; *************** *** 1410,1416 **** u_int edge, left, right, end, size; int status, found; ! if (wp == NULL || !window_pane_visible(wp)) return (NULL); status = options_get_number(wp->window->options, "pane-border-status"); --- 1394,1400 ---- u_int edge, left, right, end, size; int status, found; ! if (wp == NULL) return (NULL); status = options_get_number(wp->window->options, "pane-border-status"); *************** *** 1425,1431 **** right = wp->xoff + wp->sx; TAILQ_FOREACH(next, &wp->window->panes, entry) { ! if (next == wp || !window_pane_visible(next)) continue; if (next->yoff != edge) continue; --- 1409,1415 ---- right = wp->xoff + wp->sx; TAILQ_FOREACH(next, &wp->window->panes, entry) { ! if (next == wp) continue; if (next->yoff != edge) continue; *************** *** 1457,1463 **** u_int edge, top, bottom, end, size; int found; ! if (wp == NULL || !window_pane_visible(wp)) return (NULL); list = NULL; --- 1441,1447 ---- u_int edge, top, bottom, end, size; int found; ! if (wp == NULL) return (NULL); list = NULL; *************** *** 1471,1477 **** bottom = wp->yoff + wp->sy; TAILQ_FOREACH(next, &wp->window->panes, entry) { ! if (next == wp || !window_pane_visible(next)) continue; if (next->xoff + next->sx + 1 != edge) continue; --- 1455,1461 ---- bottom = wp->yoff + wp->sy; TAILQ_FOREACH(next, &wp->window->panes, entry) { ! if (next == wp) continue; if (next->xoff + next->sx + 1 != edge) continue; *************** *** 1503,1509 **** u_int edge, top, bottom, end, size; int found; ! if (wp == NULL || !window_pane_visible(wp)) return (NULL); list = NULL; --- 1487,1493 ---- u_int edge, top, bottom, end, size; int found; ! if (wp == NULL) return (NULL); list = NULL; *************** *** 1517,1523 **** bottom = wp->yoff + wp->sy; TAILQ_FOREACH(next, &wp->window->panes, entry) { ! if (next == wp || !window_pane_visible(next)) continue; if (next->xoff != edge) continue; --- 1501,1507 ---- bottom = wp->yoff + wp->sy; TAILQ_FOREACH(next, &wp->window->panes, entry) { ! if (next == wp) continue; if (next->xoff != edge) continue;