X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=panel%2Fp_below.c;h=913efa91390bf05fd37f0d6609efdf0ffcd26578;hp=c4b241015f5bfe6df483e70b9aee1fb7b81b5e1d;hb=a20e6eb464be80b9cd8cae7ce925d27fe9c209ed;hpb=55ccd2b959766810cf7db8d1c4462f338ce0afc8 diff --git a/panel/p_below.c b/panel/p_below.c index c4b24101..913efa91 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-2010,2012 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.9 2012/03/10 23:43:41 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)"), (void *)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); }