Make monitor-activity w/o arguments toggle.

This commit is contained in:
Nicholas Marriott 2008-06-04 18:32:20 +00:00
parent b25ac6fd75
commit f34b619049
1 changed files with 10 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-set-window-option.c,v 1.1 2008-06-04 17:54:26 nicm Exp $ */
/* $Id: cmd-set-window-option.c,v 1.2 2008-06-04 18:32:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -151,7 +151,7 @@ cmd_set_window_option_exec(void *ptr, unused struct cmd_ctx *ctx)
strcasecmp(data->value, "no") == 0)
bool = 0;
} else
bool = 1;
bool = -2;
if (strcmp(data->option, "monitor-activity") == 0) {
if (bool == -1) {
@ -159,10 +159,14 @@ cmd_set_window_option_exec(void *ptr, unused struct cmd_ctx *ctx)
return;
}
if (bool)
wl->window->flags |= WINDOW_MONITOR;
else
wl->window->flags &= ~WINDOW_MONITOR;
if (bool == -2)
wl->window->flags ^= WINDOW_MONITOR;
else {
if (bool)
wl->window->flags |= WINDOW_MONITOR;
else
wl->window->flags &= ~WINDOW_MONITOR;
}
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);