Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic IME support rebase #1858

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

KentaTheBugMaker
Copy link

@KentaTheBugMaker KentaTheBugMaker commented May 20, 2023

General

This PR fix #979,#1544.
iced ime support was broken due to winit 0.27 update .
This PR add event to fit new winit IME event model and introduce new event support for text_input.

how to test

download app from my repo https://github.com/KentaTheBugMaker/iced_text_input_sample/

Phase 1 : Can we input CJK characters?

tested on

  • windows MS-IME

Phase 2 : Candidate position is near the TextInput?

You maybe failed to reproduce due to IME version.
candidate positon on X11 require LibX11 1.8.2 or above.

Wayland requirement.

  • input_method_v2 popups

tested on

  • windows MS-IME

Phase 3 draw underline and cursor

behavior

2022-12-05.23-27-59.mp4

test

not required.
We render underline and cursor correctly if winit correctly report it.

  • windows

Note

I don't have a macos device, so if you notice any problems, macos users please fix them.

Some tests were done by other users. but Iced rework enforce me to reimplement completely.
Therefore old tests are not compatible with this version.

feel free to reimplement this.

@AllenDang
Copy link

I tracked this pr daily, hope to see it will be merged into main brach some day.

@hecrj hecrj added this to the 0.12.0 milestone May 23, 2023
@hecrj
Copy link
Member

hecrj commented May 23, 2023

Work related to IME is slated around the 0.12 release. See the ROADMAP.

I will take a look at this by then!

@rhysd
Copy link

rhysd commented Aug 11, 2023

Thank you for working on this. This is a mandatory feature for CJK users.

I tried this branch on macOS and I found one small issue. When some character was already input before a cursor, the insert position of IME candidates was a bit wrong.

test.mov
  1. Enable Japanese IME
  2. Type aiueo and Return
  3. Text あいうえお is inserted
  4. Type kakikukeko
  5. Expected the candidate かきくけこ was positioned at after お, but it was actually positioned before お

After selecting the candidate, the text かきくけこ is inserted at correct position. So only the position of IME candidate is wrong.

@hecrj hecrj modified the milestones: 0.13.0, 0.14.0 Sep 9, 2023
@tingfeng-key
Copy link

image

run iced-ime_adavanced_text\examples\todos

@KentaTheBugMaker
Copy link
Author

We can't measure width of IME candidate window.
So some overflow may occur but it seems to too large overflow.
We offset candidate window when text content overflow the TextInput widget.

@tingfeng-key
Copy link

image
It's normal, thank you for your efforts

@bajie-git
Copy link

bajie-git commented Nov 17, 2023

image

The default windows input method can be used normally, but the "Sogou input method" still has problems, and the console will prompt: "libpng warning: iCCP: known incorrect sRGB profile"

@KentaTheBugMaker
Copy link
Author

iced now using winit 0.28.6 fork.
therefore you need to test winit ime example.
if same problem ocurred we can't fix this problem.

@Taiyangqihuo
Copy link

Awesome work!

@Drodofsky
Copy link

Hi, I understand that IME is scheduled for a later release in the roadmap, but it is a crucial feature for me and many others. Please consider moving IME to an earlier release. What is still needed before this feature can be merged? Thank you for the incredible work!

@KentaTheBugMaker
Copy link
Author

@hecrj
IME support is a fundamental feature for non-European users.
What's blocking this PR ?
or We need to make some RFC for IME?

@Gezx
Copy link

Gezx commented Sep 20, 2024

is it support text_editor?

@KentaTheBugMaker
Copy link
Author

@Gezx
no when i first wrote there ware no TextEditor widget.
but I have plan to extend to support it.

@bioinformatist
Copy link

@KentaTheBugMaker Hey bro, are you still working on this?

@KentaTheBugMaker
Copy link
Author

@bioinformatist
Yes . Working on but I'm trying the better way to support it .
currently my implementation is based on winit.
but winit API is too poor to support native like quality.

  • focus in and focus out .
  • Text highlighting
  • Placing candidate window

Iced side also have problem.

if want to support TextEdit widget we need to support below

  • setting up input cursor
  • underline rendering
  • placing candidate window

current design have these difficulties.

  • We need to touch too many files (Clipboard like implementation)
  • We need some hack to support platform behavior

so I'm re implementing this with better GTK IMContext like API.

           iced-widget
                |
       ___________ _________________________________
      |           |                               |
iced-winit iced-ime(IME backend impl)   iced-core(IME api difinition)

New design .

  • we don't touch other widgets.
  • we don't touch iced-winit.
  • We don't need platform dependent hack (We use platform Native API in backend)
  • easier addon to support other IM
    currently I'm working on IBus support.

@Domiryuu
Copy link

Domiryuu commented Oct 9, 2024

I want to express my deep thanks for your continued effort on this.

@bioinformatist
Copy link

@KentaTheBugMaker Really appreciate!

@KentaTheBugMaker
Copy link
Author

KentaTheBugMaker commented Oct 12, 2024

progress
ibus testing.
Iced Key to xkb keysym and keycode is not difficult.
most of Iced Key events is tunneling winit ones.
I tested it by very small winit project.
therefore we don't have to touch iced-winit deeply.
but maybe candidate window placing maybe difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IME input method on iced application (fcitix on linux)