Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!venera.isi.edu!raveling From: raveling@venera.isi.edu (Paul Raveling) Newsgroups: gnu.emacs Subject: Input remapping, Part 2 of 8: x11term.c Message-ID: <8719@venera.isi.edu> Date: 22 Jun 89 20:11:49 GMT Reply-To: raveling@venera.isi.edu (Paul Raveling) Distribution: gnu Organization: USC-Information Sciences Institute Lines: 135 HP/ISI input remapping files: Part 2 of 8 These are differences relative to the original src/x11term.c in GNU emacs version 18.54. Changes are: 1. Add routines keysymtostring and symtokeysym. These are functionally equivalent to XKeysymToString and XStringToKeysym, but they account for several unnamed keysyms which the X11R3 HP display server generates but which are not named. 2. Expand the size of mapping_buf; 20 characters proved a bit too restrictive. 3. Delete code for looking up special cases to remap after calling XLookupString. ALL equivalent mapping is now done by using elisp setup code to call x-rebind-keysym, and letting X11 map to the appropriate string. **** Warning **** This is a minimal change. It doesn't attempt to keep emacs from interpreting shift keys; if you rebind a shifted key to M-x something, emacs will probably generate shift-M-x something. -------- Since it may not be obvious from the diff listing, the context of the last 2 changes are: ... case KeyPress: nbytes = XLookupString (&event, ** Modified (byte count): mapping_buf, 120, &keysym, &status); ** Added: #if 0 /* No longer needed */ /* Someday this will be unnecessary as we will be able to use XRebindKeysym so XLookupString will have already given us the string we want. */ ... case XK_Down: strcpy(mapping_buf,"\016"); nbytes = 1; break; } } ** Added: #endif /* No longer needed */ if (nbytes) { ... ------------------------------ Cut Here -------------------------------- 24a25,26 > /* Modified to use keysym-to-string mapping, Paul Raveling/ISI */ > 224a227,289 > /* > Functions like XKeysymToString and XStringToKeysym > but with added knowledge of HP-specific keysyms: > */ > > char *keysymtostring ( keysym ) > > KeySym keysym; > > { > char *keystring; > > keystring = XKeysymToString ( keysym ); > if ( keystring != 0 ) > return keystring; > > /* Identify an HP-specific keysym */ > > switch ( keysym ) > { > case 0x1000FF74: return "Tab_backward"; > case 0x1000FF6C: return "Reset"; > case 0x1000FF6D: return "System"; > case 0x1000FF6E: return "User"; > case 0x1000FF6F: return "Clear_line"; > case 0x1000FF70: return "Insert_line"; > case 0x1000FF71: return "Delete_line"; > case 0x1000FF72: return "Insert_char"; > case 0x1000FF73: return "Delete_char"; > case 0x1000FF75: return "KP_Tab_backward"; > default: return 0; > } > } > > > KeySym stringtokeysym ( keystring ) > > char *keystring; > > { > KeySym keysym; > > keysym = XStringToKeysym ( keystring ); > if ( keysym != NoSymbol ) > return keysym; > > /* Identify an HP-specific keysym */ > > if ( strcmp(keystring, "Tab_backward") == 0 ) return 0x1000FF74; > if ( strcmp(keystring, "Reset") == 0 ) return 0x1000FF6C; > if ( strcmp(keystring, "System") == 0 ) return 0x1000FF6D; > if ( strcmp(keystring, "User") == 0 ) return 0x1000FF6E; > if ( strcmp(keystring, "Clear_line") == 0 ) return 0x1000FF6F; > if ( strcmp(keystring, "Insert_line") == 0 ) return 0x1000FF70; > if ( strcmp(keystring, "Delete_line") == 0 ) return 0x1000FF71; > if ( strcmp(keystring, "Insert_char") == 0 ) return 0x1000FF72; > if ( strcmp(keystring, "Delete_char") == 0 ) return 0x1000FF73; > if ( strcmp(keystring, "KP_Tab_backward") == 0 )return 0x1000FF75; > > return NoSymbol; > } > > 1214c1279 < char mapping_buf[20]; --- > char mapping_buf[120]; 1323c1388 < mapping_buf, 20, &keysym, --- > mapping_buf, 120, &keysym, 1324a1390 > #if 0 /* No longer needed */ 1358a1425 > #endif /* No longer needed */