Back to index

tetex-bin  3.0
Functions
lib_window.c File Reference
#include <curses.priv.h>

Go to the source code of this file.

Functions

 _nc_synchook (WINDOW *win)
 mvderwin (WINDOW *win, int y, int x)
 syncok (WINDOW *win, bool bf)
 wsyncup (WINDOW *win)
 wsyncdown (WINDOW *win)
 wcursyncup (WINDOW *win)
 dupwin (WINDOW *win)

Function Documentation

_nc_synchook ( WINDOW win)

Definition at line 45 of file lib_window.c.

{
    if (win->_immed)
       wrefresh(win);
    if (win->_sync)
       wsyncup(win);
}

Here is the call graph for this function:

Here is the caller graph for this function:

dupwin ( WINDOW win)

Definition at line 178 of file lib_window.c.

{
    WINDOW *nwin = 0;
    size_t linesize;
    int i;

    T((T_CALLED("dupwin(%p)"), win));

    if (win != 0) {

       if (win->_flags & _ISPAD) {
           nwin = newpad(win->_maxy + 1,
                       win->_maxx + 1);
       } else {
           nwin = newwin(win->_maxy + 1,
                       win->_maxx + 1,
                       win->_begy,
                       win->_begx);
       }

       if (nwin != 0) {

           nwin->_curx = win->_curx;
           nwin->_cury = win->_cury;
           nwin->_maxy = win->_maxy;
           nwin->_maxx = win->_maxx;
           nwin->_begy = win->_begy;
           nwin->_begx = win->_begx;
           nwin->_yoffset = win->_yoffset;

           nwin->_flags = win->_flags & ~_SUBWIN;
           /* Due to the use of newwin(), the clone is not a subwindow.
            * The text is really copied into the clone.
            */

           nwin->_attrs = win->_attrs;
           nwin->_nc_bkgd = win->_nc_bkgd;

           nwin->_notimeout = win->_notimeout;
           nwin->_clear = win->_clear;
           nwin->_leaveok = win->_leaveok;
           nwin->_scroll = win->_scroll;
           nwin->_idlok = win->_idlok;
           nwin->_idcok = win->_idcok;
           nwin->_immed = win->_immed;
           nwin->_sync = win->_sync;
           nwin->_use_keypad = win->_use_keypad;
           nwin->_delay = win->_delay;

           nwin->_parx = 0;
           nwin->_pary = 0;
           nwin->_parent = (WINDOW *) 0;
           /* See above: the clone isn't a subwindow! */

           nwin->_regtop = win->_regtop;
           nwin->_regbottom = win->_regbottom;

           if (win->_flags & _ISPAD)
              nwin->_pad = win->_pad;

           linesize = (win->_maxx + 1) * sizeof(NCURSES_CH_T);
           for (i = 0; i <= nwin->_maxy; i++) {
              memcpy(nwin->_line[i].text, win->_line[i].text, linesize);
              nwin->_line[i].firstchar = win->_line[i].firstchar;
              nwin->_line[i].lastchar = win->_line[i].lastchar;
           }
       }
    }
    returnWin(nwin);
}

Here is the call graph for this function:

Here is the caller graph for this function:

mvderwin ( WINDOW win,
int  y,
int  x 
)

Definition at line 55 of file lib_window.c.

{
    WINDOW *orig;
    int i;

    T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x));

    if (win && (orig = win->_parent)) {
       if (win->_parx == x && win->_pary == y)
           returnCode(OK);
       if (x < 0 || y < 0)
           returnCode(ERR);
       if ((x + getmaxx(win) > getmaxx(orig)) ||
           (y + getmaxy(win) > getmaxy(orig)))
           returnCode(ERR);
    } else
       returnCode(ERR);
    wsyncup(win);
    win->_parx = x;
    win->_pary = y;
    for (i = 0; i < getmaxy(win); i++)
       win->_line[i].text = &(orig->_line[y++].text[x]);
    returnCode(OK);
}

Here is the call graph for this function:

Here is the caller graph for this function:

syncok ( WINDOW win,
bool  bf 
)

Definition at line 82 of file lib_window.c.

{
    T((T_CALLED("syncok(%p,%d)"), win, bf));

    if (win) {
       win->_sync = bf;
       returnCode(OK);
    } else
       returnCode(ERR);
}
wcursyncup ( WINDOW win)

Definition at line 165 of file lib_window.c.

{
    WINDOW *wp;

    T((T_CALLED("wcursyncup(%p)"), win));
    for (wp = win; wp && wp->_parent; wp = wp->_parent) {
       wmove(wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx);
    }
    returnVoid;
}

Here is the call graph for this function:

wsyncdown ( WINDOW win)

Definition at line 127 of file lib_window.c.

{
    T((T_CALLED("wsyncdown(%p)"), win));

    if (win && win->_parent) {
       WINDOW *pp = win->_parent;
       int y;

       /* This recursion guarantees, that the changes are propagated down-
          wards from the root to our direct parent. */
       wsyncdown(pp);

       /* and now we only have to propagate the changes from our direct
          parent, if there are any. */
       assert((win->_pary <= pp->_maxy) &&
              ((win->_pary + win->_maxy) <= pp->_maxy));

       for (y = 0; y <= win->_maxy; y++) {
           if (pp->_line[win->_pary + y].firstchar >= 0) {     /* parent changed */
              struct ldat *line = &(win->_line[y]);
              /* left and right character in child coordinates */
              int left = pp->_line[win->_pary + y].firstchar - win->_parx;
              int right = pp->_line[win->_pary + y].lastchar - win->_parx;
              /* The change maybe outside the childs range */
              if (left < 0)
                  left = 0;
              if (right > win->_maxx)
                  right = win->_maxx;
              CHANGED_RANGE(line, left, right);
           }
       }
    }
    returnVoid;
}

Here is the call graph for this function:

Here is the caller graph for this function:

wsyncup ( WINDOW win)

Definition at line 95 of file lib_window.c.

{
    WINDOW *wp;

    T((T_CALLED("wsyncup(%p)"), win));
    if (win && win->_parent) {
       for (wp = win; wp->_parent; wp = wp->_parent) {
           int y;
           WINDOW *pp = wp->_parent;

           assert((wp->_pary <= pp->_maxy) &&
                 ((wp->_pary + wp->_maxy) <= pp->_maxy));

           for (y = 0; y <= wp->_maxy; y++) {
              int left = wp->_line[y].firstchar;
              if (left >= 0) {     /* line is touched */
                  struct ldat *line = &(pp->_line[wp->_pary + y]);
                  /* left & right character in parent window coordinates */
                  int right = wp->_line[y].lastchar + wp->_parx;
                  left += wp->_parx;

                  CHANGED_RANGE(line, left, right);
              }
           }
       }
    }
    returnVoid;
}

Here is the call graph for this function:

Here is the caller graph for this function: