panel_below(NULL) returns the top panel.

panel_above(NULL) returns the bottom panel.
This commit is contained in:
uwe 2015-11-01 01:40:23 +00:00
parent f5c7aafae0
commit 411bbd24b9
3 changed files with 19 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: above.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */
/* $NetBSD: above.c,v 1.2 2015/11/01 01:40:23 uwe Exp $ */
/*
* Copyright (c) 2015 Valery Ushakov
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: above.c,v 1.1 2015/10/26 23:09:49 uwe Exp $");
__RCSID("$NetBSD: above.c,v 1.2 2015/11/01 01:40:23 uwe Exp $");
#include "panel_impl.h"
@ -35,8 +35,12 @@ PANEL *
panel_above(PANEL *p)
{
if (__predict_false(p == NULL))
return NULL;
if (p == NULL) {
if (TAILQ_EMPTY(&_deck))
return NULL;
return PANEL_ABOVE(&_stdscr_panel);
}
if (__predict_false(PANEL_HIDDEN(p)))
return NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: below.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */
/* $NetBSD: below.c,v 1.2 2015/11/01 01:40:23 uwe Exp $ */
/*
* Copyright (c) 2015 Valery Ushakov
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: below.c,v 1.1 2015/10/26 23:09:49 uwe Exp $");
__RCSID("$NetBSD: below.c,v 1.2 2015/11/01 01:40:23 uwe Exp $");
#include "panel_impl.h"
@ -36,13 +36,13 @@ panel_below(PANEL *p)
{
PANEL *below;
if (__predict_false(p == NULL))
if (p == NULL)
below = TAILQ_LAST(&_deck, deck);
else if (__predict_true(!PANEL_HIDDEN(p)))
below = PANEL_BELOW(p);
else
return NULL;
if (__predict_false(PANEL_HIDDEN(p)))
return NULL;
below = PANEL_BELOW(p);
if (below == &_stdscr_panel)
return NULL;
else

View File

@ -1,4 +1,4 @@
.\" $NetBSD: panel_above.3,v 1.4 2015/10/28 10:22:40 wiz Exp $
.\" $NetBSD: panel_above.3,v 1.5 2015/11/01 01:40:23 uwe Exp $
.\"
.\" Copyright (c) 2015 Valery Ushakov
.\" All rights reserved.
@ -61,6 +61,9 @@ For a visible panel its neighbors in the deck can be obtained with
.Fn panel_above
and
.Fn panel_below .
The bottom and the top panels can be obtained by passing them
.Dv NULL
argument.
.Sh IMPLEMENTATION NOTES
The
.Fn top_panel