From d86f81a62decb1527235513dc077765b01ea2b74 Mon Sep 17 00:00:00 2001 From: Simon Sobisch Date: Tue, 31 Dec 2024 21:57:09 +0000 Subject: [PATCH] make panel_hidden portable fixing #325 while being a breaking change returning TRUE (1) and FALSE (0) instead of OK (0) and ERR (-1) --- demos/test_pan.c | 4 ---- docs/HISTORY.md | 8 +++++++- pdcurses/panel.c | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/demos/test_pan.c b/demos/test_pan.c index 4e9f1a85..00a78d8a 100644 --- a/demos/test_pan.c +++ b/demos/test_pan.c @@ -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); diff --git a/docs/HISTORY.md b/docs/HISTORY.md index 9bb94f11..b674fe5c 100644 --- a/docs/HISTORY.md +++ b/docs/HISTORY.md @@ -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 @@ -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 --------- @@ -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 =================================== diff --git a/pdcurses/panel.c b/pdcurses/panel.c index 60fb6d1a..4b5b745f 100644 --- a/pdcurses/panel.c +++ b/pdcurses/panel.c @@ -71,7 +71,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 @@ -430,11 +431,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)