v01i025: screen blanking mgr diffs, Part01/01

David B. Thomas dt at yenta.alb.nm.us
Thu May 30 12:28:11 AEST 1991


Submitted-by: dt at yenta.alb.nm.us (David B. Thomas)
Posting-number: Volume 1, Issue 25
Archive-name: mgr_hack1/part01

[ moderators note - this is not a shell archive file, just a straight patch ]
[ file.  should I have repacked it into a shar file?                        ]

Okay!  At long last, here are the diffs to mgr to add two new capabilities:

1. If NOSTARTREK is defined at compile time, the startrek demo is
not compiled in, significantly reducing the size of the executable
and not hogging cpu if you have mgr start unattended.

2. If BLANKING is defined at compile time, the screen will blank auto-
matically if no keyboard or mouse activity occurs for five minutes.
Also, "blank screen now" has been added to the main menu.  The blanking
behavior can be changed by sending escape codes to any window as follows:

<esc><num>*	blank after <num> seconds (must be positive)
		warning: very short times can cause problems.
<esc>0*		blank screen now -- does not affect blanking interval
<esc>-1*	set blanking interval to infinity (disables blanking)

The way I coded things, the screen will wake up if the mouse is moved, or
if a keypress is detected.  The keypress is not removed from the input stream.
Also, the screen will wake up if any window exposes itself, is created, is
destroyed, or beeps.  Ordinary output to a window does not wake the screen,
so you can keep that clock program :-)

						little david

*** Makefile.old	Sat Mar 30 12:17:49 1991
--- Makefile	Wed May  8 20:13:17 1991
***************
*** 41,46
  #
  #	  XMENU		extended menu stuff (experimental)
  #
  #	bitblit libraries
  #
  LIBS=blit oblit pixrect stub_lib port

--- 41,50 -----
  #
  #	  XMENU		extended menu stuff (experimental)
  #
+ #	  NOSTARTREK	suppress cpu-hogging copyright message at startup
+ #
+ #	  BLANKING	screen auto blanking
+ #
  #	bitblit libraries
  #
  LIBS=blit oblit pixrect stub_lib port
***************
*** 140,146
  ############################################################################
  # 3b1 mgr, using portable bit blit code.
  3b1:
! 	$(MAKE) DSAME="-DVI -DBUCKEY -DDEBUG -DKILL -DCUT -DSYSV -DWHO -DBBB1" \
  		INSROOT=$(INSROOT) \
  		DDEP= \
  		MACHDEP_C= MACHDEP_H= MACHDEP_O= \

--- 144,151 -----
  ############################################################################
  # 3b1 mgr, using portable bit blit code.
  3b1:
! 	$(MAKE) DSAME="-DVI -DBUCKEY -DDEBUG -DKILL -DCUT -DSYSV -DWHO \
! 			-DBBB1 -DNOSTARTREK -DBLANKING" \
  		INSROOT=$(INSROOT) \
  		DDEP= \
  		MACHDEP_C= MACHDEP_H= MACHDEP_O= \
*** copyright.c.ol	Sat Apr  6 10:54:22 1991
--- copyright.c	Sat Apr  6 10:55:09 1991
***************
*** 10,15
  */
  static char	RCSid_[] = "$Source: /m1/mgr.new/src/RCS/copyright.c,v $$Revision: 1.1 $";
  
  /* flash a copyright notice at Mgr startup */
  
  #ifdef SYSV

--- 10,17 -----
  */
  static char	RCSid_[] = "$Source: /m1/mgr.new/src/RCS/copyright.c,v $$Revision: 1.1 $";
  
+ #ifndef NOSTARTREK
+ 
  /* flash a copyright notice at Mgr startup */
  
  #ifdef SYSV
***************
*** 287,289
     *x = tempx;
     *y = tempy;
  }

--- 289,293 -----
     *x = tempx;
     *y = tempy;
  }
+ 
+ #endif /* ifndef NOSTARTREK */
*** data.c.old	Sat Mar 30 12:17:28 1991
--- data.c	Tue May 14 23:19:13 1991
***************
*** 54,59
  char *main_menu[] = {		/* primary menu */
     "new window",
     "redraw",
     "quit",
     (char *) 0};
  

--- 54,62 -----
  char *main_menu[] = {		/* primary menu */
     "new window",
     "redraw",
+ #ifdef BLANKING
+    "blank screen",
+ #endif
     "quit",
     (char *) 0};
  
***************
*** 59,64
  
  char *full_menu[] = {		/* primary menu  - no more windows allowed */
     "redraw",
     "quit",
     (char *) 0};
  

--- 62,70 -----
  
  char *full_menu[] = {		/* primary menu  - no more windows allowed */
     "redraw",
+ #ifdef BLANKING
+    "blank screen",
+ #endif
     "quit",
     (char *) 0};
  
***************
*** 80,85
  #ifdef CUT
  int cut(), paste();
  #endif
  
  function main_functions[] = {
     new_window,

--- 86,94 -----
  #ifdef CUT
  int cut(), paste();
  #endif
+ #ifdef BLANKING
+ int blank();
+ #endif
  
  function main_functions[] = {
     new_window,
***************
*** 84,89
  function main_functions[] = {
     new_window,
     redraw,
     quit,
     (function) 0 };
  

--- 93,101 -----
  function main_functions[] = {
     new_window,
     redraw,
+ #ifdef BLANKING
+    blank,
+ #endif
     quit,
     (function) 0 };
  
***************
*** 89,94
  
  function full_functions[] = {
     redraw,
     quit,
     (function) 0 };
  

--- 101,109 -----
  
  function full_functions[] = {
     redraw,
+ #ifdef BLANKING
+    blank,
+ #endif
     quit,
     (function) 0 };
  
*** mgr.c.old	Sat Apr  6 10:47:14 1991
--- mgr.c	Wed May 15 23:19:42 1991
***************
*** 31,36
  #ifndef Min
  #define Min(x,y)		((x)>(y)?(y):(x))
  #endif
  #define POLL(poll)		(poll&mask ? &set_poll : (struct timeval *) 0)
  
  #ifdef sun

--- 31,48 -----
  #ifndef Min
  #define Min(x,y)		((x)>(y)?(y):(x))
  #endif
+ 
+ #ifdef BLANKING
+ # ifndef BLANKTIME
+ #  define BLANKTIME 300
+ # endif
+ /* at a minimum, wake up every BLANKTIME seconds */
+ struct timeval blank_poll = { BLANKTIME, 0 };
+ char	blanked = 0;
+ long	lasttouch = 0;
+ struct timeval *pollptr = &blank_poll;
+ #define POLL(poll)		(poll&mask ? &set_poll : pollptr)
+ #else /* BLANKING */
  #define POLL(poll)		(poll&mask ? &set_poll : (struct timeval *) 0)
  #endif /* BLANKING */
  
***************
*** 32,37
  #define Min(x,y)		((x)>(y)?(y):(x))
  #endif
  #define POLL(poll)		(poll&mask ? &set_poll : (struct timeval *) 0)
  
  #ifdef sun
  struct timeval set_poll = {

--- 44,50 -----
  #define POLL(poll)		(poll&mask ? &set_poll : pollptr)
  #else /* BLANKING */
  #define POLL(poll)		(poll&mask ? &set_poll : (struct timeval *) 0)
+ #endif /* BLANKING */
  
  #if defined(sun) || defined(BBB1)
  struct timeval set_poll = {
***************
*** 33,39
  #endif
  #define POLL(poll)		(poll&mask ? &set_poll : (struct timeval *) 0)
  
! #ifdef sun
  struct timeval set_poll = {
     (long) 0, (long) POLL_INT
     };				/* set select to poll */

--- 46,52 -----
  #define POLL(poll)		(poll&mask ? &set_poll : (struct timeval *) 0)
  #endif /* BLANKING */
  
! #if defined(sun) || defined(BBB1)
  struct timeval set_poll = {
     (long) 0, (long) POLL_INT
     };				/* set select to poll */
***************
*** 38,48
     (long) 0, (long) POLL_INT
     };				/* set select to poll */
  #endif
! #ifdef BBB1
! struct timeval set_poll = {
!    (long) 0, (long) POLL_INT
!    };				/* set select to poll */
! #endif
  #ifdef NOSELECT
  unsigned char keyboard_to = 1;  /* 1 tenth second time out on keyboard reads*/
  #endif

--- 51,57 -----
     (long) 0, (long) POLL_INT
     };				/* set select to poll */
  #endif
! 
  #ifdef NOSELECT
  unsigned char keyboard_to = 1;  /* 1 tenth second time out on keyboard reads*/
  #endif
***************
*** 50,55
  char *mouse_dev = MOUSE_DEV;		/* name of mouse device */
  static int bitmaptype = 1;			/* old, non portable bitmap format */
  
  main(argc,argv)
  int argc;
  char **argv;

--- 59,65 -----
  char *mouse_dev = MOUSE_DEV;		/* name of mouse device */
  static int bitmaptype = 1;			/* old, non portable bitmap format */
  
+ 
  main(argc,argv)
  int argc;
  char **argv;
***************
*** 72,77
  #ifdef SHRINK
     BITMAP *prime;
  #endif
  
     SETMOUSEICON(&mouse_arrow);
  	timestamp();							/* initialize the timestamp */

--- 82,91 -----
  #ifdef SHRINK
     BITMAP *prime;
  #endif
+ #ifdef BLANKING
+    int kbmouse;
+ #endif
+    int mousebit;
  
  
     SETMOUSEICON(&mouse_arrow);
***************
*** 73,78
     BITMAP *prime;
  #endif
  
     SETMOUSEICON(&mouse_arrow);
  	timestamp();							/* initialize the timestamp */
  

--- 87,93 -----
  #endif
     int mousebit;
  
+ 
     SETMOUSEICON(&mouse_arrow);
  	timestamp();					/* initialize the timestamp */
  
***************
*** 74,80
  #endif
  
     SETMOUSEICON(&mouse_arrow);
! 	timestamp();							/* initialize the timestamp */
  
     /* process arguments */
  

--- 89,95 -----
  
  
     SETMOUSEICON(&mouse_arrow);
! 	timestamp();					/* initialize the timestamp */
  
     /* process arguments */
  
***************
*** 249,254
  
  #ifdef BBB1
     set_tty(0);
  
     copyright(screen);
  #else

--- 264,270 -----
  
  #ifdef BBB1
     set_tty(0);
+ #endif
  
  #ifndef NOSTARTREK
     copyright(screen);
***************
*** 250,255
  #ifdef BBB1
     set_tty(0);
  
     copyright(screen);
  #else
     copyright(screen);

--- 266,272 -----
     set_tty(0);
  #endif
  
+ #ifndef NOSTARTREK
     copyright(screen);
  #endif
  
***************
*** 251,258
     set_tty(0);
  
     copyright(screen);
! #else
!    copyright(screen);
  
     set_tty(0);
  #endif

--- 268,274 -----
  
  #ifndef NOSTARTREK
     copyright(screen);
! #endif
  
  #ifndef BBB1
     set_tty(0);
***************
*** 254,259
  #else
     copyright(screen);
  
     set_tty(0);
  #endif
  

--- 270,276 -----
     copyright(screen);
  #endif
  
+ #ifndef BBB1
     set_tty(0);
  #endif
  
***************
*** 322,328
  
     /* always look for keyboard and mouse input */
  
!    mask |= (1<<mouse) | (1<<0); 
  
     /* main polling loop */
  

--- 339,346 -----
  
     /* always look for keyboard and mouse input */
  
!    mousebit = 1<<mouse;
!    mask |= mousebit | 1;	/* 1 == fd0 == keyboard */
  
  #ifdef BLANKING
     kbmouse = mousebit | 1;
***************
*** 324,329
  
     mask |= (1<<mouse) | (1<<0); 
  
     /* main polling loop */
  
     while(1) {

--- 342,352 -----
     mousebit = 1<<mouse;
     mask |= mousebit | 1;	/* 1 == fd0 == keyboard */
  
+ #ifdef BLANKING
+    kbmouse = mousebit | 1;
+    time (&lasttouch);
+ #endif
+ 
     /* main polling loop */
  
     while(1) {
***************
*** 335,340
  #ifdef DEBUG
              dprintf(d)(stderr,"Destroying %s-%d\r\n",W(tty),W(num));
  #endif
              destroy(win);
              win = active;
              }

--- 358,369 -----
  #ifdef DEBUG
              dprintf(d)(stderr,"Destroying %s-%d\r\n",W(tty),W(num));
  #endif
+ #ifdef BLANKING
+ 	    if (blanked) {		/* wake up for this */
+ 		time (&lasttouch);	/* tricky to do this right -dt */
+ 		unblank();
+ 	    }
+ #endif
              destroy(win);
              win = active;
              }
***************
*** 367,372
        dprintf(l)(stderr,"0x%x\r\n",reads);
  #endif
  
        /* process mouse */
  
        if (reads & (1<<mouse))

--- 396,415 -----
        dprintf(l)(stderr,"0x%x\r\n",reads);
  #endif
  
+ #ifdef BLANKING
+       if (reads & kbmouse) {
+ 	time (&lasttouch);
+ 	if (blanked)
+ 	   unblank();
+       } else {
+ 	long	now;
+ 	time (&now);
+ 	if (pollptr && now - lasttouch >= blank_poll.tv_sec)
+ 	   if (!blanked)
+ 	      blank();
+       }
+ #endif
+ 
        /* process mouse */
  
        if (reads & mousebit)
***************
*** 369,375
  
        /* process mouse */
  
!       if (reads & (1<<mouse))
           do {
              proc_mouse(mouse);
              }

--- 412,418 -----
  
        /* process mouse */
  
!       if (reads & mousebit)
           do {
              proc_mouse(mouse);
              }
***************
*** 440,445
  #ifdef DEBUG
              dprintf(m)(stderr,"%s: activating self\r\n",W(tty));
  #endif
              MOUSE_OFF(mousex,mousey);
              cursor_off();
              ACTIVE_OFF();

--- 483,495 -----
  #ifdef DEBUG
              dprintf(m)(stderr,"%s: activating self\r\n",W(tty));
  #endif
+ #ifdef BLANKING
+ 	/* go ahead and wake the screen up for this */
+ 	    if (blanked) {
+ 	       time (&lasttouch);
+ 	       unblank();
+ 	    }
+ #endif
              MOUSE_OFF(mousex,mousey);
              cursor_off();
              ACTIVE_OFF();
***************
*** 539,544
           do_button( button );
           done++;
           }
        MOUSE_ON(mousex,mousey);
        } while (mouse_count() && !done);
     return(done);

--- 589,597 -----
           do_button( button );
           done++;
           }
+ #ifdef BLANKING
+       if (!blanked)	/* kludge-ola for the main menu to be able to blank */
+ #endif
        MOUSE_ON(mousex,mousey);
        } while (mouse_count() && !done);
     return(done);
***************
*** 584,586
  		}
  #endif
  	}

--- 637,688 -----
  		}
  #endif
  	}
+ 
+ 
+ #ifdef BLANKING
+ setblank(num)	/* called from put_window.c -- responds to esc codes */
+ int	num;
+ {
+ 	if (num > 0) {
+ 		pollptr = &blank_poll;
+ 		blank_poll.tv_sec = num;
+ 	} else if (num < 0) {
+ 		pollptr = (struct timeval *) 0;
+ 	} else
+ 		blank();
+ }
+ 
+ blank()
+ {
+ 	register WINDOW *win;
+ 
+ 	cursor_off();
+ 	MOUSE_OFF(mousex,mousey);
+ 	/* mark all windows as obsured */
+ 	for(win=active;win!=(WINDOW *) 0;win=win->next) {
+ 	   if (W(flags)&W_ACTIVE) {
+ 	      save_win(win);
+ 	      W(flags) &= ~W_ACTIVE;
+ 	   }
+ 	}
+ 	CLEAR (screen, BIT_CLR);
+ 	blanked = 1;
+ }
+ 
+ unblank()
+ {
+ 	register WINDOW *win;
+ 
+ 	blanked = 0;
+ 	erase_win(screen,0,0);
+ 	/* restore all windows */
+ 	if (active) {
+ 		for(win=ACTIVE(prev);win!=active;win=W(prev))
+ 			restore_win(win);
+ 		restore_win(active);
+ 		un_covered(active);
+ 	}
+ 	MOUSE_ON(mousex,mousey);
+ 	cursor_on();
+ }
+ #endif
*** mouse_get.c.ol	Sun Apr 14 10:54:48 1991
--- mouse_get.c	Sun Apr 14 12:02:40 1991
***************
*** 109,114
  
  /* how many chars are sitting in the mouse buffer */
  
  int
  mouse_count()
     {

--- 109,115 -----
  
  /* how many chars are sitting in the mouse buffer */
  
+ #ifndef mouse_count
  int
  mouse_count()
     {
***************
*** 112,120
  int
  mouse_count()
     {
- #ifdef BBB1
-    return (0);
- #else
     return(cnt>index);
  #endif
     }

--- 113,118 -----
  int
  mouse_count()
     {
     return(cnt>index);
     }
  #endif
***************
*** 116,120
     return (0);
  #else
     return(cnt>index);
- #endif
     }

--- 114,118 -----
  mouse_count()
     {
     return(cnt>index);
     }
  #endif
***************
*** 118,120
     return(cnt>index);
  #endif
     }

--- 115,118 -----
     {
     return(cnt>index);
     }
+ #endif
*** put_window.c.o	Wed May  8 15:32:50 1991
--- put_window.c	Wed May 15 22:34:12 1991
***************
*** 70,75
   * return # of chars actually processed
   */
  
  int
  put_window(win,buff,buff_count)
  register WINDOW *win;					/* window to update */

--- 70,80 -----
   * return # of chars actually processed
   */
  
+ #ifdef BLANKING
+ extern char blanked;
+ extern long lasttouch;
+ #endif
+ 
  int
  put_window(win,buff,buff_count)
  register WINDOW *win;					/* window to update */
***************
*** 189,194
                 done++;
                 break;
  
           case E_ADDLINE:  		/* add a new line */
                 if (*W(esc)) {
                    register int count = *W(esc);

--- 194,205 -----
                 done++;
                 break;
  
+ #ifdef BLANKING
+ 	 case '*':		/* control screen blanking */
+ 	       setblank (*W(esc));
+ 	       done++;
+ #endif
+ 
           case E_ADDLINE:  		/* add a new line */
                 if (*W(esc)) {
                    register int count = *W(esc);
***************
*** 280,298
           case E_DOWN:			/* down 1 line */
  #ifdef FRACCHAR
                 if (cnt>0) {	/* move down a fraction of a character */
!                   int div = W(esc)[1] == 0 ? 1 : W(esc)[1];
!                   int n = W(esc)[0] * fsizehigh / div;
! 						if (W(y)+n > T_HIGH) {
! 							scroll(win,text,0,T_HIGH,n,W(background));
! 							done++;
! 							}
!                   else {
! 							W(y) += n;
! 							if (Do_clip())
! 								Set_cliphigh(0,W(y)+W(text).y);
!                      }
!                   break;
!                   }
  #endif
                 if (W(y)+fsizehigh > T_HIGH) {
                    scroll(win,text,0,T_HIGH,fsizehigh,W(background));

--- 291,308 -----
           case E_DOWN:			/* down 1 line */
  #ifdef FRACCHAR
                 if (cnt>0) {	/* move down a fraction of a character */
! 			int div = W(esc)[1] == 0 ? 1 : W(esc)[1];
! 			int n = W(esc)[0] * fsizehigh / div;
! 			if (W(y)+n > T_HIGH) {
! 				scroll(win,text,0,T_HIGH,n,W(background));
! 				done++;
! 			} else {
! 				W(y) += n;
! 				if (Do_clip())
! 					Set_cliphigh(0,W(y)+W(text).y);
! 			}
! 			break;
! 	       }
  #endif
                 if (W(y)+fsizehigh > T_HIGH) {
                    scroll(win,text,0,T_HIGH,fsizehigh,W(background));
***************
*** 339,346
                 break;
  
           case E_SETCURSOR:			/* set the character cursor */
! 					W(curs_type) = *W(esc);
! 					break;
           case E_BLEEP:			/* highlight a section of the screen */
                 if (cnt>2) {
                    register int *p = W(esc);

--- 349,356 -----
                 break;
  
           case E_SETCURSOR:			/* set the character cursor */
! 		W(curs_type) = *W(esc);
! 		break;
           case E_BLEEP:			/* highlight a section of the screen */
  #ifdef BLANKING
                 if (cnt>2 && !blanked) {
***************
*** 342,347
  					W(curs_type) = *W(esc);
  					break;
           case E_BLEEP:			/* highlight a section of the screen */
                 if (cnt>2) {
                    register int *p = W(esc);
                    if (p[0]<0 || p[1]<0 )

--- 352,360 -----
  		W(curs_type) = *W(esc);
  		break;
           case E_BLEEP:			/* highlight a section of the screen */
+ #ifdef BLANKING
+                if (cnt>2 && !blanked) {
+ #else
                 if (cnt>2) {
  #endif
                    register int *p = W(esc);
***************
*** 343,348
  					break;
           case E_BLEEP:			/* highlight a section of the screen */
                 if (cnt>2) {
                    register int *p = W(esc);
                    if (p[0]<0 || p[1]<0 )
                       break;

--- 356,362 -----
                 if (cnt>2 && !blanked) {
  #else
                 if (cnt>2) {
+ #endif
                    register int *p = W(esc);
                    if (p[0]<0 || p[1]<0 )
                       break;
***************
*** 389,394
                 break;
  
           case E_MOUSE:  		/* testing  -- move the mouse */
                 MOUSE_OFF(mousex,mousey);
                 if (W(esc_cnt) < 1) {
                    mousex = W(x0) + W(x);

--- 403,411 -----
                 break;
  
           case E_MOUSE:  		/* testing  -- move the mouse */
+ #ifdef BLANKING
+ 	       if (!blanked)
+ #endif
                 MOUSE_OFF(mousex,mousey);
                 if (W(esc_cnt) < 1) {
                    mousex = W(x0) + W(x);
***************
*** 401,406
                    mousey = BETWEEN(0,mousey,BIT_HIGH(screen)-1);
                    }
                 if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
                    MOUSE_ON(mousex,mousey);
                 break;
  

--- 418,426 -----
                    mousey = BETWEEN(0,mousey,BIT_HIGH(screen)-1);
                    }
                 if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
+ #ifdef BLANKING
+ 		if (!blanked)
+ #endif
                    MOUSE_ON(mousex,mousey);
                 break;
  
***************
*** 411,416
                    int lines = W(esc)[cnt];
                    int x = W(x0), y = W(y0);
  
                    MOUSE_OFF(mousex,mousey);
  
                    if (cnt>=3) {

--- 431,439 -----
                    int lines = W(esc)[cnt];
                    int x = W(x0), y = W(y0);
  
+ #ifdef BLANKING
+ 		if (!blanked)
+ #endif
                    MOUSE_OFF(mousex,mousey);
  
                    if (cnt>=3) {
***************
*** 429,434
                               2*SUM_BDR + HIGH);
                    ACTIVE_ON();
                    if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
                       MOUSE_ON(mousex,mousey);
                    done++;
                    }

--- 452,460 -----
                               2*SUM_BDR + HIGH);
                    ACTIVE_ON();
                    if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
+ #ifdef BLANKING
+ 		   if (!blanked)
+ #endif
                       MOUSE_ON(mousex,mousey);
                    done++;
                    }
***************
*** 712,717
  
           case E_SHAPE:  		/* reshape window, make it active */
  
                 MOUSE_OFF(mousex,mousey);
  
                 ACTIVE_OFF();

--- 738,746 -----
  
           case E_SHAPE:  		/* reshape window, make it active */
  
+ #ifdef BLANKING
+ 	       if (!blanked)
+ #endif
                 MOUSE_OFF(mousex,mousey);
  
                 ACTIVE_OFF();
***************
*** 730,735
  
                 ACTIVE_ON();
                 if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
                    MOUSE_ON(mousex,mousey);
  
                 done++;

--- 759,767 -----
  
                 ACTIVE_ON();
                 if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
+ #ifdef BLANKING
+ 		if (!blanked)
+ #endif
                    MOUSE_ON(mousex,mousey);
  
                 done++;
***************
*** 803,808
                break;
  
           case E_POP:			/* pop old environment */
                MOUSE_OFF(mousex,mousey);
                win_pop(win);
                if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))

--- 835,843 -----
                break;
  
           case E_POP:			/* pop old environment */
+ #ifdef BLANKING
+ 	     if (!blanked)
+ #endif
                MOUSE_OFF(mousex,mousey);
                win_pop(win);
                if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
***************
*** 806,811
                MOUSE_OFF(mousex,mousey);
                win_pop(win);
                if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
                   MOUSE_ON(mousex,mousey);
                done++;
                break;

--- 841,849 -----
                MOUSE_OFF(mousex,mousey);
                win_pop(win);
                if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
+ #ifdef BLANKING
+ 		if (!blanked)
+ #endif
                   MOUSE_ON(mousex,mousey);
                done++;
                break;
***************
*** 951,956
                        if (win == active) 
                            break;
                        
                        MOUSE_OFF(mousex,mousey);
  
                        cursor_off();

--- 989,997 -----
                        if (win == active) 
                            break;
                        
+ #ifdef BLANKING
+ 		     if (!blanked)
+ #endif
                        MOUSE_OFF(mousex,mousey);
  
                        cursor_off();
***************
*** 961,966
                        done++;
  
                        if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
                           MOUSE_ON(mousex,mousey);
                        break;
                        }

--- 1002,1010 -----
                        done++;
  
                        if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
+ #ifdef BLANKING
+ 			if (!blanked)
+ #endif
                           MOUSE_ON(mousex,mousey);
                        break;
                        }
***************
*** 1051,1056
                   case M_ACTIVATE:	/* hide the window */
                        if (!(W(flags)&W_ACTIVE) || next_window==1)
                            break;
                        MOUSE_OFF(mousex,mousey);
                        if (win!=active)
                           cursor_off();

--- 1095,1103 -----
                   case M_ACTIVATE:	/* hide the window */
                        if (!(W(flags)&W_ACTIVE) || next_window==1)
                            break;
+ #ifdef BLANKING
+ 		     if (!blanked)
+ #endif
                        MOUSE_OFF(mousex,mousey);
                        if (win!=active)
                           cursor_off();
***************
*** 1060,1065
                        if (win!=active)
                           cursor_on();
                        if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
                           MOUSE_ON(mousex,mousey);
  
                        done++;

--- 1107,1115 -----
                        if (win!=active)
                           cursor_on();
                        if (!(W(flags)&W_ACTIVE && mousein(mousex,mousey,win,0)))
+ #ifdef BLANKING
+ 			if (!blanked)
+ #endif
                           MOUSE_ON(mousex,mousey);
  
                        done++;
***************
*** 1072,1077
                break;
                      
           case E_MAKEWIN:		/* make or goto a new window */
                MOUSE_OFF(mousex,mousey);
                win_make(win,indx);
                done++;

--- 1122,1133 -----
                break;
                      
           case E_MAKEWIN:		/* make or goto a new window */
+ #ifdef BLANKING
+ 	      if (blanked) {		/* wake up if new window created */
+ 		  time (&lasttouch);	/* too tricky to handle this -dt */
+ 	          unblank();
+ 	      }
+ #endif
                MOUSE_OFF(mousex,mousey);
                win_make(win,indx);
                done++;
***************
*** 1085,1090
  
                if (cnt < 3 ||  cnt > 4)
                   break;
                MOUSE_OFF(mousex,mousey);
                if (win!=active)
                   cursor_off();

--- 1141,1151 -----
  
                if (cnt < 3 ||  cnt > 4)
                   break;
+ #ifdef BLANKING
+ 	      if (blanked) {		/* wake up on new window */
+ 		time (&lasttouch);	/* too tricky to fix this -dt */
+ 		unblank();
+ 	      }
                MOUSE_OFF(mousex,mousey);
                if (win!=active)
                   cursor_off();
***************
*** 1184,1189
                      break;
  
           case C_BELL:			/* ring the bell  */
                      bell_on();
                      if (!bell++) {
                         CLEAR(W(window),BIT_NOT(BIT_DST));

--- 1245,1257 -----
                      break;
  
           case C_BELL:			/* ring the bell  */
+ #ifdef BLANKING
+ 		/* a bell should wake up the screen, same as a keypress */
+ 		    if (blanked) {
+ 			time (&lasttouch);
+ 			unblank();
+ 		    }
+ #endif
                      bell_on();
                      if (!bell++) {
                         CLEAR(W(window),BIT_NOT(BIT_DST));
***************
*** 1254,1259
  
     cursor_on();
  
     MOUSE_ON(mousex,mousey);
  
     if (text != window)		/* this is probably wrong */

--- 1322,1330 -----
  
     cursor_on();
  
+ #ifdef BLANKING
+    if (!blanked)
+ #endif
     MOUSE_ON(mousex,mousey);
  
     if (text != window)		/* this is probably wrong */
***************
*** 1262,1267
        bit_destroy(window);
        }
  
     if (W(flags)&W_BACKGROUND && !(W(flags)&W_ACTIVE))
        update(win, &clip);
     return(indx);

--- 1333,1341 -----
        bit_destroy(window);
        }
  
+ #ifdef BLANKING
+    if (W(flags)&W_BACKGROUND && !(W(flags)&W_ACTIVE) && !blanked)
+ #else
     if (W(flags)&W_BACKGROUND && !(W(flags)&W_ACTIVE))
  #endif
        update(win, &clip);
***************
*** 1263,1268
        }
  
     if (W(flags)&W_BACKGROUND && !(W(flags)&W_ACTIVE))
        update(win, &clip);
     return(indx);
     }

--- 1337,1343 -----
     if (W(flags)&W_BACKGROUND && !(W(flags)&W_ACTIVE) && !blanked)
  #else
     if (W(flags)&W_BACKGROUND && !(W(flags)&W_ACTIVE))
+ #endif
        update(win, &clip);
     return(indx);
     }
*** subs.c.old	Thu May  9 00:30:38 1991
--- subs.c	Tue May 14 21:35:05 1991
***************
*** 21,26
  #include "event.h"
  #include "window.h"
  
  /*****************************************************************************
   *	deactivate all windows covered by win (used for new window creation)
   */

--- 21,31 -----
  #include "event.h"
  #include "window.h"
  
+ #ifdef BLANKING
+ extern char	blanked;
+ extern long	lasttouch;
+ #endif
+ 
  /*****************************************************************************
   *	deactivate all windows covered by win (used for new window creation)
   */
***************
*** 52,57
     register WINDOW *win,*check;
     register int cover;
     
     for(win=active;win != (WINDOW *) 0;win=W(next)) {
  #ifdef DEBUG
        dprintf(U)(stderr,"	invalidate cliplist: %s)\r\n",W(tty));

--- 57,67 -----
     register WINDOW *win,*check;
     register int cover;
     
+ #ifdef BLANKING
+    if (blanked)
+      return;
+ #endif
+ 
     for(win=active;win != (WINDOW *) 0;win=W(next)) {
  #ifdef DEBUG
        dprintf(U)(stderr,"	invalidate cliplist: %s)\r\n",W(tty));
***************
*** 129,134
           if (W(flags)&W_ACTIVE && intersect(active,win))
              save_win(win);
     
        restore_win(active);
     
        clip_bad(active);	/* invalidate clip lists */

--- 139,147 -----
           if (W(flags)&W_ACTIVE && intersect(active,win))
              save_win(win);
     
+ #ifdef BLANKING
+       if (!blanked)
+ #endif
        restore_win(active);
     
        clip_bad(active);	/* invalidate clip lists */
***************
*** 687,692
  
  static int cursoron = 0;
  
  cursor_on()
  {
  	if( !active ) {

--- 700,709 -----
  
  static int cursoron = 0;
  
+ #ifdef BLANKING
+ extern char blanked;
+ #endif
+ 
  cursor_on()
  {
  	if( !active ) {
***************
*** 693,698
  		cursoron = 0;
  		return;
  	}
  	if( cursoron )
  		return;
  	do_cursor(active);

--- 710,718 -----
  		cursoron = 0;
  		return;
  	}
+ #ifdef BLANKING
+ 	if( cursoron || blanked)
+ #else
  	if( cursoron )
  #endif
  		return;
***************
*** 694,699
  		return;
  	}
  	if( cursoron )
  		return;
  	do_cursor(active);
  	cursoron = 1;

--- 714,720 -----
  	if( cursoron || blanked)
  #else
  	if( cursoron )
+ #endif
  		return;
  	do_cursor(active);
  	cursoron = 1;
***************
*** 705,710
  		cursoron = 0;
  		return;
  	}
  	if( !cursoron )
  		return;
  	cursoron = 0;

--- 726,734 -----
  		cursoron = 0;
  		return;
  	}
+ #ifdef BLANKING
+ 	if( !cursoron || blanked)
+ #else
  	if( !cursoron )
  #endif
  		return;
***************
*** 706,711
  		return;
  	}
  	if( !cursoron )
  		return;
  	cursoron = 0;
  	do_cursor(active);

--- 730,736 -----
  	if( !cursoron || blanked)
  #else
  	if( !cursoron )
+ #endif
  		return;
  	cursoron = 0;
  	do_cursor(active);
-- 
Unix is not your mother.

-- 
David H. Brierley
Home: dave at galaxia.newport.ri.us; Work: dhb at quahog.ssd.ray.com
Send comp.sources.3b1 submissions to comp-sources-3b1 at galaxia.newport.ri.us
%% Can I be excused, my brain is full. **



More information about the Comp.sources.3b1 mailing list