X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=panel%2Fp_below.c;h=100393d53a729fe13e7b717adb2bf52545f3eb9b;hp=c4b241015f5bfe6df483e70b9aee1fb7b81b5e1d;hb=a6eb34d7fec8170a8715f9e53ca2f96452dd30dd;hpb=55ccd2b959766810cf7db8d1c4462f338ce0afc8 diff --git a/panel/p_below.c b/panel/p_below.c index c4b24101..100393d5 100644 --- a/panel/p_below.c +++ b/panel/p_below.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 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 +30,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.11 2020/05/24 01:40:20 anonymous.maarten Exp $") -NCURSES_EXPORT(PANEL *) -panel_below(const PANEL * pan) +#if NCURSES_SP_FUNCS +PANEL_EXPORT(PANEL *) +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 + +PANEL_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); }