diff --git a/curspriv.h b/curspriv.h index bb8fb3b8..d2bb23f9 100644 --- a/curspriv.h +++ b/curspriv.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: curspriv.h,v 1.112 2006/08/11 19:50:51 wmcbrine Exp $ */ +/* $Id: curspriv.h,v 1.113 2006/08/11 20:59:44 wmcbrine Exp $ */ /* CURSPRIV.H @@ -105,7 +105,7 @@ void PDC_reset_prog_mode(void); void PDC_reset_shell_mode(void); int PDC_resize_screen(int, int); void PDC_restore_screen_mode(int); -int PDC_scr_close(void); +void PDC_scr_close(void); void PDC_scr_exit(void); int PDC_scr_open(int, char **); int PDC_set_ctrl_break(bool); diff --git a/dos/pdcscrn.c b/dos/pdcscrn.c index 45b7866c..abf3a771 100644 --- a/dos/pdcscrn.c +++ b/dos/pdcscrn.c @@ -24,7 +24,7 @@ # include #endif -RCSID("$Id: pdcscrn.c,v 1.41 2006/08/11 19:50:51 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.42 2006/08/11 20:59:44 wmcbrine Exp $"); Regs regs; /* used in various other modules */ @@ -45,11 +45,11 @@ static int saved_cols = 0; This function returns OK on success, otherwise an ERR is returned. Portability: - PDCurses int PDC_scr_close(void); + PDCurses void PDC_scr_close(void); **man-end****************************************************************/ -int PDC_scr_close(void) +void PDC_scr_close(void) { #if SMALL || MEDIUM # ifndef __PACIFIC__ @@ -59,10 +59,8 @@ int PDC_scr_close(void) #endif PDC_LOG(("PDC_scr_close() - called\n")); - if (getenv("PDC_RESTORE_SCREEN") != NULL) + if ((getenv("PDC_RESTORE_SCREEN") != NULL) && (saved_screen != NULL)) { - if (saved_screen == NULL) - return OK; #ifdef __DJGPP__ dosmemput(saved_screen, saved_lines * saved_cols * 2, (unsigned long)_FAR_POINTER(SP->video_seg, @@ -86,7 +84,14 @@ int PDC_scr_close(void) saved_screen = NULL; } - return OK; + reset_shell_mode(); + + if (SP->visibility != 1) + curs_set(1); + + /* Position cursor to the bottom left of the screen. */ + + PDC_gotoyx(PDC_get_rows() - 2, 0); } void PDC_scr_exit(void) diff --git a/os2/pdcscrn.c b/os2/pdcscrn.c index 2b05d5ba..b4e3d908 100644 --- a/os2/pdcscrn.c +++ b/os2/pdcscrn.c @@ -20,7 +20,7 @@ #include #include -RCSID("$Id: pdcscrn.c,v 1.38 2006/08/11 19:50:51 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.39 2006/08/11 20:59:44 wmcbrine Exp $"); #ifdef EMXVIDEO static unsigned char *saved_screen = NULL; @@ -53,11 +53,11 @@ extern int PDC_set_font(int); This function returns OK on success, otherwise an ERR is returned. Portability: - PDCurses int PDC_scr_close(void); + PDCurses void PDC_scr_close(void); **man-end****************************************************************/ -int PDC_scr_close(void) +void PDC_scr_close(void) { char *ptr; @@ -69,10 +69,8 @@ int PDC_scr_close(void) if (DosScanEnv("PDC_RESTORE_SCREEN", (PSZ *)&ptr)) ptr = NULL; #endif - if (ptr != NULL) + if ((ptr != NULL) && (saved_screen != NULL)) { - if (saved_screen == NULL) - return OK; #ifdef EMXVIDEO v_putline(saved_screen, 0, 0, saved_lines * saved_cols); #else @@ -83,7 +81,14 @@ int PDC_scr_close(void) saved_screen = NULL; } - return OK; + reset_shell_mode(); + + if (SP->visibility != 1) + curs_set(1); + + /* Position cursor to the bottom left of the screen. */ + + PDC_gotoyx(PDC_get_rows() - 2, 0); } /*man-start************************************************************** diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index b41e6202..347d305a 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -38,7 +38,7 @@ # undef wnoutrefresh #endif -RCSID("$Id: initscr.c,v 1.68 2006/08/11 19:50:51 wmcbrine Exp $"); +RCSID("$Id: initscr.c,v 1.69 2006/08/11 20:59:44 wmcbrine Exp $"); const char *_curses_notice = "PDCurses 3.0 - Public Domain 2006"; @@ -286,21 +286,6 @@ int endwin(void) PDC_scr_close(); -#if defined(DOS) || defined(OS2) - reset_shell_mode(); -#endif - - if (SP->visibility != 1) - curs_set(1); - - /* Position cursor to the bottom left of the screen. */ - -#ifdef WIN32 - PDC_gotoyx(PDC_get_buffer_rows() - 2, 0); -#else - PDC_gotoyx(PDC_get_rows() - 2, 0); -#endif - SP->alive = FALSE; return OK; diff --git a/win32/pdcscrn.c b/win32/pdcscrn.c index 307df07f..2ebcfc0f 100644 --- a/win32/pdcscrn.c +++ b/win32/pdcscrn.c @@ -24,7 +24,7 @@ #define CURSES_LIBRARY 1 #include -RCSID("$Id: pdcscrn.c,v 1.51 2006/08/11 19:50:51 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.52 2006/08/11 20:59:44 wmcbrine Exp $"); #define PDC_RESTORE_NONE 0 #define PDC_RESTORE_BUFFER 1 @@ -50,11 +50,11 @@ static DWORD dwConsoleMode = 0; This function returns OK on success, otherwise an ERR is returned. Portability: - PDCurses int PDC_scr_close(void); + PDCurses void PDC_scr_close(void); **man-end****************************************************************/ -int PDC_scr_close(void) +void PDC_scr_close(void) { COORD origin; SMALL_RECT rect; @@ -89,13 +89,18 @@ int PDC_scr_close(void) if (!WriteConsoleOutput(hConOut, ciSaveBuffer, orig_scr.dwSize, origin, &rect)) - return ERR; + return; } SetConsoleActiveScreenBuffer(hConOut); SetConsoleMode(hConIn, dwConsoleMode); - return OK; + if (SP->visibility != 1) + curs_set(1); + + /* Position cursor to the bottom left of the screen. */ + + PDC_gotoyx(PDC_get_buffer_rows() - 2, 0); } void PDC_scr_exit(void) diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index 13e5b44e..84c04251 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -17,7 +17,7 @@ #include "pdcx11.h" -RCSID("$Id: pdcscrn.c,v 1.35 2006/08/11 19:50:51 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.36 2006/08/11 20:59:44 wmcbrine Exp $"); /*man-start************************************************************** @@ -32,15 +32,13 @@ RCSID("$Id: pdcscrn.c,v 1.35 2006/08/11 19:50:51 wmcbrine Exp $"); This function returns OK on success, otherwise an ERR is returned. Portability: - PDCurses int PDC_scr_close(void); + PDCurses void PDC_scr_close(void); **man-end****************************************************************/ -int PDC_scr_close(void) +void PDC_scr_close(void) { PDC_LOG(("PDC_scr_close() - called\n")); - - return OK; } void PDC_scr_exit(void)