Make window options work the same was as session options, add mode-fg/mode-bg options, force -g for global on set/show/setw/showw/

This commit is contained in:
Nicholas Marriott
2008-12-08 16:19:51 +00:00
parent f008d303e7
commit 7a82e86827
27 changed files with 690 additions and 768 deletions

View File

@ -1,4 +1,4 @@
/* $Id: resize.c,v 1.16 2008-06-19 22:04:02 nicm Exp $ */
/* $Id: resize.c,v 1.17 2008-12-08 16:19:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -48,7 +48,8 @@ recalculate_sizes(void)
struct session *s;
struct client *c;
struct window *w;
u_int i, j, ssx, ssy, has;
u_int i, j, ssx, ssy, has, limit;
int flag;
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);
@ -93,13 +94,14 @@ recalculate_sizes(void)
w = ARRAY_ITEM(&windows, i);
if (w == NULL)
continue;
flag = options_get_number(&w->options, "aggressive-resize");
ssx = ssy = UINT_MAX;
for (j = 0; j < ARRAY_LENGTH(&sessions); j++) {
s = ARRAY_ITEM(&sessions, j);
if (s == NULL || s->flags & SESSION_UNATTACHED)
continue;
if (w->flags & WINDOW_AGGRESSIVE)
if (flag)
has = s->curw->window == w;
else
has = session_has(s, w);
@ -116,10 +118,12 @@ recalculate_sizes(void)
}
w->flags &= ~WINDOW_HIDDEN;
if (ssx > w->limitx)
ssx = w->limitx;
if (ssy > w->limity)
ssy = w->limity;
limit = options_get_number(&w->options, "force-width");
if (limit != 0 && ssx > limit)
ssx = limit;
limit = options_get_number(&w->options, "force-height");
if (limit != 0 && ssy > limit)
ssy = limit;
if (screen_size_x(&w->base) == ssx &&
screen_size_y(&w->base) == ssy)