From 46f5e42145ed34567b29c73032adbd8a41f5dfa2 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 16 Nov 2008 10:10:26 +0000 Subject: Keep stack of previous windows. Check for op (orig_pair) for default colours. --- window.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'window.c') diff --git a/window.c b/window.c index 14cdfc00..92d955c0 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.50 2008-09-26 06:45:28 nicm Exp $ */ +/* $Id: window.c,v 1.51 2008-11-16 10:10:26 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -164,6 +164,32 @@ winlink_previous(unused struct winlinks *wwl, struct winlink *wl) #endif } +void +winlink_stack_push(struct winlink_stack *stack, struct winlink *wl) +{ + if (wl == NULL) + return; + + winlink_stack_remove(stack, wl); + SLIST_INSERT_HEAD(stack, wl, sentry); +} + +void +winlink_stack_remove(struct winlink_stack *stack, struct winlink *wl) +{ + struct winlink *wl2; + + if (wl == NULL) + return; + + SLIST_FOREACH(wl2, stack, sentry) { + if (wl2 == wl) { + SLIST_REMOVE(stack, wl, winlink, sentry); + return; + } + } +} + struct window * window_create(const char *name, const char *cmd, const char **envp, u_int sx, u_int sy, u_int hlimit) -- cgit