Mantis - Squeak
Viewing Issue Advanced Details
7817 VM minor always 04-13-14 14:38 12-10-14 15:59
lewis  
lewis  
normal  
assigned  
open  
none    
none  
0007817: Fix vm-display-X11 problem for Japanese character input
Fix provided by Hachisuka-San in Aichi Sangyo University

Reported by TAKAHASHI Makoto (makoto at kobe-u.ac.jp)

Posted by Hilaire Fernandes on Pharo list
http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2014-April/094588.html [^]

Proposed fix for vm-display-X11/sqUnixX11.c is included in post from Hilaire.
Fix excerpted from mailing list post:
De : "TAKAHASHI Makoto" <makoto at kobe-u.ac.jp>
Date : 11 avr. 2014 15:46
Objet : Re: Japanese input in DrGeo
: <hilaire.fernandes at gmail.com>
Cc :

Hello Hilarie,

Recently, Hachisuka-San in Aichi Sangyo University has resolved the issue
of Scratch in Linux.
http://www.asu.ac.jp/hachi/v3/scratch14ime.html [^]

Unfortunately, this page is written in Japanese. (However you can see
codes.)
The resolution of the problem in DrGeo is as follows:
1. In drgeo.sh, add exec options '-compositioninput' like
exec "$VM/pharo" \
        -plugins "$VM" \
        -encoding utf-8 \
        -vm-display-X11 \
        -compositioninput \
        "$image"

2. Change recordPendingKeys(void) in vm-display-X11/sqUnixX11.c as follows
and
rebuild vm-display-X11.

static int recordPendingKeys(void)
{
  if (inputCount <= 0) {
    if (inputBuf != inputString) {
      free(inputBuf);
      inputBuf= inputString;
    }
    return 0;
  }

  int utf32 = 0;
  while (inputCount > 0) {
        //110x xxxx 10xx xxxx
        if(inputCount >= 2 &&
           pendingKey[0] >= 0xc0 && pendingKey[0] <= 0xdf &&
           pendingKey[1] >= 0x80 && pendingKey[1] <= 0xbf)
                {
                utf32 = ((pendingKey[0] & 0x1f) << 6) |
                         (pendingKey[1] & 0x3f);
                recordKeyboardEvent(0, EventKeyDown, modifierState, utf32);
                recordKeyboardEvent(0, EventKeyChar, modifierState, utf32);
                pendingKey+=2;
                inputCount-=2;
        //1110 xxxx 10xx xxxx 10xx xxxx
        } else if(inputCount >= 3 &&
                  pendingKey[0] >= 0xe0 && pendingKey[0] <= 0xef &&
                  pendingKey[1] >= 0x80 && pendingKey[1] <= 0xbf &&
                  pendingKey[2] >= 0x80 && pendingKey[2] <= 0xbf)
                {
                utf32 = ((pendingKey[0] & 0x0f) << 12) |
                        ((pendingKey[1] & 0x3f) << 6) |
                         (pendingKey[2] & 0x3f);
                recordKeyboardEvent(0, EventKeyDown, modifierState, utf32);
                recordKeyboardEvent(0, EventKeyChar, modifierState, utf32);
                pendingKey+=3;
                inputCount-=3;
        //1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx
        } else if(inputCount >= 4 &&
                  pendingKey[0] >= 0xf0 && pendingKey[0] <= 0xf7 &&
                  pendingKey[1] >= 0x80 && pendingKey[1] <= 0xbf &&
                  pendingKey[2] >= 0x80 && pendingKey[2] <= 0xbf &&
                  pendingKey[3] >= 0x80 && pendingKey[3] <= 0xbf)
                {
                utf32 = ((pendingKey[0] & 0x07) << 18) |
                        ((pendingKey[1] & 0x3f) << 12) |
                        ((pendingKey[2] & 0x3f) << 6) |
                         (pendingKey[3] & 0x3f);
                recordKeyboardEvent(0, EventKeyDown, modifierState, utf32);
                recordKeyboardEvent(0, EventKeyChar, modifierState, utf32);
                pendingKey+=4;
                inputCount-=4;
        } else {
                recordKeyboardEvent(*pendingKey, EventKeyDown,
modifierState, 0);
                recordKeyboardEvent(*pendingKey, EventKeyChar,
modifierState, 0);
                recordKeystroke(*pendingKey); /* DEPRECATED */
                pendingKey++;
                inputCount--;
        }
  }
  return 1;
}

3. Exchange vm-display-X11 in DrGeo.app/Contents/Linux.

I tried this resolution. Finally I can put japanese character in DrGeo in
LinuxMint 16.




TAKAHASHI Makoto E-mail makoto at kobe-u.ac.jp
 drgeojapaneseinput.png [^] (93,330 bytes) 04-13-14 14:40
 sqUnixX11.c [^] (183,451 bytes) 04-13-14 14:50

Notes
(0014495)
lewis   
04-13-14 14:47   
Original problem description and fix are at http://www.asu.ac.jp/hachi/v3/scratch14ime.html [^]

The attached sqUnixX11.c is from that web page.

(0014521)
lewis   
12-10-14 15:59   
Hillaire posted a follow up inquiry from
TAKAHASHI Makoto:

http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2014-December/103882.html [^]