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

Implement on-the-spot IME support for X11 #53682

Closed
wants to merge 2 commits into from

Conversation

raulsntos
Copy link
Member

Implements the linux part of #53658

Currently the area with the options is rendered in the wrong position:
image

Comment on lines +3797 to +4572
// Force on-the-spot for the over-the-spot style.
if ((xim_style & XIMPreeditPosition) != 0) {
xim_style &= ~XIMPreeditPosition;
xim_style |= XIMPreeditCallbacks;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is supposed to work.

The list of supported XIMStyles did not contain any with XIMPreeditCallbacks for me, I was only getting XIMPreeditPosition which is supposed to be over-the-spot (not on-the-spot), forcing it seems to work.

@akien-mga akien-mga requested a review from bruvzg October 11, 2021 18:26
@raulsntos raulsntos force-pushed the ime-linux branch 3 times, most recently from 9dbb93c to 2525b0f Compare October 14, 2021 08:27
@raulsntos
Copy link
Member Author

The window_set_ime_position method does not seem to work with the XIMPreeditCallbacks style, the XSetICValues method returns a non-null value so I guess that doesn't work.

I don't know how I'm supposed to update the position of the suggestion list when using XIMPreeditCallbacks.

::XPoint spot;
spot.x = short(p_pos.x);
spot.y = short(p_pos.y);
XVaNestedList preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, nullptr);
{
// Block events polling during this call
// because it triggers some event polling internally.
MutexLock mutex_lock(events_mutex);
XSetICValues(wd.xic, XNPreeditAttributes, preedit_attr, nullptr);
}
XFree(preedit_attr);

@mhilbrunner mhilbrunner requested a review from a team October 28, 2021 13:27
@voylin
Copy link
Contributor

voylin commented Dec 19, 2021

Thanks for your work on this, any idea when this may finally get reviewed so it can be added to the next update?

@raulsntos
Copy link
Member Author

The suggestion list still shows in the wrong position and I could not figure out why, so until that's resolved this won't be merged since it offers no benefit over the current implementation that uses over-the-spot.

If anyone more knowledgeable about X11 knows what I'm doing wrong I'd really appreciate the help.

@salty-godzilla
Copy link

I'm not familiar with X Input Method so I've been investigating for a few days, But unfortunately XIM may not have a way to specify a candidate position when using on-the-spot style. https://gist.github.com/garasubo/8ebb893f2af1950254df715fcf1de58e#gistcomment-4012210

In SDL2, the candidates are correctly displayed (at least in my Fcitx environment) at the position specified by SDL_SetTextInputRect (sample). But it looks like it is communicating directly with Fcitx (code) and IBus (code) through DBus...

@voylin
Copy link
Contributor

voylin commented Apr 3, 2022

I've been looking up some info about this, but it is a quite a bit above my level. I hope somebody will be able to do this by the time the beta's start rolling out.

@bruvzg
Copy link
Member

bruvzg commented Apr 4, 2022

I'm not familiar with X Input Method so I've been investigating for a few days, But unfortunately XIM may not have a way to specify a candidate position when using on-the-spot style.

If it's displayed under the window, I guess we can try adding an invisible sub-window as a host for IME, add use its position to move candidate window.

@raulsntos raulsntos marked this pull request as draft August 3, 2022 01:12
@raulsntos raulsntos modified the milestones: 4.0, 4.x Aug 3, 2022
@raulsntos
Copy link
Member Author

raulsntos commented Aug 3, 2022

I've tried to create a sub_window to use for IME but then the sub_window steals the focus and I can't give back focus to the main window because it seems when I try to focus back on the main window the LineEdit still has the focus and reopens the IME sub_window, maybe I'm doing it wrong.

For now, I rebased but I'm marking this PR as a draft and moving the milestone to 4.x since I don't think I'll finish this for 4.0. But if anyone wants to take over and implement this sooner then go ahead.

@voylin
Copy link
Contributor

voylin commented Sep 11, 2022

I may give this a try, not certain if I can succeed or not.
Don't have that much time so if I don't come up with anything within this month then I probably failed.

@raulsntos
Copy link
Member Author

Superseded by #70052

@raulsntos raulsntos closed this Jan 23, 2023
@raulsntos raulsntos deleted the ime-linux branch January 23, 2023 15:23
@aaronfranke aaronfranke removed this from the 4.x milestone Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants