diff --git a/curses.h b/curses.h index 7a148d48..fa6c6c66 100644 --- a/curses.h +++ b/curses.h @@ -300,6 +300,17 @@ typedef struct _win /* definition of a window */ int _delayms; /* milliseconds of delay for getch() */ int _parx, _pary; /* coords relative to parent (0,0) */ struct _win *_parent; /* subwin's pointer to parent win */ + + /* these are used only if this is a pad */ + struct pdat + { + int _pad_y; + int _pad_x; + int _pad_top; + int _pad_left; + int _pad_bottom; + int _pad_right; + } _pad; /* Pad-properties structure */ } WINDOW; /* Color pair structure */ diff --git a/curspriv.h b/curspriv.h index a5d1ac44..f3dc43d4 100644 --- a/curspriv.h +++ b/curspriv.h @@ -7,6 +7,10 @@ #define CURSES_LIBRARY #include +#ifdef __cplusplus +extern "C" { +#endif + #if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \ defined(PDC_99) || defined(__WATCOMC__) # ifndef HAVE_VSSCANF @@ -119,4 +123,8 @@ size_t PDC_wcstombs(char *, const wchar_t *, size_t); #define _INBUFSIZ 512 /* size of terminal input buffer */ #define NUNGETCH 256 /* max # chars to ungetch() */ +#ifdef __cplusplus +} +#endif + #endif /* __CURSES_INTERNALS__ */ diff --git a/pdcurses/pad.c b/pdcurses/pad.c index da8e968c..77c233a8 100644 --- a/pdcurses/pad.c +++ b/pdcurses/pad.c @@ -75,11 +75,6 @@ pad #include -/* save values for pechochar() */ - -static int save_pminrow, save_pmincol; -static int save_sminrow, save_smincol, save_smaxrow, save_smaxcol; - WINDOW *newpad(int nlines, int ncols) { WINDOW *win; @@ -96,16 +91,12 @@ WINDOW *newpad(int nlines, int ncols) werase(win); win->_flags = _PAD; - - /* save default values in case pechochar() is the first call to - prefresh(). */ - - save_pminrow = 0; - save_pmincol = 0; - save_sminrow = 0; - save_smincol = 0; - save_smaxrow = min(LINES, nlines) - 1; - save_smaxcol = min(COLS, ncols) - 1; + win->_pad._pad_y = 0; + win->_pad._pad_x = 0; + win->_pad._pad_top = 0; + win->_pad._pad_left = 0; + win->_pad._pad_bottom = min(LINES, nlines) - 1; + win->_pad._pad_right = min(COLS, ncols) - 1; return win; } @@ -151,16 +142,12 @@ WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx) win->_y[i] = orig->_y[begy + i] + begx; win->_flags = _SUBPAD; - - /* save default values in case pechochar() is the first call - to prefresh(). */ - - save_pminrow = 0; - save_pmincol = 0; - save_sminrow = 0; - save_smincol = 0; - save_smaxrow = min(LINES, nlines) - 1; - save_smaxcol = min(COLS, ncols) - 1; + win->_pad._pad_y = 0; + win->_pad._pad_x = 0; + win->_pad._pad_top = 0; + win->_pad._pad_left = 0; + win->_pad._pad_bottom = min(LINES, nlines) - 1; + win->_pad._pad_right = min(COLS, ncols) - 1; return win; } @@ -242,6 +229,13 @@ int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) curscr->_curx = (w->_curx - px) + sx1; } + w->_pad._pad_y = py; + w->_pad._pad_x = px; + w->_pad._pad_top = sy1; + w->_pad._pad_left = sx1; + w->_pad._pad_bottom = sy2; + w->_pad._pad_right = sx2; + return OK; } @@ -252,8 +246,8 @@ int pechochar(WINDOW *pad, chtype ch) if (waddch(pad, ch) == ERR) return ERR; - return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, - save_smincol, save_smaxrow, save_smaxcol); + return prefresh(pad, pad->_pad._pad_y, pad->_pad._pad_x, pad->_pad._pad_top, + pad->_pad._pad_left, pad->_pad._pad_bottom, pad->_pad._pad_right); } #ifdef PDC_WIDE @@ -264,8 +258,8 @@ int pecho_wchar(WINDOW *pad, const cchar_t *wch) if (!wch || (waddch(pad, *wch) == ERR)) return ERR; - return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, - save_smincol, save_smaxrow, save_smaxcol); + return prefresh(pad, pad->_pad._pad_y, pad->_pad._pad_x, pad->_pad._pad_top, + pad->_pad._pad_left, pad->_pad._pad_bottom, pad->_pad._pad_right); } #endif diff --git a/pdcurses/refresh.c b/pdcurses/refresh.c index cc0a25d9..5b36d0fa 100644 --- a/pdcurses/refresh.c +++ b/pdcurses/refresh.c @@ -64,8 +64,16 @@ int wnoutrefresh(WINDOW *win) PDC_LOG(("wnoutrefresh() - called: win=%p\n", win)); - if ( !win || (win->_flags & (_PAD|_SUBPAD)) ) + if (!win) return ERR; + if (is_pad(win)) + return pnoutrefresh(win, + win->_pad._pad_y, + win->_pad._pad_x, + win->_pad._pad_top, + win->_pad._pad_left, + win->_pad._pad_bottom, + win->_pad._pad_right); begy = win->_begy; begx = win->_begx; diff --git a/pdcurses/window.c b/pdcurses/window.c index 2eb294e8..bdeb0d79 100644 --- a/pdcurses/window.c +++ b/pdcurses/window.c @@ -185,6 +185,15 @@ WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx) win->_bmarg = nlines - 1; win->_parx = win->_pary = -1; + /* initialize pad variables*/ + + win->_pad._pad_y = -1; + win->_pad._pad_x = -1; + win->_pad._pad_top = -1; + win->_pad._pad_left = -1; + win->_pad._pad_bottom = -1; + win->_pad._pad_right = -1; + /* init to say window all changed */ touchwin(win); diff --git a/sdl2/pdcdisp.c b/sdl2/pdcdisp.c index a3c27163..1bf6f988 100644 --- a/sdl2/pdcdisp.c +++ b/sdl2/pdcdisp.c @@ -569,7 +569,8 @@ void PDC_pump_and_peep(void) { if (SDL_WINDOWEVENT == event.type && (SDL_WINDOWEVENT_RESTORED == event.window.event || - SDL_WINDOWEVENT_EXPOSED == event.window.event)) + SDL_WINDOWEVENT_EXPOSED == event.window.event || + SDL_WINDOWEVENT_SHOWN == event.window.event)) { SDL_UpdateWindowSurface(pdc_window); rectcount = 0; diff --git a/x11/Makefile.in b/x11/Makefile.in index 6cda7493..2055d947 100644 --- a/x11/Makefile.in +++ b/x11/Makefile.in @@ -57,19 +57,19 @@ SHLFILE = XCurses all: $(PDCLIBS) install: - $(INSTALL) -d -m 755 $(libdir) - $(INSTALL) -d -m 755 $(bindir) - $(INSTALL) -d -m 755 $(includedir) - $(INSTALL) -d -m 755 $(includedir)/xcurses + $(INSTALL) -d -m 755 $(DESTDIR)$(libdir) + $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) + $(INSTALL) -d -m 755 $(DESTDIR)$(includedir) + $(INSTALL) -d -m 755 $(DESTDIR)$(includedir)/xcurses $(INSTALL) -c -m 644 $(PDCURSES_CURSES_H) \ - $(includedir)/xcurses/curses.h + $(DESTDIR)$(includedir)/xcurses/curses.h $(INSTALL) -c -m 644 $(PDCURSES_SRCDIR)/panel.h \ - $(includedir)/xcurses/panel.h - $(INSTALL) -c -m 644 $(osdir)/libXCurses.a $(libdir)/libXCurses.a - -$(RANLIB) $(libdir)/libXCurses.a + $(DESTDIR)$(includedir)/xcurses/panel.h + $(INSTALL) -c -m 644 $(osdir)/libXCurses.a $(DESTDIR)$(libdir)/libXCurses.a + -$(RANLIB) $(DESTDIR)$(libdir)/libXCurses.a -$(INSTALL) -c -m 755 $(osdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) \ - $(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) - $(INSTALL) -c -m 755 $(osdir)/xcurses-config $(bindir)/xcurses-config + $(DESTDIR)$(libdir)/$(SHLPRE)$(SHLFILE)$(SHLPST) + $(INSTALL) -c -m 755 $(osdir)/xcurses-config $(DESTDIR)$(bindir)/xcurses-config clean: -rm -rf *.o *.sho trace $(PDCLIBS) $(DEMOS) config.log \