[gnu.emacs.sources] Keyboard fix for emacs on risc/6000

merrick@magnus.acs.ohio-state.edu (Tom Merrick) (04/26/91)

This section of code will correct the cursor arrow keys, page up, page
down and backspace keys in emacs 18.57 for risc/6000s.  It is a listing
of the KeyPress area in x11term.c and basically includes a splitting of
the #ifndef AIX area so it will process the select code for the risc
boxes also.  Additionally the page up, page down, and backspace keys 
have been added to the select loop.

=====================================================================
KeyPress:
      nbytes = XLookupString (&event.xkey,
			      mapping_buf, 20, &keysym,
			      0);

#ifndef AIX
      /* Someday this will be unnecessary as we will
	 be able to use XRebindKeysym so XLookupString
	 will have already given us the string we want. */
      if (IsFunctionKey(keysym) ||
	  IsMiscFunctionKey(keysym)) {
	strcpy(mapping_buf,"[");
	strcat(mapping_buf,stringFuncVal(keysym));
#ifdef sun
	strcat(mapping_buf,"z");
#else
	strcat(mapping_buf,"~");
#endif /* sun */
	nbytes = strlen(mapping_buf);
      }
      else {
#endif /* AIX */
	switch (keysym) {
	case XK_Left:
	  strcpy(mapping_buf,"\002");
	  nbytes = 1;
	  break;
	case XK_Right:
	  strcpy(mapping_buf,"\006");
	  nbytes = 1;
	  break;
	case XK_Up:
	  strcpy(mapping_buf,"\020");
	  nbytes = 1;
	  break;
	case XK_Down:
	  strcpy(mapping_buf,"\016");
	  nbytes = 1;
	  break;
	case XK_Prior:
	  strcpy(mapping_buf,"\326");
	  nbytes = 1;
	  break;
	case XK_Next:
	  strcpy(mapping_buf,"\026");
	  nbytes = 1;
	  break;
	case XK_BackSpace:
	  strcpy(mapping_buf,"\177");
	  nbytes = 1;
	  break;
	}
#ifndef AIX
      }
#endif  /* not AIX */
      if (nbytes) {
	if ((nbytes == 1) && (event.xkey.state & Mod1Mask))
	  *mapping_buf |= METABIT;
	if ((nbytes == 1) && (event.xkey.state & ControlMask))
	  *mapping_buf &= 0x9F;		/* mask off bits 1 and 2 */
	if (numchars-nbytes > 0) {
	  bcopy (mapping_buf, bufp, nbytes);
	  bufp += nbytes;
	  count += nbytes;
	  numchars -= nbytes;
	}
      }
      break;
====================================================================

The next problem that I am looking into is that the mouse does not
mark the text properly.  Has anybody else noticed this or have a 
fix for it?

Tom Merrick
Ohio State University