no more background windows.
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Thu, 5 Apr 1984 15:56:55 +0000 (07:56 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Thu, 5 Apr 1984 15:56:55 +0000 (07:56 -0800)
SCCS-vsn: usr.bin/window/main.c 3.19
SCCS-vsn: usr.bin/window/defs.h 3.12
SCCS-vsn: usr.bin/window/lcmd.c 3.14
SCCS-vsn: usr.bin/window/lcmd1.c 3.18
SCCS-vsn: usr.bin/window/win.c 3.5

usr/src/usr.bin/window/defs.h
usr/src/usr.bin/window/lcmd.c
usr/src/usr.bin/window/lcmd1.c
usr/src/usr.bin/window/main.c
usr/src/usr.bin/window/win.c

index 2d8e8f7..035ed42 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- *     @(#)defs.h      3.11 84/04/05   
+ *     @(#)defs.h      3.12 84/04/05   
  */
 
 #include "ww.h"
  */
 
 #include "ww.h"
@@ -21,10 +21,8 @@ struct ww *cmdwin;           /* the command window */
 struct ww *framewin;           /* the window for framing */
 struct ww *boxwin;             /* the window for the box */
 struct ww *fgwin;              /* the last foreground window */
 struct ww *framewin;           /* the window for framing */
 struct ww *boxwin;             /* the window for the box */
 struct ww *fgwin;              /* the last foreground window */
-struct ww *bgwin;              /* the first background window */
 
 #define isfg(w)                ((w)->ww_order <= fgwin->ww_order)
 
 #define isfg(w)                ((w)->ww_order <= fgwin->ww_order)
-#define isbg(w)                ((w)->ww_order >= bgwin->ww_order)
 
 char *shell;                   /* the shell program */
 char *shellname;               /* the shell program name (for argv[0]) */
 
 char *shell;                   /* the shell program */
 char *shellname;               /* the shell program name (for argv[0]) */
index 4cb8d65..38dcfc1 100644 (file)
@@ -1,12 +1,11 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)lcmd.c      3.13 84/03/29";
+static char *sccsid = "@(#)lcmd.c      3.14 84/04/05";
 #endif
 
 #include "defs.h"
 #include "value.h"
 #include "lcmd.h"
 
 #endif
 
 #include "defs.h"
 #include "value.h"
 #include "lcmd.h"
 
-int l_background();
 int l_buffer();
 int l_close();
 int l_cursormodes();
 int l_buffer();
 int l_close();
 int l_cursormodes();
@@ -21,7 +20,6 @@ int l_unset();
 int l_window();
 int l_write();
 
 int l_window();
 int l_write();
 
-struct lcmd_arg arg_background[];
 struct lcmd_arg arg_buffer[];
 struct lcmd_arg arg_close[];
 struct lcmd_arg arg_cursormodes[];
 struct lcmd_arg arg_buffer[];
 struct lcmd_arg arg_close[];
 struct lcmd_arg arg_cursormodes[];
@@ -38,7 +36,6 @@ struct lcmd_arg arg_write[];
 
 struct lcmd_tab lcmd_tab[] = {
        "%",            1,      l_select,       arg_select,
 
 struct lcmd_tab lcmd_tab[] = {
        "%",            1,      l_select,       arg_select,
-       "background",   2,      l_background,   arg_background,
        "buffer",       2,      l_buffer,       arg_buffer,
        "close",        2,      l_close,        arg_close,
        "cursormodes",  2,      l_cursormodes,  arg_cursormodes,
        "buffer",       2,      l_buffer,       arg_buffer,
        "close",        2,      l_close,        arg_close,
        "cursormodes",  2,      l_cursormodes,  arg_cursormodes,
index 98a8e51..6b6007a 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)lcmd1.c     3.17 84/04/05";
+static char *sccsid = "@(#)lcmd1.c     3.18 84/04/05";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -139,31 +139,7 @@ register struct value *v, *a;
        if (flag == v->v_num)
                return;
        deletewin(w);
        if (flag == v->v_num)
                return;
        deletewin(w);
-       addwin(w, flag ? 0 : 1);
-       reframe();
-}
-
-struct lcmd_arg arg_background[] = {
-       { "window",     1,      ARG_NUM },
-       { "flag",       1,      ARG_ANY },
-       0
-};
-
-l_background(v, a)
-register struct value *v, *a;
-{
-       struct ww *w;
-       char flag;
-
-       if ((w = vtowin(a)) == 0)
-               return;
-       v->v_type = V_NUM;
-       v->v_num = isbg(w);
-       flag = vtobool(++a, 1, v->v_num);
-       if (flag == v->v_num)
-               return;
-       deletewin(w);
-       addwin(w, flag ? 3 : 2);
+       addwin(w, flag);
        reframe();
 }
 
        reframe();
 }
 
index 3d21a1c..c22139b 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)main.c      3.18 84/04/05";
+static char *sccsid = "@(#)main.c      3.19 84/04/05";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -102,7 +102,6 @@ char **argv;
                goto bad;
        }
        fgwin = framewin;
                goto bad;
        }
        fgwin = framewin;
-       bgwin = &wwhead;
 
        wwupdate();
        wwflush();
 
        wwupdate();
        wwflush();
index 61b431d..6e3585f 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)win.c       3.4 84/03/29";
+static char *sccsid = "@(#)win.c       3.5 84/04/05";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -11,12 +11,12 @@ static      char *sccsid = "@(#)win.c       3.4 84/03/29";
  * User windows are the ones with a pty and shell.  Information windows
  * are for displaying error messages, and other information.
  *
  * User windows are the ones with a pty and shell.  Information windows
  * are for displaying error messages, and other information.
  *
- * The windows are stacked in overlapping order and divided into
- * three groups: foreground, normal, and background.  Information
- * windows are always foreground.  User windows can be anywhere.
- * Addwin() adds a window to one of the three groups.
+ * The windows are doubly linked in overlapping order and divided into
+ * two groups: foreground and normal.  Information
+ * windows are always foreground.  User windows can be either.
+ * Addwin() adds a window to the list at the top of one of the two groups.
  * Deletewin() deletes a window.  Front() moves a window to the front
  * Deletewin() deletes a window.  Front() moves a window to the front
- * of its group.  Wwadd() and wwdelete() should never be called
+ * of its group.  Wwopen(), wwadd(), and wwdelete() should never be called
  * directly.
  */
 
  * directly.
  */
 
@@ -48,7 +48,7 @@ char *label;
        if (label != 0 && setlabel(w, label) < 0)
                error("No memory for label.");
        wwcursor(w, 1);
        if (label != 0 && setlabel(w, label) < 0)
                error("No memory for label.");
        wwcursor(w, 1);
-       addwin(w, 1);
+       addwin(w, 0);
        selwin = w;
        reframe();
        wwupdate();
        selwin = w;
        reframe();
        wwupdate();
@@ -110,7 +110,7 @@ char *label;
        w->ww_id = -1;
        w->ww_center = 1;
        (void) setlabel(w, label);
        w->ww_id = -1;
        w->ww_center = 1;
        (void) setlabel(w, label);
-       addwin(w, 0);
+       addwin(w, 1);
        reframe();
        wwupdate();
        return w;
        reframe();
        wwupdate();
        return w;
@@ -126,21 +126,9 @@ struct ww *w;
        reframe();
 }
 
        reframe();
 }
 
-/*
- * Set the current window.
- */
-setselwin(w)
-struct ww *w;
-{
-       if (selwin == w)
-               return;
-       lastselwin = selwin;
-       front(selwin = w, 1);
-}
-
 /*
  * Move the window to the top of its group.
 /*
  * Move the window to the top of its group.
- * Don't do it, if already fully visible.
+ * Don't do it if already fully visible.
  * Wwvisible() doesn't work for tinted windows.
  * But anything to make it faster.
  * Always reframe() if doreframe is true.
  * Wwvisible() doesn't work for tinted windows.
  * But anything to make it faster.
  * Always reframe() if doreframe is true.
@@ -149,52 +137,28 @@ front(w, doreframe)
 register struct ww *w;
 char doreframe;
 {
 register struct ww *w;
 char doreframe;
 {
-       if (isfg(w)) {
-               if (w->ww_back != framewin && !wwvisible(w)) {
-                       deletewin(w);
-                       addwin(w, 0);
-                       doreframe = 1;
-               }
-       } else if (isbg(w)) {
-               if (w != bgwin && !wwvisible(w)) {
-                       deletewin(w);
-                       addwin(w, 3);
-                       doreframe = 1;
-               }
-       } else {
-               if (w->ww_back != fgwin && !wwvisible(w)) {
-                       deletewin(w);
-                       addwin(w, 1);
-                       doreframe = 1;
-               }
+       if (w->ww_back != (isfg(w) ? framewin : fgwin) && !wwvisible(w)) {
+               deletewin(w);
+               addwin(w, isfg(w));
+               doreframe = 1;
        }
        if (doreframe)
                reframe();
 }
 
 /*
        }
        if (doreframe)
                reframe();
 }
 
 /*
- * Add a window at one of four places.
+ * Add a window at the top of normal windows or foreground windows.
  */
  */
-addwin(w, where)
+addwin(w, fg)
 register struct ww *w;
 register struct ww *w;
+char fg;
 {
 {
-       switch (where) {
-       case 0:         /* top of foreground windows */
+       if (fg) {
                wwadd(w, framewin);
                if (fgwin == framewin)
                        fgwin = w;
                wwadd(w, framewin);
                if (fgwin == framewin)
                        fgwin = w;
-               break;
-       case 1:         /* top of normal windows */
+       } else
                wwadd(w, fgwin);
                wwadd(w, fgwin);
-               break;
-       case 2:         /* bottom of normal windows */
-               wwadd(w, bgwin->ww_back);
-               break;
-       case 3:         /* top of background windows */
-               wwadd(w, bgwin->ww_back);
-               bgwin = w;
-               break;
-       }
 }
 
 /*
 }
 
 /*
@@ -203,13 +167,8 @@ register struct ww *w;
 deletewin(w)
 register struct ww *w;
 {
 deletewin(w)
 register struct ww *w;
 {
-       if (isfg(w)) {
-               if (fgwin == w)
-                       fgwin = w->ww_back;
-       } else if (isbg(w)) {
-               if (bgwin == w)
-                       bgwin = w->ww_forw;
-       }
+       if (fgwin == w)
+               fgwin = w->ww_back;
        wwdelete(w);
 }
 
        wwdelete(w);
 }