Keyboard Trouble

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Tue Aug 10 15:06:03 UTC 1999


On Wed, 4 Aug 1999, Gilson Costa wrote:

> I'm using an Intel computer (Pentium) with an international keyboard
> (us+ keytable). The only key that doesn't work is the quote key, giving
> me a Yen (¥)  sign. In my keyboard the same key is used to get double
> quotes. Any ideas why this happens?

I assume you're running Linux? 

Two problems here: First, to enter the Squeak string delimiting quotes (') 
you have to find the key generating an apostrophe. That's not a Squeak
problem. Run "xev" to check. If the keyboard is not configured correctly,
change your X keyboard mapping with "xmodmap". In my .xmodmap I have
this line: 
	keycode 51 = numbersign apostrophe
because the single quote is shift-# on my keyboard.

Second problem: You still won't get the acute accent (´) but a Yen (¥) 
sign in Squeak even if you want to. This is because Ian's VM still doesn't
translate keys into Squeak's character set (Windows VM does, Mac VM
doesn't need to). I sent a patch a while ago that corrected some keys, but
placed a bullet sign on the acute key. I'll attach a new version. Just do
a "patch < keyboard.diff" in your src directory and recompile.

  /bert


Content-Type: TEXT/PLAIN; charset=US-ASCII; name="keyboard.diff"
Content-ID: <Pine.LNX.3.96.990810170603.643B at balloon.cs.uni-magdeburg.de>
Content-Description: 

*** ftp/sqXWindow.c	Tue Aug 10 16:35:50 1999
--- src/sqXWindow.c	Tue Aug 10 16:29:05 1999
***************
*** 997,1002 ****
--- 997,1025 ----
  
  /*** Event Recording Functions ***/
  
+ /* Conversion table from X to Squeak */
+ 
+ unsigned char const X_to_Squeak[256] =
+ {
+   /* 0 - 127 omitted */
+   196, 197, 165, 201, 209, 247, 220, 225,     /* 128 - 135 */
+   224, 226, 228, 227, 198, 176, 170, 248,     /* 136 - 143 */
+   213, 206, 195, 207, 211, 212, 210, 219,     /* 144 - 151 */
+   218, 221, 246, 245, 250, 249, 251, 252,     /* 152 - 159 */
+   160, 193, 162, 163, 223, 180, 182, 164,     /* 160 - 167 */
+   172, 169, 187, 199, 194, 173, 168, 255,     /* 168 - 175 */
+   161, 177, 178, 179, 171, 181, 166, 183,     /* 176 - 183 */
+   184, 185, 188, 200, 186, 189, 202, 192,     /* 184 - 191 */
+   203, 231, 229, 204, 128, 129, 174, 130,     /* 192 - 199 */
+   233, 131, 230, 232, 237, 234, 235, 236,     /* 200 - 207 */
+   208, 132, 241, 238, 239, 205, 133, 215,     /* 208 - 215 */
+   175, 244, 242, 243, 134, 217, 222, 167,     /* 216 - 223 */
+   136, 135, 137, 139, 138, 140, 190, 141,     /* 224 - 231 */
+   143, 142, 144, 145, 147, 146, 148, 149,     /* 232 - 239 */
+   240, 150, 152, 151, 153, 155, 154, 214,     /* 240 - 247 */
+   191, 157, 156, 158, 159, 253, 254, 216,     /* 248 - 255 */
+ };
+ 
  
  static int translateCode(KeySym symbolic)
  {
***************
*** 1033,1038 ****
--- 1056,1075 ----
  }
  
  
+ void keyBufAppend(int keystate)
+ {
+   /* bug: this should be rewritten to cope with nConv > 1 */
+   keyBuf[keyBufPut]= keystate;
+   keyBufPut= (keyBufPut + 1) % KEYBUF_SIZE;
+   if (keyBufGet == keyBufPut)
+     {
+       /* buffer overflow; drop the last character */
+       keyBufGet= (keyBufGet + 1) % KEYBUF_SIZE;
+       keyBufOverflows++;
+     }
+ }
+ 
+ 
  void recordKeystroke(XKeyEvent *theEvent)
  {
    int keystate;
***************
*** 1047,1055 ****
    if (nConv == 0 && (keystate= translateCode(symbolic)) < 0)
      return;	/* unknown key */
  
! #if 0
!   if (keystate == 127) keystate= 8;	/* DEL --> BS */
! #endif
  
    keystate|= (modifierMap[(theEvent->state) & 0xF] << 8);
  
--- 1084,1091 ----
    if (nConv == 0 && (keystate= translateCode(symbolic)) < 0)
      return;	/* unknown key */
  
!   if (keystate > 127)
!     keystate = X_to_Squeak[keystate - 128];
  
    keystate|= (modifierMap[(theEvent->state) & 0xF] << 8);
  
***************
*** 1061,1075 ****
      }
    else
      {
!       /* bug: this should be rewritten to cope with nConv > 1 */
!       keyBuf[keyBufPut]= keystate;
!       keyBufPut= (keyBufPut + 1) % KEYBUF_SIZE;
!       if (keyBufGet == keyBufPut)
! 	{
! 	  /* buffer overflow; drop the last character */
! 	  keyBufGet= (keyBufGet + 1) % KEYBUF_SIZE;
! 	  keyBufOverflows++;
! 	}
      }
  }
  
--- 1097,1103 ----
      }
    else
      {
!       keyBufAppend(keystate);
      }
  }
  
***************
*** 1082,1087 ****
--- 1110,1120 ----
      case 1: stButtons= 4; break;
      case 2: stButtons= 2; break;
      case 3: stButtons= 1; break;
+     case 4:
+     case 5: keyBufAppend( (theEvent->button + 26)        /* Up/Down */
+ 		       | (2 << 8)                          /* Ctrl  */
+ 		       | (modifierMap[(theEvent->state) & 0xF] << 8));
+             return;
      default: ioBeep(); break;
      }
  





More information about the Squeak-dev mailing list