tomooda / PharoIM

InputMethod support for Pharo on headless VMs
MIT License
6 stars 0 forks source link

RubAbstractTextArea>>keyboardFocusChange: aBoolean Rectangle maybe create wrong #18

Closed liangbing64 closed 2 years ago

liangbing64 commented 2 years ago

keyboardFocusChange: aBoolean

aBoolean
    ifTrue: [ 
        self hasFocus: true.
        editing := false.
        self requestTextEditingAt:
            ((self cursor positionInWorld corner: self cursor positionInWorld) 
                 translateBy: 0 @ (self font height + 4)) truncated.

(self cursor positionInWorld corner: (self cursor positionInWorld 
                 translateBy: 0 @ (self font height + 4))) truncated.

        self showOverEditableTextCursor ]
    ifFalse: [ 
        self hasFocus: false.
        self requestStopTextEditing.
        editing = true ifTrue: [ editing := false ].
        self hideOverEditableTextCursor ].
super keyboardFocusChange: aBoolean
tomooda commented 2 years ago

I honestly don't have a good documentation of SDL_SetTextInputRect(). Do you know any documentation that explains what rectangle is expected as the argument? I know the official document at https://wiki.libsdl.org/SDL_SetTextInputRect , but the argument rect is poorly explained. Your interpretation seems reasonable, and I'd appreciate if you give me a pointer to a better documentation.

liangbing64 commented 2 years ago

sorry, I know nothing about SDL2. I mean ((self cursor positionInWorld corner: self cursor positionInWorld) translateBy: 0 @ (self font height + 4)) truncated. the result rectangle's origin and corner are the same point . not a real rectangle。Thank your help on IME.

tomooda commented 2 years ago

Okay, I think your code looks good and I will commit it in a few days. Thank you for your contribution! 👍

tomooda commented 2 years ago

merged to tomooda/PharoIM:main (https://github.com/tomooda/PharoIM/commit/0c7c25652d304059f5671972cd4e9f69ba0b3944). PR sent to pharo-project/pharo:Pharo11 (https://github.com/pharo-project/pharo/pull/11474). Let's hope it'll be merged. 😄

tomooda commented 2 years ago

The PR is now merged into Pharo11. Thank you for improving PharoIM and Pharo, @liangbing64