Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpanel panel_below(NULL) returns the top panel.



details:   https://anonhg.NetBSD.org/src/rev/d87b0d973a2a
branches:  trunk
changeset: 811485:d87b0d973a2a
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sun Nov 01 01:40:23 2015 +0000

description:
panel_below(NULL) returns the top panel.
panel_above(NULL) returns the bottom panel.

diffstat:

 lib/libpanel/above.c       |  12 ++++++++----
 lib/libpanel/below.c       |  14 +++++++-------
 lib/libpanel/panel_above.3 |   5 ++++-
 3 files changed, 19 insertions(+), 12 deletions(-)

diffs (89 lines):

diff -r 9ed8ace1f680 -r d87b0d973a2a lib/libpanel/above.c
--- a/lib/libpanel/above.c      Sat Oct 31 20:13:45 2015 +0000
+++ b/lib/libpanel/above.c      Sun Nov 01 01:40:23 2015 +0000
@@ -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_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;
diff -r 9ed8ace1f680 -r d87b0d973a2a lib/libpanel/below.c
--- a/lib/libpanel/below.c      Sat Oct 31 20:13:45 2015 +0000
+++ b/lib/libpanel/below.c      Sun Nov 01 01:40:23 2015 +0000
@@ -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;
 
-       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
diff -r 9ed8ace1f680 -r d87b0d973a2a lib/libpanel/panel_above.3
--- a/lib/libpanel/panel_above.3        Sat Oct 31 20:13:45 2015 +0000
+++ b/lib/libpanel/panel_above.3        Sun Nov 01 01:40:23 2015 +0000
@@ -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 @@
 .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



Home | Main Index | Thread Index | Old Index