Module Name: src
Committed By: uwe
Date: Sun Nov 1 01:40:23 UTC 2015
Modified Files:
src/lib/libpanel: above.c below.c panel_above.3
Log Message:
panel_below(NULL) returns the top panel.
panel_above(NULL) returns the bottom panel.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libpanel/above.c src/lib/libpanel/below.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libpanel/panel_above.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libpanel/above.c
diff -u src/lib/libpanel/above.c:1.1 src/lib/libpanel/above.c:1.2
--- src/lib/libpanel/above.c:1.1 Mon Oct 26 23:09:49 2015
+++ src/lib/libpanel/above.c Sun Nov 1 01:40:23 2015
@@ -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;
Index: src/lib/libpanel/below.c
diff -u src/lib/libpanel/below.c:1.1 src/lib/libpanel/below.c:1.2
--- src/lib/libpanel/below.c:1.1 Mon Oct 26 23:09:49 2015
+++ src/lib/libpanel/below.c Sun Nov 1 01:40:23 2015
@@ -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))
- return NULL;
-
- if (__predict_false(PANEL_HIDDEN(p)))
+ if (p == NULL)
+ below = TAILQ_LAST(&_deck, deck);
+ else if (__predict_true(!PANEL_HIDDEN(p)))
+ below = PANEL_BELOW(p);
+ else
return NULL;
- below = PANEL_BELOW(p);
if (below == &_stdscr_panel)
return NULL;
else
Index: src/lib/libpanel/panel_above.3
diff -u src/lib/libpanel/panel_above.3:1.4 src/lib/libpanel/panel_above.3:1.5
--- src/lib/libpanel/panel_above.3:1.4 Wed Oct 28 10:22:40 2015
+++ src/lib/libpanel/panel_above.3 Sun Nov 1 01:40:23 2015
@@ -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
.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