Skip to content

Commit

Permalink
Some ncurses extensions for opaque WINDOW structs. See wmcbrine/PDCur…
Browse files Browse the repository at this point in the history
…ses#106.  More commits to come for the remaining functions.
  • Loading branch information
uhlin authored and Bill-Gray committed Nov 18, 2022
1 parent 8d40c3a commit 22fecc1
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion pdcurses/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ window
WINDOW *subwin(WINDOW* orig, int nlines, int ncols,
int begy, int begx);
WINDOW *dupwin(WINDOW *win);
WINDOW *wgetparent(const WINDOW *win);
int delwin(WINDOW *win);
int mvwin(WINDOW *win, int y, int x);
int mvderwin(WINDOW *win, int pary, int parx);
int syncok(WINDOW *win, bool bf);
bool is_subwin(const WINDOW *win);
bool is_syncok(const WINDOW *win);
void wsyncup(WINDOW *win);
void wcursyncup(WINDOW *win);
void wsyncdown(WINDOW *win);
Expand Down Expand Up @@ -62,11 +65,19 @@ window
dupwin() creates an exact duplicate of the window win.
wgetparent() returns the parent WINDOW pointer for subwindows, or NULL
for windows having no parent.
wsyncup() causes a touchwin() of all of the window's parents.
If wsyncok() is called with a second argument of TRUE, this causes a
If syncok() is called with a second argument of TRUE, this causes a
wsyncup() to be called every time the window is changed.
is_subwin() reports whether the specified window is a subwindow,
created by subwin() or derwin().
is_syncok() reports whether the specified window is in syncok mode.
wcursyncup() causes the current cursor position of all of a window's
ancestors to reflect the current cursor position of the current
window.
Expand Down Expand Up @@ -107,8 +118,11 @@ window
derwin Y Y Y
mvderwin Y Y Y
dupwin Y Y Y
wgetparent - Y -
wsyncup Y Y Y
syncok Y Y Y
is_subwin - Y -
is_syncok - Y -
wcursyncup Y Y Y
wsyncdown Y Y Y
wresize - Y Y
Expand Down Expand Up @@ -462,6 +476,17 @@ WINDOW *dupwin(WINDOW *win)
return new_win;
}

WINDOW *wgetparent(const WINDOW *win)
{
PDC_LOG(("wgetparent() - called\n"));

assert( win);
if (!win)
return NULL;

return win->_parent;
}

WINDOW *resize_window(WINDOW *win, int nlines, int ncols)
{
WINDOW *new_win;
Expand Down Expand Up @@ -578,6 +603,28 @@ int syncok(WINDOW *win, bool bf)
return OK;
}

bool is_subwin(const WINDOW *win)
{
PDC_LOG(("is_subwin() - called\n"));

assert( win);
if (!win)
return FALSE;

return ((win->_flags & _SUBWIN) ? TRUE : FALSE);
}

bool is_syncok(const WINDOW *win)
{
PDC_LOG(("is_syncok() - called\n"));

assert( win);
if (!win)
return FALSE;

return win->_sync;
}

void wcursyncup(WINDOW *win)
{
WINDOW *tmp;
Expand Down

0 comments on commit 22fecc1

Please sign in to comment.