aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'window.c')
-rw-r--r--window.c54
1 files changed, 13 insertions, 41 deletions
diff --git a/window.c b/window.c
index 16c973b2..cf29ae48 100644
--- a/window.c
+++ b/window.c
@@ -378,6 +378,8 @@ window_destroy(struct window *w)
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);
@@ -456,17 +458,9 @@ window_set_active_pane(struct window *w, struct window_pane *wp)
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;
+ tty_update_window_offset(w);
notify_window("window-pane-changed", w);
return (1);
}
@@ -507,8 +501,6 @@ window_get_active_at(struct window *w, u_int x, u_int y)
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)
@@ -561,9 +553,6 @@ window_zoom(struct window_pane *wp)
if (w->flags & WINDOW_ZOOMED)
return (-1);
- if (!window_pane_visible(wp))
- return (-1);
-
if (window_count_panes(w) == 1)
return (-1);
@@ -600,7 +589,7 @@ window_unzoom(struct window *w)
wp->layout_cell = wp->saved_layout_cell;
wp->saved_layout_cell = NULL;
}
- layout_fix_panes(w, w->sx, w->sy);
+ layout_fix_panes(w);
notify_window("window-layout-changed", w);
return (0);
@@ -898,7 +887,6 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
#ifdef HAVE_UTEMPTER
char s[32];
#endif
- int i;
sigset_t set, oldset;
if (wp->fd != -1) {
@@ -1302,27 +1290,11 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s,
continue;
if (wp2->fd == -1 || wp2->flags & PANE_INPUTOFF)
continue;
- if (window_pane_visible(wp2))
- input_key(wp2, key, NULL);
+ input_key(wp2, key, NULL);
}
}
}
-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
window_pane_search(struct window_pane *wp, const char *searchstr)
{
@@ -1377,7 +1349,7 @@ window_pane_find_up(struct window_pane *wp)
u_int edge, left, right, end, size;
int status, found;
- if (wp == NULL || !window_pane_visible(wp))
+ if (wp == NULL)
return (NULL);
status = options_get_number(wp->window->options, "pane-border-status");
@@ -1392,7 +1364,7 @@ window_pane_find_up(struct window_pane *wp)
right = wp->xoff + wp->sx;
TAILQ_FOREACH(next, &wp->window->panes, entry) {
- if (next == wp || !window_pane_visible(next))
+ if (next == wp)
continue;
if (next->yoff + next->sy + 1 != edge)
continue;
@@ -1424,7 +1396,7 @@ window_pane_find_down(struct window_pane *wp)
u_int edge, left, right, end, size;
int status, found;
- if (wp == NULL || !window_pane_visible(wp))
+ if (wp == NULL)
return (NULL);
status = options_get_number(wp->window->options, "pane-border-status");
@@ -1439,7 +1411,7 @@ window_pane_find_down(struct window_pane *wp)
right = wp->xoff + wp->sx;
TAILQ_FOREACH(next, &wp->window->panes, entry) {
- if (next == wp || !window_pane_visible(next))
+ if (next == wp)
continue;
if (next->yoff != edge)
continue;
@@ -1471,7 +1443,7 @@ window_pane_find_left(struct window_pane *wp)
u_int edge, top, bottom, end, size;
int found;
- if (wp == NULL || !window_pane_visible(wp))
+ if (wp == NULL)
return (NULL);
list = NULL;
@@ -1485,7 +1457,7 @@ window_pane_find_left(struct window_pane *wp)
bottom = wp->yoff + wp->sy;
TAILQ_FOREACH(next, &wp->window->panes, entry) {
- if (next == wp || !window_pane_visible(next))
+ if (next == wp)
continue;
if (next->xoff + next->sx + 1 != edge)
continue;
@@ -1517,7 +1489,7 @@ window_pane_find_right(struct window_pane *wp)
u_int edge, top, bottom, end, size;
int found;
- if (wp == NULL || !window_pane_visible(wp))
+ if (wp == NULL)
return (NULL);
list = NULL;
@@ -1531,7 +1503,7 @@ window_pane_find_right(struct window_pane *wp)
bottom = wp->yoff + wp->sy;
TAILQ_FOREACH(next, &wp->window->panes, entry) {
- if (next == wp || !window_pane_visible(next))
+ if (next == wp)
continue;
if (next->xoff != edge)
continue;