Subject: Announce: Splitvt 1.5.2
From: [email-masked] (Whistler)
Date: Fri, 13 May 1994 22:10:24 GMT
Newsgroups: comp.os.linux.announce,alt.sources

Announcing Splitvt version 1.5.2 !

What it is:

	Splitvt is a UNIX utility designed to split your screen in
half, running a shell (or the program of your choice) in each half.
This can be very handy if you want to see the results of two programs
at the same time, but don't have X, or, if you want to work in two
windows at the same time over a modem.
Some people even like to run splitvt in X, just to have two programs
running in the same window.
Splitvt is a complementary utility to that great program 'screen',
and can be used in combination with it to have a variety of split
virtual screens.

What's New:

	Splitvt has a few new features since version 1.5.
There is now a -norc option to suppress startup from your custom
.splitvtrc startup file.
The top and bottom bars have been removed to give your screen
more real estate.
Splitvt now supports some obscure features of xterm that allow you 
to click your mouse in the window of your choice, eliminating the 
need for you to hit those pesky control keys to switch windows.
(Note: this feature is only available to true xterms)

Where you can get it:

	You can get this program via anonymous ftp from
sunsite.unc.edu.
I just uploaded the newest version to the /pub/Linux/Incoming
directory, and it should be moved soon to its final resting
place in /pub/Linux/utils/shell.
The file is in a gzipped-shar archive, and can be uncompressed
with the following command line:

	gzip -cd file.shz | sh

If for some reason, you cannot ftp it, then feel free to send
me email at [email-masked] and I will be happy to send
it to you.

Troubleshooting:

	You shouldn't have any problems compiling splitvt
if you are on a UNIX system that supports pseudo-terminals.
If you are on a UNIX box, chances are good that you can 
compile it.  Look in the README file in the archive for a list
of systems splitvt is known to work on.

	By far the most common problem people have had is
splitvt not being able to open enough pseudo-terminals (ttys).
This can be caused by many things.  If your system isn't one
in the README, it might be that your system handles pseudo-
terminals differently than any I know.  Often, not being able
to open enough ptys is caused by too many users on the system
or too many pty-intensive applications running (these include
xterm, screen, telnetd, expect, etc).  If this happens, try
waiting a while and try again.  Another problem that can occur
on some systems is pty hanging.  This can happen when applications
quit and go into a zombie state, or if the kernel gets confused
about the state of the pty.  Generally, if you can, try to
reboot.  This clears all of the hung ptys.
A good telltale to whether or not lack of ptys is splitvt's
problem is to rlogin a few times to your local system.  If you
are able to log in properly (without a message like 
"rlogind: out of ptys"), then the problem is probably with splitvt.

	That said, most people have very few problems with
splitvt, and I hope you are among them that enjoy my fine utility.

Oh, the idea for this utility came from the brain of Daveola Ljung.
Thanks Dave!

If you have any questions, comments, complaints, cash, ;-)
send me email at [email-masked]

Enjoy!

	-Sam

P.S.  Included in this post is a patch to upgrade from splitvt 1.5
      to the current version.  To apply, save the patch to a file,
      cd to the source directory for splitvt 1.5, and run the
      command:  patch -p1 <your_patch_file

splitvt.patch -----------------------------------------------------
diff --recursive --context --new-file splitvt-1.5.0/README splitvt/README
*** splitvt-1.5.0/README	Wed May 11 00:29:12 1994
--- splitvt/README	Wed May 11 00:10:49 1994
***************
*** 47,52 ****
--- 47,58 ----
  	Version 1.5.0	Fourth release 	
  				Reworked command line options
  				Added .splitvtrc support
+ 	Version 1.5.1
+ 				Removed top and bottom bars
+ 				Added -norc option
+ 	Version 1.5.2
+ 				Added slick xterm title bar
+ 				Added xterm mouse click support
  
  Install Notes:
  
diff --recursive --context --new-file splitvt-1.5.0/config.c splitvt/config.c
*** splitvt-1.5.0/config.c	Wed May 11 00:29:12 1994
--- splitvt/config.c	Tue May 10 23:51:39 1994
***************
*** 182,192 ****
  #endif
  	sprintf(line, "\nCFLAGS = %s\nLIBS = %s\n\n", cflags, ldflags);
  	fprintf(makefile, "%s", line);
! 	fprintf(makefile, "splitvt: splitvt.o misc.o vt100.o utmp.o vttest.o\n");
! #ifdef linux
! 	fprintf(makefile, "\t$(CC) -N -o splitvt splitvt.o misc.o vt100.o utmp.o vttest.o $(LIBS)\n");
  #else
! 	fprintf(makefile, "\t$(CC) -o splitvt splitvt.o misc.o vt100.o utmp.o vttest.o $(LIBS)\n");
  #endif
  	fprintf(makefile, "\nclean: \n\trm -f *.o core splitvt Makefile\n");
  
--- 182,192 ----
  #endif
  	sprintf(line, "\nCFLAGS = %s\nLIBS = %s\n\n", cflags, ldflags);
  	fprintf(makefile, "%s", line);
! 	fprintf(makefile, "splitvt: splitvt.o misc.o vt100.o utmp.o vttest.o vtmouse.o\n");
! #if defined(linux) && !defined(DEBUG)
! 	fprintf(makefile, "\t$(CC) -N -s -o splitvt splitvt.o misc.o vt100.o utmp.o vttest.o vtmouse.o $(LIBS)\n");
  #else
! 	fprintf(makefile, "\t$(CC) -o splitvt splitvt.o misc.o vt100.o utmp.o vttest.o vtmouse.o $(LIBS)\n");
  #endif
  	fprintf(makefile, "\nclean: \n\trm -f *.o core splitvt Makefile\n");
  
diff --recursive --context --new-file splitvt-1.5.0/splitvt.1 splitvt/splitvt.1
*** splitvt-1.5.0/splitvt.1	Wed May 11 00:29:13 1994
--- splitvt/splitvt.1	Wed May 11 00:25:14 1994
***************
*** 20,25 ****
--- 20,29 ----
  Sets 'numlines' to the number of lines in the top window.  This number
  will be modified if the screen isn't big enough to handle the full
  size.
+ .TP
+ .SB -norc
+ Suppresses loading your ~/.splitvtrc
+ .LP
  .SH DESCRIPTION
  .LP
  This program splits the screen into two windows, one above the other,
***************
*** 91,96 ****
--- 95,106 ----
  splitvt, you probably need to set the LINES environment variable to a
  correct value, or set the terminal's window sizing correctly.  This
  should be done automatically, but may need to be corrected.
+ 
+ If you are running under an xterm window, the title bar will probably 
+ be updated to show the version of splitvt that you are running.
+ Under a true xterm window, you can also switch which half of the window
+ you are typing into by clicking the mouse in the half of the window
+ in which you want to type.  
  
  Under certain conditions, resizing the window (assuming you are
  running splitvt in a window managed by a window manager) will cause
diff --recursive --context --new-file splitvt-1.5.0/splitvt.c splitvt/splitvt.c
*** splitvt-1.5.0/splitvt.c	Wed May 11 00:29:13 1994
--- splitvt/splitvt.c	Wed May 11 00:17:57 1994
***************
*** 7,13 ****
  				-Sam Lantinga  10/5/93
  */
  
! static char *version="@(#)splitvt 1.5.0   4/16/94  -Sam Lantinga\n";
  
  #include	<sys/types.h>
  #include	<sys/time.h>
--- 7,13 ----
  				-Sam Lantinga  10/5/93
  */
  
! static char *version="@(#)Splitvt 1.5.2   5/11/94  -Sam Lantinga\n";
  
  #include	<sys/types.h>
  #include	<sys/time.h>
***************
*** 18,24 ****
--- 18,27 ----
  #include	<errno.h>
  #include	<ctype.h>
  #include	<pwd.h>
+ #include	"vtmouse.h"
  
+ #define XTITLE		/* Uncomment this for an xterm title bar */
+ 
  #ifdef NEED_SELECT_H
  #include	<sys/select.h>
  #endif
***************
*** 52,57 ****
--- 55,61 ----
  extern void  vt_debug();	/* A vt100 debugging routine */
  extern char  vt_prompt();	/* A user prompt routine for getting a char */
  extern int UU_lines;		/* The user requested lines for the top win */
+ extern int WU_lines;		/* The actual lines for the top win */
  
  /* The command prompt shown by vt_prompt() */
  #define PROMPT	"\033[1;1msplitvt command: \033[m"
***************
*** 107,112 ****
--- 111,118 ----
  	fprintf(stderr, "\t\t\t\tenough to handle the full size.\n\n");
  	fprintf(stderr, "\t-upper command\t\tRuns 'command' in the upper window\n");
  	fprintf(stderr, "\t-lower command\t\tRuns 'command' in the lower window\n");
+ 	fprintf(stderr, "\t-norc\t\t\tSuppresses loading your ~/.splitvtrc\n");
+ 	fprintf(stderr, "\n");
  	exit(1);
  }
  
***************
*** 125,130 ****
--- 131,137 ----
  	static struct passwd pwdata;	/* Our passwd entry */
  
  	static int debugflag=0;		/* Do we allow debug key? */
+ 	struct event X_event;
  
  #ifdef NEED_INET_H
          /* There is a bug in the Wallabong Group's implementation
***************
*** 138,150 ****
  #endif
  
  	/* First, get default options from ~/.splitvtrc */
! 	splitvtrc();
  
  	/* Parse command line options */
! 	while ( (i=getopt(argc, argv, "u:l:s:vh")) != EOF )
  	{
  		switch (i)
  		{
  			case 'u': if ( strcmp(optarg, "pper") != 0 )
  					print_usage(argv[0]);
  				  upper_args[0]=argv[optind++];
--- 145,168 ----
  #endif
  
  	/* First, get default options from ~/.splitvtrc */
! 	for ( i=1; argv[i]; ++i ) {
! 		if ( strcmp(argv[i], "-norc") == 0 ) {
! 			i=0;
! 			break;
! 		}
! 	}
! 	if ( i )
! 		splitvtrc();
  
  	/* Parse command line options */
! 	while ( (i=getopt(argc, argv, "n:u:l:s:vh")) != EOF )
  	{
  		switch (i)
  		{
+ 			case 'n': if ( strcmp(optarg, "orc") != 0 )
+ 					print_usage(argv[0]);
+ 				  /* Already handled above */
+ 				  break;
  			case 'u': if ( strcmp(optarg, "pper") != 0 )
  					print_usage(argv[0]);
  				  upper_args[0]=argv[optind++];
***************
*** 159,165 ****
  				  break;
  			case 's': UU_lines=atoi(optarg);
  				  break;
! 			case 'v': printf("%s", version);
  				  exit(0);
  				  break;
  			case 'h':
--- 177,183 ----
  				  break;
  			case 's': UU_lines=atoi(optarg);
  				  break;
! 			case 'v': printf("%s", version+4);
  				  exit(0);
  				  break;
  			case 'h':
***************
*** 181,187 ****
  
  	if ( tty_getmode(ttyfd) < 0 ) 
  	{
- 		end_vt100();
  		fprintf(stderr, "Can't get terminal settings.\n");
  		exit(2);
  	}
--- 199,204 ----
***************
*** 195,200 ****
--- 212,224 ----
  		fprintf(stderr, "\rCan't initialize screen: %s\n", ptr);
  		exit(3);
  	}
+ #ifdef XTITLE
+ 	strcpy(buffer, version+4);
+ 	buffer[strlen(buffer)-1]='\0';
+ 	(void) event_init(stdin, stdout, buffer);
+ #else
+ 	(void) event_init(stdin, stdout, NULL);
+ #endif
  
  	if ( argv[1] ) {
  		if ( upper_empty ) {
***************
*** 323,359 ****
  
  		if ( FD_ISSET(ttyfd, &read_mask) )
  		{
! 			read(ttyfd, buffer, 1);
  
! 			if ( buffer[0] == quote_c )
! 			{
! 				read(ttyfd, buffer, 1);
! 				goto writit;
! 			}
! 			else if ( buffer[0] == switch_c )
! 			{
! 				if ( (thisfd == topfd) && bottomok )
! 					thisfd=bottomfd;
! 				else if ( topok )
! 					thisfd=topfd;
! 				SET_WIN();
! 			}
! 			else if ( buffer[0] == command_c )
! 			{
! 				switch (vt_prompt(PROMPT)) {
! 					/* Print debug info */
! 					case 'p': if ( debugflag )
! 							vt_debug(stderr);
! 						  break;
! 					/* Quick exit */
! 					case 'q': finish(0);
! 						  break;
! 					default:  break;
  				}
! 			}
! 			else {
! 		writit:
! 				write(thisfd, buffer, 1);
  			}
  		}
  
--- 347,394 ----
  
  		if ( FD_ISSET(ttyfd, &read_mask) )
  		{
! 			if ( (buffer[0]=event_getc(&X_event)) == EOF )
! 				finish(0);
  
! 			if ( X_event.happening ) {
! 				/* Work only on button release */
! 				if ( BUTTON_ISSET(X_event, RELEASE) ) { 
! 					/* Mouse click in which window? */
! 					if ( X_event.y > WU_lines ) { 
! 						if ( bottomok )
! 							thisfd=bottomfd;
! 						SET_WIN();
! 					} else if ( X_event.y < WU_lines ) { 
! 						if ( topok )
! 							thisfd=topfd;
! 						SET_WIN();
! 					}
  				}
! 			} else {
! 				if ( buffer[0] == quote_c ) {
! 					read(ttyfd, buffer, 1);
! 					goto writeit;
! 				} else if ( buffer[0] == switch_c ) {
! 					if ( (thisfd == topfd) && bottomok )
! 						thisfd=bottomfd;
! 					else if ( topok )
! 						thisfd=topfd;
! 					SET_WIN();
! 				} else if ( buffer[0] == command_c ) {
! 					switch (vt_prompt(PROMPT)) {
! 						/* Print debug info */
! 						case 'p': if ( debugflag )
! 								vt_debug(stderr);
! 							  break;
! 						/* Quick exit */
! 						case 'q': finish(0);
! 							  break;
! 						default:  break;
! 					}
! 				}
! 				else { writeit:
! 					write(thisfd, buffer, 1);
! 				}
  			}
  		}
  
***************
*** 471,476 ****
--- 506,512 ----
  
  	/* Reset the vt100 window */
  	end_vt100();
+ 	event_quit();
  
  	/* Reset our utmp entries */
  	if ( pw && topok && upper_tty[0] )
diff --recursive --context --new-file splitvt-1.5.0/splitvt.lsm splitvt/splitvt.lsm
*** splitvt-1.5.0/splitvt.lsm	Wed May 11 00:29:14 1994
--- splitvt/splitvt.lsm	Wed May 11 00:19:28 1994
***************
*** 1,6 ****
  Begin2
  Title        = Splitvt - a split windows utility
! Version      = 1.5.0
  Desc1        = A utility to split a vt100 compatible screen into two halfs,
  Desc2        = upper and lower, and run a different program simultaneously
  Desc3        = in each half.
--- 1,6 ----
  Begin2
  Title        = Splitvt - a split windows utility
! Version      = 1.5.2
  Desc1        = A utility to split a vt100 compatible screen into two halfs,
  Desc2        = upper and lower, and run a different program simultaneously
  Desc3        = in each half.
***************
*** 24,30 ****
  Comment1     = This is a pretty useful utility, especially when communicating
  Comment2     = to a UNIX system via modem, or when you want to see the output
  Comment3     = of two programs simultaneously.
! Comment4     =
  Entered      = 28APR94
  EnteredBy    = Sam Lantinga
  End
--- 24,30 ----
  Comment1     = This is a pretty useful utility, especially when communicating
  Comment2     = to a UNIX system via modem, or when you want to see the output
  Comment3     = of two programs simultaneously.
! Comment4     = New: No top or bottom bars, -norc option, xterm mouse support.
  Entered      = 28APR94
  EnteredBy    = Sam Lantinga
  End
diff --recursive --context --new-file splitvt-1.5.0/vt100.c splitvt/vt100.c
*** splitvt-1.5.0/vt100.c	Wed May 11 00:29:15 1994
--- splitvt/vt100.c	Wed May 11 00:05:08 1994
***************
*** 18,25 ****
  #include	<stdio.h>
  #include	<ctype.h>
  
! extern int errno;			/* only used in vt_write() */
  
  /* Function declarations */
  
  extern char *getenv();
--- 18,27 ----
  #include	<stdio.h>
  #include	<ctype.h>
  
! #define SEP_CHAR	' '		/* Separator bar character */
  
+ extern int   errno;			/* only used in vt_write() */
+ 
  /* Function declarations */
  
  extern char *getenv();
***************
*** 79,84 ****
--- 81,88 ----
  
  static int LU_lines;	/* A local copy of UU_lines that is modified */
  
+ static char *termtype;
+ 
  /* A debugging routine */
  
  void vt_debug(debug)
***************
*** 116,122 ****
  	if ( ! isatty(0) || ! isatty(1) )
  		return("Standard input and output must be a tty");
  
! 	if ( ((ptr=getenv("TERM")) == NULL || strncmp(ptr, "vt100", 5)) && 
  			/* A vt100 emulation detector -->  */	! vttest() )
  		return("Terminal type must be set to vt100");
  
--- 120,127 ----
  	if ( ! isatty(0) || ! isatty(1) )
  		return("Standard input and output must be a tty");
  
! 	if ( ((termtype=getenv("TERM")) == NULL || 
!          (strncmp(termtype, "vt100", 5)) != 0) && 
  			/* A vt100 emulation detector -->  */	! vttest() )
  		return("Terminal type must be set to vt100");
  
***************
*** 146,153 ****
  	/* Set the exportable variables */
  	if ( UU_lines ) {
  		/* Check the user set # of lines */
! 		if ( UU_lines > (lines-3-3) )
! 			LU_lines=(lines-3-3);
  		else if ( UU_lines < 3 )
  			LU_lines=3;
  		else
--- 151,158 ----
  	/* Set the exportable variables */
  	if ( UU_lines ) {
  		/* Check the user set # of lines */
! 		if ( UU_lines > (lines-1-3) )
! 			LU_lines=(lines-1-3);
  		else if ( UU_lines < 3 )
  			LU_lines=3;
  		else
***************
*** 154,182 ****
  			LU_lines=UU_lines;
  
  		WU_lines=LU_lines;
! 		WL_lines=(lines-3-LU_lines);
  	} else
! 		WL_lines=WU_lines=((lines-3)/2);
  	W_columns=columns;
  
- 
  	/* Set up the separator */
  	strcpy(sep, "\033[7m");
! 	for ( i=0; (i<columns)&&(i<BUFSIZ); ++i )  sep[i+4]=' ';
  	sep[i]='\0';
  	strcat(sep, "\033[m");
  
  	/* Clear the screen, and set up the windows */
  	CLEAR; 
! 	printf("%s", sep);			/* Top line - separator */
! 	ul_a=(1+1);				/* Upper limit of top win */
! 	ll_a=(1+WU_lines);			/* Lower limit of top win */
! 	vt_goto((1+WU_lines+1), 1);		/* Move past the top win */
! 	printf("%s", sep);			/* Print separator */
! 	ul_b=(1+WU_lines+1+1);			/* Upper limit of bottom win */
! 	ll_b=(1+WU_lines+1+WL_lines);		/* Lower limit of bottom win */
! 	vt_goto((1+WU_lines+1+WL_lines+1), 1);	/* Move past bottom win */
  	printf("%s", sep);			/* Print separator */
  	c_a.x=ul_a; c_a.y=1;			/* Set upper cursor */
  	c_b.x=ul_b; c_b.y=1;			/* Set lower cursor */
  	fflush(stdout);				/* Update the terminal */
--- 159,183 ----
  			LU_lines=UU_lines;
  
  		WU_lines=LU_lines;
! 		WL_lines=(lines-1-LU_lines);
  	} else
! 		WL_lines=WU_lines=((lines-1)/2);
  	W_columns=columns;
  
  	/* Set up the separator */
  	strcpy(sep, "\033[7m");
! 	for ( i=0; (i<columns)&&(i<BUFSIZ); ++i )  sep[i+4]=SEP_CHAR;
  	sep[i]='\0';
  	strcat(sep, "\033[m");
  
  	/* Clear the screen, and set up the windows */
  	CLEAR; 
! 	vt_goto((WU_lines+1), 1);		/* Move past the top win */
  	printf("%s", sep);			/* Print separator */
+ 	ul_a=(1);				/* Upper limit of top win */
+ 	ll_a=(WU_lines);			/* Lower limit of top win */
+ 	ul_b=(WU_lines+1+1);			/* Upper limit of bottom win */
+ 	ll_b=(WU_lines+1+WL_lines);		/* Lower limit of bottom win */
  	c_a.x=ul_a; c_a.y=1;			/* Set upper cursor */
  	c_b.x=ul_b; c_b.y=1;			/* Set lower cursor */
  	fflush(stdout);				/* Update the terminal */
***************
*** 612,618 ****
  
  	/* Save cursor position, go home, clear line and print prompt */
  	if ( prompt ) {
! 		sprintf(format, "\0337\033[;H\033[K%%.%ds", columns);
  		printf(format, prompt);
  		fflush(stdout);
  	}
--- 613,619 ----
  
  	/* Save cursor position, go home, clear line and print prompt */
  	if ( prompt ) {
! 		sprintf(format, "\0337\033[%d;H\033[K%%.%ds", (WU_lines+1), columns);
  		printf(format, prompt);
  		fflush(stdout);
  	}
diff --recursive --context --new-file splitvt-1.5.0/vtmouse.c splitvt/vtmouse.c
*** splitvt-1.5.0/vtmouse.c
--- splitvt/vtmouse.c	Wed May 11 00:09:20 1994
***************
*** 0 ****
--- 1,145 ----
+ 
+ /* This is a program to show how mouse events can be handled by programs
+    running under an xterm window.
+ 
+ 		-Sam Lantinga		5/11/94
+ */
+ 
+ #include <stdio.h>
+ #include "vtmouse.h"
+ 
+ #undef MAIN
+ #ifdef MAIN
+ void event_loop()
+ {
+ 	int c, event_flag;
+ 	struct event X_event;
+ 
+ 	while ( (c=event_getc(&X_event)) != EOF ) {
+ 		if ( X_event.happening ) {
+ 			printf("\r\n************\r\n");
+ 			printf("Mouse Event: 0x%x\r\n", X_event.button_state);
+ 			printf("\tX coordinate: %d\r\n", X_event.x);
+ 			printf("\tY coordinate: %d\r\n", X_event.y);
+ 			/* One example of getting the mouse state */
+ 			printf("\tX Event: ");
+ 			switch(X_event.button_state&BUTTON_MASK) {
+ 				case RELEASE:	printf("Button was released!\r\n");
+ 									break;
+ 				default:			printf("Button %d was pressed!\r\n", 
+ 											(X_event.button_state&BUTTON_MASK)+1);
+ 									break;
+ 			}
+ 			/* Another example of getting the mouse state */
+ 			printf("\tMouse %s buttons <%c|%c|%c>\r\n",
+ 				(BUTTON_ISSET(X_event, RELEASE) ? "released" : "pressed"),
+ 				(BUTTON_ISSET(X_event, BUTTON_1) ? 'X' : ' '),
+ 				(BUTTON_ISSET(X_event, BUTTON_2) ? 'X' : ' '),
+ 				(BUTTON_ISSET(X_event, BUTTON_3) ? 'X' : ' '));
+ 			printf("************\r\n");
+ 		} else {
+ 			if ( c == 'Q' )
+ 				return;
+ 			else  {
+ 				putc(c, stdout);
+ 				if ( c == '\r' )
+ 					putc('\n', stdout);
+ 			}
+ 		}
+ 	}
+ }
+ 
+ int main(int argc, char *argv[])
+ {
+ 	if ( event_init(stdin, stdout) < 0 ) {
+ 		printf("Not running under an xterm.\n");
+ 		exit(2);
+ 	}
+ 	system("stty -echo raw");
+ 
+ 	event_loop();
+ 
+ 	system("stty -raw echo");
+ 	event_quit();
+ 
+ 	exit(0);
+ }
+ #endif
+ 
+ static FILE *xt_input, *xt_output;
+ static int have_xterm=0;
+ static int set_title=0;
+ 
+ int event_init(input, output, titlebar)
+ FILE *input, *output;
+ char *titlebar;
+ {
+ 	char *termtype;
+ 
+ 	/* A program can assume that input is unbuffered after this routine */
+ 	setbuf(input, NULL);
+ 	xt_input=input;
+ 	xt_output=output;
+ 
+ 	/* Check for xterm terminal type */
+ 	if ( (termtype=(char *)getenv("TERM")) && strcmp(termtype, "xterm") == 0 ) {
+ 		fprintf(xt_output, "\033[?1000h");
+ 		fflush(xt_output);
+ 		have_xterm=1;
+ 		if ( titlebar ) {
+ 			fprintf(xt_output, "\033]0;%s\07", titlebar);
+ 			set_title=1;
+ 			fflush(xt_output);
+ 		}
+ 	} else {
+ 		return(-1);
+ 	}
+ 	return(0);
+ }
+ 
+ int event_getc(X_event)
+ struct event *X_event;
+ {
+ 	int c, done=0;
+ 	char sequence[]="\033[M\0\0\0", *next=sequence;
+ 
+ 	X_event->happening=0;
+ 
+ 	if ( have_xterm ) {
+ 		while ( *next ) {
+ 			if ( (c=getc(xt_input)) == EOF )
+ 				return(EOF);
+ 			if ( c == *next )
+ 				++next;
+ 			else {
+ 				*next=(char)c;
+ 				for ( *(next+1)='\0'; (next > sequence); --next )
+ 					ungetc(*next, xt_input);
+ 				return(*sequence);
+ 			}
+ 		}
+ 		/* An event is being sent! */
+ 		X_event->happening=1;
+ 		for ( c=0; c<3; ++c ) {
+ 			if ( (*(next++)=getc(xt_input)) == EOF )
+ 				return(EOF);
+ 		}
+ 		X_event->button_state=(sequence[3]-' ');
+ 		X_event->x=(sequence[4]-' ');
+ 		X_event->y=(sequence[5]-' ');
+ 	} else
+ 		return(getc(xt_input));
+ 	return(0);
+ }
+ 
+ void event_quit()
+ {
+ 	if ( have_xterm ) {
+ 		fprintf(xt_output, "\033[?1000l");
+ 		fflush(xt_output);
+ 		if ( set_title ) {
+ 			fprintf(xt_output, "\033]0;%s\07", "xterm");
+ 			fflush(xt_output);
+ 		}
+ 	}
+ }
diff --recursive --context --new-file splitvt-1.5.0/vtmouse.h splitvt/vtmouse.h
*** splitvt-1.5.0/vtmouse.h
--- splitvt/vtmouse.h	Tue May 10 23:46:28 1994
***************
*** 0 ****
--- 1,23 ----
+ 
+ /* Definitions for button_state bitmasks */
+ #define BUTTON_MASK	0x03
+ #define BUTTON_1		0x00
+ #define BUTTON_2		0x01
+ #define BUTTON_3		0x02
+ #define RELEASE		0x03
+ #define SHIFT			0x04
+ #define META			0x08
+ #define CONTROL		0x0F
+ 
+ struct event {
+ 	int happening;
+ 	char button_state;
+ 	unsigned int x;
+ 	unsigned int y;
+ };
+ #define BUTTON_ISSET(X, B)	((X.button_state&BUTTON_MASK) == B)
+    
+ extern int  event_init();
+ extern int  event_getc();
+ extern void event_quit();
+ 

--
Mail submissions for comp.os.linux.announce to: [email-masked]
Be sure to include Keywords: and a short description of your software.