reorganize window management to allow display routines to set
[unix-history] / usr / src / usr.bin / window / ww.h
index e90e8ae..8866b0f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- *     @(#)ww.h        3.11 83/08/26   
+ *     @(#)ww.h        3.16 83/09/15   
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
@@ -29,26 +29,34 @@ struct ww {
        char ww_mapnl :1;       /* map \n to \r\n */
        char ww_haspty :1;      /* has pty */
        char ww_hascursor :1;   /* has fake cursor */
        char ww_mapnl :1;       /* map \n to \r\n */
        char ww_haspty :1;      /* has pty */
        char ww_hascursor :1;   /* has fake cursor */
+       char ww_hasframe :1;    /* frame it */
        char ww_index;          /* the index, for wwindex[] */
        char ww_order;          /* the overlapping order */
        char ww_index;          /* the index, for wwindex[] */
        char ww_order;          /* the overlapping order */
-       struct ww_dim ww_w;     /* window dimemsions */
-       int ww_nline;           /* size of the buffer */
-       int ww_scroll;          /* where the window is relative to the buffer */
+
+               /* sizes and positions */
+       struct ww_dim ww_w;     /* window size and pos */
+       struct ww_dim ww_b;     /* buffer size and pos */
+       struct ww_dim ww_i;     /* the part inside the screen */
        struct ww_pos ww_cur;   /* the cursor position, relative to ww_w */
        struct ww_pos ww_cur;   /* the cursor position, relative to ww_w */
+
+               /* arrays */
        char **ww_win;          /* the window */
        union ww_char **ww_buf; /* the buffer */
        char **ww_cov;          /* the covered-by array */
        char **ww_fmap;         /* map for frame and box windows */
        short *ww_nvis;         /* how many ww_buf chars are visible per row */
        char **ww_win;          /* the window */
        union ww_char **ww_buf; /* the buffer */
        char **ww_cov;          /* the covered-by array */
        char **ww_fmap;         /* map for frame and box windows */
        short *ww_nvis;         /* how many ww_buf chars are visible per row */
+
+               /* things for the window process */
        int ww_pty;             /* file descriptor of pty */
        int ww_tty;             /* . . . tty */
        int ww_pid;             /* pid of process, if WWS_HASPROC true */
        char ww_ttyname[11];    /* "/dev/ttyp?" */
        int ww_pty;             /* file descriptor of pty */
        int ww_tty;             /* . . . tty */
        int ww_pid;             /* pid of process, if WWS_HASPROC true */
        char ww_ttyname[11];    /* "/dev/ttyp?" */
-       /* below are things for the user */
-       char ww_hasframe :1;    /* frame it */
+
+               /* things for the user, they really don't belong here */
        char ww_center :1;      /* center the label */
        char ww_center :1;      /* center the label */
-       int ww_id;              /* the user id */
+       int ww_id;              /* the user window id */
        char *ww_label;         /* the user supplied label */
        char *ww_label;         /* the user supplied label */
+       struct ww_pos ww_altpos;/* alternate position */
 };
 
 struct ww_tty {
 };
 
 struct ww_tty {
@@ -145,12 +153,12 @@ int wwnwrite, wwnwritec;
 int wwnupdate, wwntouched, wwnmiss;
 
        /* quicky macros */
 int wwnupdate, wwntouched, wwnmiss;
 
        /* quicky macros */
-#define wwcurrow(w)    ((w)->ww_cur.r + (w)->ww_w.t)
-#define wwcurcol(w)    ((w)->ww_cur.c + (w)->ww_w.l)
 #define wwsetcursor(r,c) (wwcursorrow = (r), wwcursorcol = (c))
 #define wwsetcursor(r,c) (wwcursorrow = (r), wwcursorcol = (c))
-#define wwcurtowin(w)  wwsetcursor(wwcurrow(w), wwcurcol(w))
+#define wwcurtowin(w)  wwsetcursor((w)->ww_cur.r, (w)->ww_cur.c)
 #define wwbell()       putchar(CTRL(g))
 #define wwunbox(w)     wwunframe(w)
 #define wwbell()       putchar(CTRL(g))
 #define wwunbox(w)     wwunframe(w)
+#define wwclreol(w,r,c)        wwclreol1((w), (r), (c), 0)
+#define wwredrawwin(w) wwredrawwin1((w), (w)->ww_i.t, (w)->ww_i.b, 0)
 
        /* the window virtual terminal */
 #define WWT_TERM       "TERM=window"
 
        /* the window virtual terminal */
 #define WWT_TERM       "TERM=window"