[squeak-dev] International text input on X11

Yoshiki Ohshima Yoshiki.Ohshima at acm.org
Tue May 31 22:09:22 UTC 2016


Hi Tim,

As the VM changes for this matter is in shape (if I'm not mistaken,
the plugins.ext has to have ImmX11Plugin), the following image side
changes will greatly help the usability for kids in Japan and
elsewhere.  Can you add those at some point?

On Sun, May 15, 2016 at 1:19 PM, Yoshiki Ohshima
<Yoshiki.Ohshima at acm.org> wrote:
> Then on the image side, we need to fix ImmX11>>keyboardFocusForMorph:
> to support non-TextMorphs.  My feeble attempt involves to test whether
> the given morph understand #paragraph and make it read:
>
> -------------------
> keyboardFocusForAMorph: aMorph
>
>         aMorph ifNil: [^ self].
>         [
>                 | left bottom pos height |
>                 pos := aMorph preferredKeyboardPosition.
>                 left := (pos x min: Display width max: 0) asInteger.
>                 (aMorph respondsTo: #paragraph) ifTrue: [
>                         height := (aMorph paragraph
>                                 characterBlockForIndex: aMorph editor selectionInterval first) height
>                 ] ifFalse: [
>                         height := aMorph height].
>                 bottom := (pos y min: Display height max: 0) asInteger
>                          + height.
>                 self setCompositionWindowPositionX: left y: bottom asInteger
>         ] on: Error
>         do: [:ex |].
>
> -------------------
> (#asInteger is sent so that the primitive does not get floats.)
>
> and then to use it StringFieldMorph (and possible a few other classes)
> need its #keyboardFocusChange: to read:
>
> -------------------
> keyboardFocusChange: t1
>         (t1
>                         and: [isKeyboardFocus not])
>                 ifTrue: [lastContents := stringMorph contents].
>         (isKeyboardFocus
>                         and: [t1 not])
>                 ifTrue: [lastContents := nil.
>                         isNumeric
>                                 ifTrue: [self contents: stringMorph contents asNumberNoError printStringNoExponent].
>                         acceptWhenFocusLost
>                                 ifTrue: [self acceptEdits]].
>         isKeyboardFocus := t1.
>         isKeyboardFocus
>                 ifTrue: [selectionStart := 0.
>                         selectionEnd := stringMorph contents size].
>         "This line below"
>         isKeyboardFocus ifTrue: [ActiveHand compositionWindowManager keyboardFocusForAMorph: self].
>         self changed
> -------------------
>
> The result is that when the input method is enabled, and the user
> tries to type into a field, the preedit window shows up right there
> where you are typing in.


-- 
-- Yoshiki


More information about the Squeak-dev mailing list