From a0044ffc69cfe39a3b0b2d208e0952254555afc6 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Fri, 28 Feb 2014 19:18:07 +0000 Subject: Redo import of ncurses 5.9 (stripped). --- panel/p_below.c | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'panel/p_below.c') diff --git a/panel/p_below.c b/panel/p_below.c index c4b241015f5b..f276ef959da5 100644 --- a/panel/p_below.c +++ b/panel/p_below.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,26 +29,57 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997-1999,2008 * ****************************************************************************/ /* p_below.c */ #include "panel.priv.h" -MODULE_ID("$Id: p_below.c,v 1.6 2005/02/19 16:45:10 tom Exp $") +MODULE_ID("$Id: p_below.c,v 1.8 2010/01/23 21:22:15 tom Exp $") +#if NCURSES_SP_FUNCS NCURSES_EXPORT(PANEL *) -panel_below(const PANEL * pan) +ceiling_panel(SCREEN * sp) { - T((T_CALLED("panel_below(%p)"), pan)); - if (!pan) + T((T_CALLED("ceiling_panel(%p)"), sp)); + if (sp) { + struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); + /* if top and bottom are equal, we have no or only the pseudo panel */ returnPanel(EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel); } else { + if (0 == CURRENT_SCREEN) + returnPanel(0); + else + returnPanel(ceiling_panel(CURRENT_SCREEN)); + } +} +#endif + +NCURSES_EXPORT(PANEL *) +panel_below(const PANEL * pan) +{ + PANEL *result; + + T((T_CALLED("panel_below(%p)"), (const void *)pan)); + if (pan) + { + GetHook(pan); /* we must not return the pseudo panel */ - returnPanel(Is_Pseudo(pan->below) ? (PANEL *) 0 : pan->below); + result = Is_Pseudo(pan->below) ? (PANEL *) 0 : pan->below; + } + else + { +#if NCURSES_SP_FUNCS + result = ceiling_panel(CURRENT_SCREEN); +#else + /* if top and bottom are equal, we have no or only the pseudo panel */ + result = EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel; +#endif } + returnPanel(result); } -- cgit v1.2.3