"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pdcurses/window.c" between
PDCurses-3.8.tar.gz and PDCurses-3.9.tar.gz

About: PDCurses is a multiple platforms curses library implementing most of the functions available in X/Open and System V R4 curses.

window.c  (PDCurses-3.8):window.c  (PDCurses-3.9)
skipping to change at line 34 skipping to change at line 34
void wsyncdown(WINDOW *win); void wsyncdown(WINDOW *win);
WINDOW *resize_window(WINDOW *win, int nlines, int ncols); WINDOW *resize_window(WINDOW *win, int nlines, int ncols);
int wresize(WINDOW *win, int nlines, int ncols); int wresize(WINDOW *win, int nlines, int ncols);
WINDOW *PDC_makelines(WINDOW *win); WINDOW *PDC_makelines(WINDOW *win);
WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx); WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx);
void PDC_sync(WINDOW *win); void PDC_sync(WINDOW *win);
### Description ### Description
newwin() creates a new window with the given number of lines, newwin() creates a new window with the given number of lines, nlines
nlines and columns, ncols. The upper left corner of the window and columns, ncols. The upper left corner of the window is at line
is at line begy, column begx. If nlines is zero, it defaults to begy, column begx. If nlines is zero, it defaults to LINES - begy;
LINES - begy; ncols to COLS - begx. Create a new full-screen ncols to COLS - begx. Create a new full-screen window by calling
window by calling newwin(0, 0, 0, 0). newwin(0, 0, 0, 0).
delwin() deletes the named window, freeing all associated delwin() deletes the named window, freeing all associated memory. In
memory. In the case of overlapping windows, subwindows should be the case of overlapping windows, subwindows should be deleted before
deleted before the main window. the main window.
mvwin() moves the window so that the upper left-hand corner is mvwin() moves the window so that the upper left-hand corner is at
at position (y,x). If the move would cause the window to be off position (y,x). If the move would cause the window to be off the
the screen, it is an error and the window is not moved. Moving screen, it is an error and the window is not moved. Moving subwindows
subwindows is allowed. is allowed.
subwin() creates a new subwindow within a window. The subwin() creates a new subwindow within a window. The dimensions of
dimensions of the subwindow are nlines lines and ncols columns. the subwindow are nlines lines and ncols columns. The subwindow is at
The subwindow is at position (begy, begx) on the screen. This position (begy, begx) on the screen. This position is relative to the
position is relative to the screen, and not to the window orig. screen, and not to the window orig. Changes made to either window
Changes made to either window will affect both. When using this will affect both. When using this routine, you will often need to
routine, you will often need to call touchwin() before calling call touchwin() before calling wrefresh().
wrefresh().
derwin() is the same as subwin(), except that begy and begx are derwin() is the same as subwin(), except that begy and begx are
relative to the origin of the window orig rather than the relative to the origin of the window orig rather than the screen.
screen. There is no difference between subwindows and derived There is no difference between subwindows and derived windows.
windows.
mvderwin() moves a derived window (or subwindow) inside its parent
mvderwin() moves a derived window (or subwindow) inside its window. The screen-relative parameters of the window are not changed.
parent window. The screen-relative parameters of the window are This routine is used to display different parts of the parent window
not changed. This routine is used to display different parts of at the same physical position on the screen.
the parent window at the same physical position on the screen.
dupwin() creates an exact duplicate of the window win. dupwin() creates an exact duplicate of the window win.
wsyncup() causes a touchwin() of all of the window's parents. wsyncup() causes a touchwin() of all of the window's parents.
If wsyncok() is called with a second argument of TRUE, this If wsyncok() is called with a second argument of TRUE, this causes a
causes a wsyncup() to be called every time the window is wsyncup() to be called every time the window is changed.
changed.
wcursyncup() causes the current cursor position of all of a wcursyncup() causes the current cursor position of all of a window's
window's ancestors to reflect the current cursor position of the ancestors to reflect the current cursor position of the current
current window. window.
wsyncdown() causes a touchwin() of the current window if any of wsyncdown() causes a touchwin() of the current window if any of its
its parent's windows have been touched. parent's windows have been touched.
resize_window() allows the user to resize an existing window. It resize_window() allows the user to resize an existing window. It
returns the pointer to the new window, or NULL on failure. returns the pointer to the new window, or NULL on failure.
wresize() is an ncurses-compatible wrapper for resize_window(). wresize() is an ncurses-compatible wrapper for resize_window(). Note
Note that, unlike ncurses, it will NOT process any subwindows of that, unlike ncurses, it will NOT process any subwindows of the
the window. (However, you still can call it _on_ subwindows.) It window. (However, you still can call it _on_ subwindows.) It returns
returns OK or ERR. OK or ERR.
PDC_makenew() allocates all data for a new WINDOW * except the PDC_makenew() allocates all data for a new WINDOW * except the actual
actual lines themselves. If it's unable to allocate memory for lines themselves. If it's unable to allocate memory for the window
the window structure, it will free all allocated memory and structure, it will free all allocated memory and return a NULL
return a NULL pointer. pointer.
PDC_makelines() allocates the memory for the lines. PDC_makelines() allocates the memory for the lines.
PDC_sync() handles wrefresh() and wsyncup() calls when a window PDC_sync() handles wrefresh() and wsyncup() calls when a window is
is changed. changed.
### Return Value ### Return Value
newwin(), subwin(), derwin() and dupwin() return a pointer newwin(), subwin(), derwin() and dupwin() return a pointer to the new
to the new window, or NULL on failure. delwin(), mvwin(), window, or NULL on failure. delwin(), mvwin(), mvderwin() and
mvderwin() and syncok() return OK or ERR. wsyncup(), syncok() return OK or ERR. wsyncup(), wcursyncup() and wsyncdown()
wcursyncup() and wsyncdown() return nothing. return nothing.
### Errors ### Errors
It is an error to call resize_window() before calling initscr(). It is an error to call resize_window() before calling initscr().
Also, an error will be generated if we fail to create a newly Also, an error will be generated if we fail to create a newly sized
sized replacement window for curscr, or stdscr. This could replacement window for curscr, or stdscr. This could happen when
happen when increasing the window size. NOTE: If this happens, increasing the window size. NOTE: If this happens, the previously
the previously successfully allocated windows are left alone; successfully allocated windows are left alone; i.e., the resize is
i.e., the resize is NOT cancelled for those windows. NOT cancelled for those windows.
### Portability ### Portability
X/Open BSD SYS V X/Open ncurses NetBSD
newwin Y Y Y newwin Y Y Y
delwin Y Y Y delwin Y Y Y
mvwin Y Y Y mvwin Y Y Y
subwin Y Y Y subwin Y Y Y
derwin Y - Y derwin Y Y Y
mvderwin Y - Y mvderwin Y Y Y
dupwin Y - 4.0 dupwin Y Y Y
wsyncup Y - 4.0 wsyncup Y Y Y
syncok Y - 4.0 syncok Y Y Y
wcursyncup Y - 4.0 wcursyncup Y Y Y
wsyncdown Y - 4.0 wsyncdown Y Y Y
wresize - Y Y
resize_window - - - resize_window - - -
wresize - - -
PDC_makelines - - - PDC_makelines - - -
PDC_makenew - - - PDC_makenew - - -
PDC_sync - - - PDC_sync - - -
**man-end****************************************************************/ **man-end****************************************************************/
#include <stdlib.h> #include <stdlib.h>
WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx) WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx)
{ {
skipping to change at line 254 skipping to change at line 251
WINDOW *win; WINDOW *win;
PDC_LOG(("newwin() - called:lines=%d cols=%d begy=%d begx=%d\n", PDC_LOG(("newwin() - called:lines=%d cols=%d begy=%d begx=%d\n",
nlines, ncols, begy, begx)); nlines, ncols, begy, begx));
if (!nlines) if (!nlines)
nlines = LINES - begy; nlines = LINES - begy;
if (!ncols) if (!ncols)
ncols = COLS - begx; ncols = COLS - begx;
if (begy + nlines > SP->lines || begx + ncols > SP->cols) if (!SP || begy + nlines > SP->lines || begx + ncols > SP->cols)
return (WINDOW *)NULL; return (WINDOW *)NULL;
win = PDC_makenew(nlines, ncols, begy, begx); win = PDC_makenew(nlines, ncols, begy, begx);
if (win) if (win)
win = PDC_makelines(win); win = PDC_makelines(win);
if (win) if (win)
werase(win); werase(win);
return win; return win;
skipping to change at line 452 skipping to change at line 449
} }
WINDOW *resize_window(WINDOW *win, int nlines, int ncols) WINDOW *resize_window(WINDOW *win, int nlines, int ncols)
{ {
WINDOW *new; WINDOW *new;
int i, save_cury, save_curx, new_begy, new_begx; int i, save_cury, save_curx, new_begy, new_begx;
PDC_LOG(("resize_window() - called: nlines %d ncols %d\n", PDC_LOG(("resize_window() - called: nlines %d ncols %d\n",
nlines, ncols)); nlines, ncols));
if (!win) if (!win || !SP)
return (WINDOW *)NULL; return (WINDOW *)NULL;
if (win->_flags & _SUBPAD) if (win->_flags & _SUBPAD)
{ {
new = subpad(win->_parent, nlines, ncols, win->_begy, win->_begx); new = subpad(win->_parent, nlines, ncols, win->_begy, win->_begx);
if (!new) if (!new)
return (WINDOW *)NULL; return (WINDOW *)NULL;
} }
else if (win->_flags & _SUBWIN) else if (win->_flags & _SUBWIN)
{ {
 End of changes. 14 change blocks. 
69 lines changed or deleted 66 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)