/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright 2020 Thomas E. Dickey *
+ * Copyright 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 *
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_hide.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_hide.c,v 1.14 2020/09/26 18:02:35 tom Exp $")
-/*+-------------------------------------------------------------------------
- __panel_unlink(pan) - unlink panel from stack
---------------------------------------------------------------------------*/
-static void
-__panel_unlink(PANEL *pan)
+PANEL_EXPORT(int)
+hide_panel(register PANEL * pan)
{
- PANEL *prev;
- PANEL *next;
+ int err = ERR;
-#ifdef TRACE
- dStack("<u%d>",1,pan);
- if(!_nc_panel_is_linked(pan))
- return;
-#endif
+ T((T_CALLED("hide_panel(%p)"), (void *)pan));
- _nc_override(pan,P_TOUCH);
- _nc_free_obscure(pan);
+ if (pan)
+ {
+ GetHook(pan);
- prev = pan->below;
- next = pan->above;
+ dBug(("--> hide_panel %s", USER_PTR(pan->user, 1)));
+ dStack("<u%d>", 1, pan);
- if(prev)
- { /* if non-zero, we will not update the list head */
- prev->above = next;
- if(next)
- next->below = prev;
- }
- else if(next)
- next->below = prev;
- if(pan == _nc_bottom_panel)
- _nc_bottom_panel = next;
- if(pan == _nc_top_panel)
- _nc_top_panel = prev;
+ HIDE_PANEL(pan, err, ERR);
- _nc_calculate_obscure();
+ err = OK;
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
- dStack("<u%d>",9,pan);
-}
-
-int
-hide_panel(register PANEL *pan)
-{
- if(!pan)
- return(ERR);
-
- dBug(("--> hide_panel %s", USER_PTR(pan->user)));
-
- if(!_nc_panel_is_linked(pan))
- {
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
- return(ERR);
+ dStack("<u%d>", 9, pan);
}
-
- __panel_unlink(pan);
- return(OK);
+ returnCode(err);
}