]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - panel/p_show.c
ncurses 6.2 - patch 20200926
[ncurses.git] / panel / p_show.c
index d129fd50715b35355ba9718aed55cef82149ed0c..0c973dbeaf6640b0ce74132992a96900689ad958 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
 /****************************************************************************
- * 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            *
  *                                                                          *
  * 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"
 
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_show.c,v 1.5 1999/09/29 15:22:32 juergen Exp $")
+MODULE_ID("$Id: p_show.c,v 1.16 2020/09/26 18:02:35 tom Exp $")
 
 
-static void
-panel_link_top(PANEL *pan)
+PANEL_EXPORT(int)
+show_panel(PANEL * pan)
 {
 {
-#ifdef TRACE
-  dStack("<lt%d>",1,pan);
-  if(_nc_panel_is_linked(pan))
-    return;
-#endif
+  int err = ERR;
 
 
-  assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
+  T((T_CALLED("show_panel(%p)"), (void *)pan));
 
 
-  pan->above = (PANEL *)0;
-  pan->below = (PANEL *)0;
-  
-  _nc_top_panel->above = pan;
-  pan->below = _nc_top_panel;  
-  _nc_top_panel = pan;
-  
-  dStack("<lt%d>",9,pan);
-}
+  if (pan)
+    {
+      GetHook(pan);
 
 
-int
-show_panel(PANEL *pan)
-{
-  if(!pan)
-    return(ERR);
+      if (Is_Top(pan))
+       returnCode(OK);
+
+      dBug(("--> show_panel %s", USER_PTR(pan->user, 1)));
 
 
-  if (Is_Top(pan))
-    return(OK);
+      HIDE_PANEL(pan, err, OK);
 
 
-  dBug(("--> show_panel %s", USER_PTR(pan->user)));
+      dStack("<lt%d>", 1, pan);
+      assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
 
 
-  if(_nc_panel_is_linked(pan))
-    (void)hide_panel(pan);
+      _nc_top_panel->above = pan;
+      pan->below = _nc_top_panel;
+      pan->above = (PANEL *) 0;
+      _nc_top_panel = pan;
 
 
-  panel_link_top(pan);
+      err = OK;
 
 
-  return(OK);
+      dStack("<lt%d>", 9, pan);
+    }
+  returnCode(err);
 }
 }