Skip to content

Commit 38c7571

Browse files
authored
Merge pull request #326 from Bill-Gray/portable-panel_hidden
make panel_hidden portable, prepare release 4.5.0
2 parents a5f13c2 + fce47cf commit 38c7571

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

curses.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ Defined by this header:
3838
/* NOTE : For version changes that are not backward compatible, */
3939
/* the 'endwin_*' #defines below should be updated. */
4040
#define PDC_VER_MAJOR 4
41-
#define PDC_VER_MINOR 4
41+
#define PDC_VER_MINOR 5
4242
#define PDC_VER_CHANGE 0
4343
#define PDC_VER_YEAR 2024
4444
#define PDC_VER_MONTH 12
45-
#define PDC_VER_DAY 11
45+
#define PDC_VER_DAY 31
4646

4747
#define PDC_STRINGIZE( x) #x
4848
#define PDC_stringize( x) PDC_STRINGIZE( x)

demos/test_pan.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ int main( const int argc, const char **argv)
279279
case 9:
280280
if( curr_top)
281281
{
282-
#ifdef __PDCURSES__
283-
if( panel_hidden( curr_top) == OK)
284-
#else
285-
if( panel_hidden( curr_top) == TRUE)
282+
#if (defined( PDCURSES) && (!defined( __PDCURSESMOD__) || PDC_BUILD < 4500))
283+
if( panel_hidden( curr_top) == OK) /* old, non-standard behavior */
284+
#else
285+
if( panel_hidden( curr_top) == TRUE) /* correct behavior according to SVR4 */
286286
#endif
287287
show_panel( curr_top);
288288
else

docs/HISTORY.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Generally speaking, this history mentions only the more significant
22
changes. See the git log for full details.
33

4-
Current PDCursesMod - 2024 Oct 28
4+
PDCursesMod 4.5.0 - 2024 Dec 31
55
=================================
66

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

57+
- PDC_wcwidth( ) updated from Unicode 14.0.0 to 16.0.0 93e32ef a5f13c2
58+
5759
Bug fixes
5860
---------
5961

@@ -119,6 +121,10 @@ Bug fixes
119121
- Fixes for Borland Turbo C compilation. a59f452e78 26128c29aa
120122
d6b7e998eb
121123

124+
- panel_hidden() is now portable, returning TRUE (1) and FALSE (0) instead
125+
of OK (0) and ERR (-1) This may break existing applications, so you possibly
126+
want to check for the PDCursesMod build (PDC_BUILD < 4500).
127+
122128
PDCursesMod 4.4.0 - 2023 November 30
123129
===================================
124130

pdcurses/panel.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/* PDCurses */
22

3-
#include <curspriv.h>
4-
#include <assert.h>
5-
63
/*man-start**************************************************************
74
85
panel
@@ -71,7 +68,8 @@ panel
7168
7269
ceiling_panel() returns a pointer to the top panel in the deck.
7370
74-
panel_hidden() returns OK if pan is hidden and ERR if it is not.
71+
panel_hidden() returns TRUE if pan is hidden, FALSE if not and
72+
ERR if pan is NULL.
7573
7674
panel_userptr() - Each panel has a user pointer available for
7775
maintaining relevant information. This function returns a pointer to
@@ -100,7 +98,8 @@ panel
10098
10199
Each routine that returns a pointer to an object returns NULL if an
102100
error occurs. Each panel routine that returns an integer, returns OK
103-
if it executes successfully and ERR if it does not.
101+
if it executes successfully and ERR if it does not, with the exception
102+
of panel_hidden returning TRUE/FALSE/ERR.
104103
105104
### Portability
106105
X/Open ncurses NetBSD
@@ -122,14 +121,21 @@ panel
122121
top_panel - Y Y
123122
update_panels - Y Y
124123
124+
Note: Before PDC_BUILD 4500 panel_hidden did not return the expected
125+
values TRUE (1) and FALSE (0), but OK (0) and ERR (-1).
126+
125127
Credits:
126128
Original Author - Warren Tucker <[email protected]>
127129
128130
**man-end****************************************************************/
129131

130-
#include <panel.h>
131132
#include <stdlib.h>
132133

134+
#include <assert.h>
135+
136+
#include "curspriv.h"
137+
#include <panel.h>
138+
133139
struct panel
134140
{
135141
WINDOW *win;
@@ -430,11 +436,10 @@ PANEL *ground_panel( SCREEN *sp)
430436

431437
int panel_hidden(const PANEL *pan)
432438
{
433-
assert( pan);
434439
if (!pan)
435440
return ERR;
436441

437-
return _panel_is_linked(pan) ? ERR : OK;
442+
return _panel_is_linked(pan) ? FALSE : TRUE;
438443
}
439444

440445
const void *panel_userptr(const PANEL *pan)

0 commit comments

Comments
 (0)