mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Have resize update a SESSION_UNATTACHED flag.
This commit is contained in:
parent
1e252b9e9a
commit
6f2edda785
38
resize.c
38
resize.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: resize.c,v 1.2 2007-10-04 20:01:10 nicm Exp $ */
|
/* $Id: resize.c,v 1.3 2007-10-05 18:25:05 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -36,6 +36,11 @@
|
|||||||
*
|
*
|
||||||
* This is quite inefficient - better/additional data structures are needed
|
* This is quite inefficient - better/additional data structures are needed
|
||||||
* to make it better.
|
* to make it better.
|
||||||
|
*
|
||||||
|
* As a side effect, this function updates the SESSION_UNATTACHED flag. This
|
||||||
|
* flag is necessary to make sure unattached sessions do not limit the size of
|
||||||
|
* windows that are attached both to them and to other sessions which are
|
||||||
|
* attached.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -54,15 +59,21 @@ recalculate_sizes(void)
|
|||||||
ssx = ssy = UINT_MAX;
|
ssx = ssy = UINT_MAX;
|
||||||
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
|
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
|
||||||
c = ARRAY_ITEM(&clients, j);
|
c = ARRAY_ITEM(&clients, j);
|
||||||
if (c == NULL || c->session != s)
|
if (c == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (c->sx < ssx)
|
if (c->session == s) {
|
||||||
ssx = c->sx;
|
if (c->sx < ssx)
|
||||||
if (c->sy < ssy)
|
ssx = c->sx;
|
||||||
ssy = c->sy;
|
if (c->sy < ssy)
|
||||||
|
ssy = c->sy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ssx == UINT_MAX || ssy == UINT_MAX)
|
if (ssx == UINT_MAX || ssy == UINT_MAX) {
|
||||||
|
s->flags |= SESSION_UNATTACHED;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
s->flags &= ~SESSION_UNATTACHED;
|
||||||
|
|
||||||
if (ssy < status_lines)
|
if (ssy < status_lines)
|
||||||
ssy = status_lines + 1;
|
ssy = status_lines + 1;
|
||||||
ssy -= status_lines;
|
ssy -= status_lines;
|
||||||
@ -84,15 +95,18 @@ recalculate_sizes(void)
|
|||||||
ssx = ssy = UINT_MAX;
|
ssx = ssy = UINT_MAX;
|
||||||
for (j = 0; j < ARRAY_LENGTH(&sessions); j++) {
|
for (j = 0; j < ARRAY_LENGTH(&sessions); j++) {
|
||||||
s = ARRAY_ITEM(&sessions, j);
|
s = ARRAY_ITEM(&sessions, j);
|
||||||
if (s == NULL || !session_has(s, w))
|
if (s == NULL || s->flags & SESSION_UNATTACHED)
|
||||||
continue;
|
continue;
|
||||||
if (s->sx < ssx)
|
if (session_has(s, w)) {
|
||||||
ssx = s->sx;
|
if (s->sx < ssx)
|
||||||
if (s->sy < ssy)
|
ssx = s->sx;
|
||||||
ssy = s->sy;
|
if (s->sy < ssy)
|
||||||
|
ssy = s->sy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ssx == UINT_MAX || ssy == UINT_MAX)
|
if (ssx == UINT_MAX || ssy == UINT_MAX)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->screen.sx == ssx && w->screen.sy == ssy)
|
if (w->screen.sx == ssx && w->screen.sy == ssy)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
5
tmux.h
5
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.51 2007-10-05 14:23:28 nicm Exp $ */
|
/* $Id: tmux.h,v 1.52 2007-10-05 18:25:05 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -423,6 +423,9 @@ struct session {
|
|||||||
struct window *window;
|
struct window *window;
|
||||||
struct window *last;
|
struct window *last;
|
||||||
struct windows windows;
|
struct windows windows;
|
||||||
|
|
||||||
|
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
|
||||||
|
int flags;
|
||||||
};
|
};
|
||||||
ARRAY_DECL(sessions, struct session *);
|
ARRAY_DECL(sessions, struct session *);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user