Skip to content

Commit

Permalink
make panel_hidden portable
Browse files Browse the repository at this point in the history
fixing #325 while being a breaking change returning TRUE (1) and FALSE (0) instead of OK (0) and ERR (-1)

version constants increased, now at 4.5.0
  • Loading branch information
GitMensch committed Jan 1, 2025
1 parent a5f13c2 commit 1917450
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Defined by this header:
/* NOTE : For version changes that are not backward compatible, */
/* the 'endwin_*' #defines below should be updated. */
#define PDC_VER_MAJOR 4
#define PDC_VER_MINOR 4
#define PDC_VER_MINOR 5
#define PDC_VER_CHANGE 0
#define PDC_VER_YEAR 2024
#define PDC_VER_MONTH 12
#define PDC_VER_DAY 11
#define PDC_VER_DAY 31

#define PDC_STRINGIZE( x) #x
#define PDC_stringize( x) PDC_STRINGIZE( x)
Expand Down
4 changes: 0 additions & 4 deletions demos/test_pan.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,7 @@ int main( const int argc, const char **argv)
case 9:
if( curr_top)
{
#ifdef __PDCURSES__
if( panel_hidden( curr_top) == OK)
#else
if( panel_hidden( curr_top) == TRUE)
#endif
show_panel( curr_top);
else
hide_panel( curr_top);
Expand Down
8 changes: 7 additions & 1 deletion docs/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Generally speaking, this history mentions only the more significant
changes. See the git log for full details.

Current PDCursesMod - 2024 Oct 28
Current PDCursesMod - 2024 Dec 31
=================================

Major new features
Expand Down Expand Up @@ -54,6 +54,8 @@ Minor new features
arbitrarily long strings via recursion. Added some code to test this
in 'show_col.c'. 3f8dfa9e06 18ef78de69

- PDC_wcwidth( ) updated from Unicode 14.0.0 to 16.0.0 93e32ef a5f13c2

Bug fixes
---------

Expand Down Expand Up @@ -119,6 +121,10 @@ Bug fixes
- Fixes for Borland Turbo C compilation. a59f452e78 26128c29aa
d6b7e998eb

- panel_hidden() is now portable, returning TRUE (1) and FALSE (0) instead
of OK (0) and ERR (-1) This may break existing applications, so you possibly
want to check for the PDCurses version number / date.

PDCursesMod 4.4.0 - 2023 November 30
===================================

Expand Down
21 changes: 13 additions & 8 deletions pdcurses/panel.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* PDCurses */

#include <curspriv.h>
#include <assert.h>

/*man-start**************************************************************
panel
Expand Down Expand Up @@ -71,7 +68,8 @@ panel
ceiling_panel() returns a pointer to the top panel in the deck.
panel_hidden() returns OK if pan is hidden and ERR if it is not.
panel_hidden() returns TRUE if pan is hidden, FALSE if not and
ERR if pan is NULL.
panel_userptr() - Each panel has a user pointer available for
maintaining relevant information. This function returns a pointer to
Expand Down Expand Up @@ -100,7 +98,8 @@ panel
Each routine that returns a pointer to an object returns NULL if an
error occurs. Each panel routine that returns an integer, returns OK
if it executes successfully and ERR if it does not.
if it executes successfully and ERR if it does not, with the exception
of panel_hidden returning TRUE/FALSE/ERR.
### Portability
X/Open ncurses NetBSD
Expand All @@ -122,14 +121,21 @@ panel
top_panel - Y Y
update_panels - Y Y
Note: Before PDC_BUILD 4500 panel_hidden did not return the expected
values TRUE (1) and FALSE (0), but OK (0) and ERR (-1).
Credits:
Original Author - Warren Tucker <[email protected]>
**man-end****************************************************************/

#include <panel.h>
#include <stdlib.h>

#include <assert.h>

#include "curspriv.h"
#include <panel.h>

struct panel
{
WINDOW *win;
Expand Down Expand Up @@ -430,11 +436,10 @@ PANEL *ground_panel( SCREEN *sp)

int panel_hidden(const PANEL *pan)
{
assert( pan);
if (!pan)
return ERR;

return _panel_is_linked(pan) ? ERR : OK;
return _panel_is_linked(pan) ? FALSE : TRUE;
}

const void *panel_userptr(const PANEL *pan)
Expand Down

0 comments on commit 1917450

Please sign in to comment.