[comp.windows.news] UI.ps consult needed

conrad@jupiter.ucsc.edu (Al Conrad) (01/31/89)

Well, my NeWS1.1 port is very close to complete.  All the mouse interaction
works, all of the server/client socket stuff works, but only half of the
keyboard stuff works (specifically: upper and lower case A through Z, the
digits 0 through 9, back space, and carriage return).

I started with lk201keys.ps and, since I've only got access to the ASCII
values generated by the keyboard in my KbEventsHaveSelected() service
routine, I just used those values for the postion field of each keyboard
character.  For example,

	(A) toChar [65 /keystation unshifted] def

My KbEventsHaveSelected() code just does an up and down transition for most
characters with a faked shift key for upper case alpha (see attached C code).

So, for some reason punctation and most control characters don't work, despite
all of my experiments with /anydown, /controlled, etc.  Admittedly, I am
hacking here and not taking the time to thoroughly understand UI.ps.  Possibly
there is some documentation I am missing?

Help me, oh UI.ps guru(s).  Only two weeks to connectathon!

Al Conrad
conrad@saturn.ucsc.edu

------------------------------------------------------------------------------


void
make_events_for_ascii( eventp, ascii, _nevents )
struct inputevent *eventp;
unsigned char ascii;
int *_nevents;
{
	if ( isalpha( ascii )  )
		if ( islower( ascii ) ) {
			
			mkevent( eventp, toupper( ascii ),
				 0, 0, (int) x, (int) y,
				 (*_nevents) );

			eventp->ie_shiftmask = 0;
			mkevent( eventp, toupper( ascii ),
				 IE_NEGEVENT, 0, (int) x, (int) y,
				 (*_nevents) );
		}
		else {
			mkevent( eventp, SHIFTCHAR,
				 0, 0, (int) x, (int) y,
				 (*_nevents) );

			eventp->ie_shiftmask = 0;
			mkevent( eventp, ascii & 0x7F,
				 0, 0, (int) x, (int) y,
				 (*_nevents) );

			eventp->ie_shiftmask = 0;
			mkevent( eventp, ascii & 0x7F,
				 IE_NEGEVENT, 0, (int) x, (int) y,
				 (*_nevents) );

			eventp->ie_shiftmask = 0;
			mkevent( eventp, SHIFTCHAR,
				 IE_NEGEVENT, 0, (int) x, (int) y,
				 (*_nevents) );
		}
	else {
			
		mkevent( eventp, ascii & 0x7F,
			 0, 0, (int) x, (int) y,
			 (*_nevents) );

		eventp->ie_shiftmask = 0;
		mkevent( eventp, ascii & 0x7F,
			 IE_NEGEVENT, 0, (int) x, (int) y,
			 (*_nevents) );
	}
}