Problem with event manager

Jonathan Bayer jbayer at ispi.UUCP
Thu Jun 15 10:36:51 AEST 1989


Greetings.

I am currently implementing events in uEmacs 3.10 in order to be able
to use a mouse.  This is being done using the 2.3 development system on
a 386.  I have the mouse actions being read properly, including both
movement and the buttons.  I also am using the events to read the
keyboard. 

Now the problem:  When I change multiscreens using Alt-F?, and then
return, the program hangs in ev_block().  It is as if the events are
totally disconnected from the program and are never restored.

I typed in the sample program which SCO has in the C library guide, and
that seems to work without any problems.  The only thing I can see is
possibly the size of the program is having something to do with it.

I tried compiling the program in 286 mode, large model as well as 386
mode; and got the same problem.

The annoying item is that the program  usemouse  does not have this
problem;  however, usemouse   changes the tty settings therefore making
usemouse unusable.

I have duplicated the relevent code below.  Note that the program is
definitely hanging in ev_block() because I put a debugging statement in
to make sure that it wasn't in an endless loop.

Any ideas?  Please e-mail, and I will summarize to the net.


JB


Declarations:

dmask_t dmask = D_STRING | D_REL;
int	ret, qfd;
EVENT	*evp;
extern int	ev_errlev;


Code used to open the event queue:

	ev_errlev = 0;
	ret = ev_init();
	if (ret >= 0) {
		mexist = TRUE;
		qfd = ev_open(&dmask);
		if (qfd < 0) mexist = FALSE;
		if (mexist) {
			qfd = ev_open(&dmask);
			if (qfd < 0) {
				ev_close();
				mexist = FALSE;
			} else {

				dmask &= (D_STRING | D_REL);
				if (dmask != (D_STRING | D_REL) ) {
					mexist = FALSE;
					ev_close();
				}
			}
		/* Events should be enqueued now */
		}
	}

Code used to read the event queue:

	while (1) {
		ret = ev_block();
		evp = ev_read();
		if (EV_TAG(*evp) & T_STRING) {
			kbdq = EV_BUF(*evp)[0] & 255;
			ev_pop();
			return(kbdq);
		} else if (mouseflag) {
			ret = 0;
			if ( EV_DY(*evp) > 0) ret = SPEC | 'P';
			if ( EV_DY(*evp) < 0) ret = SPEC | 'N';
			if ( EV_DX(*evp) < 0) ret = SPEC | 'B';
			if ( EV_DX(*evp) > 0) ret = SPEC | 'F';
			ev_pop();
			return (ret);
		}
	}

-- 
Jonathan Bayer			      Beware: The light at the end of the
Intelligent Software Products, Inc.	      tunnel may be an oncoming dragon
500 Oakwood Ave.				...uunet!ispi!root
Roselle Park, NJ   07204    (201) 245-5922    jbayer at ispi.UUCP



More information about the Comp.unix.xenix mailing list