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

X11: Use bottom-right corner of IME cursor area as caret position. #3966

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xorgy
Copy link

@xorgy xorgy commented Oct 23, 2024

XIM servers currently do not support preedit area reporting from
clients and there may be no standard way to report it.

Fcitx and iBus both place the candidate window descending descending
from the caret, with the reported X font; but since winit does not
report a font, the height of the line is assumed 0, so when we report
the top left corner of the cursor area they will tend to obscure it.

Taking this into account, the best default option is to report the
bottom right corner of the cursor area, because it will tend not to
obscure the preedit area when using Window::set_ime_cursor_area in
the way suggested by documentation.

Fixes #3965

Copy link
Member

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

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

This is generally not correct, though, since the intended way to do is to pass an area that shouldn't be obscured rather than offset. The concepts are different here, I'd say.

Probably something from XNPreeditArea is how it should work.

I generally won't block this patch, but it should be mentioned in the docs what it does and probably we should suggest to pass just a line generally for cursor to not hit bugs in various setups.

@xorgy
Copy link
Author

xorgy commented Oct 24, 2024

That's fair, I can add documentation changes to that effect, and a couple comments in the backend mentioning other possible ways to do preedit area reports (though I haven't found any IM servers implementing PreeditArea so far).

XIM servers currently do not support preedit area reporting from
clients and there may be no standard way to report it.

Fcitx and iBus both place the candidate window descending descending
from the caret, with the reported X font; but since winit does not
report a font, the height of the line is assumed 0, so when we report
the top left corner of the cursor area they will tend to obscure it.

Taking this into account, the best default option is to report the
bottom right corner of the cursor area, because it will tend not to
obscure the preedit area when using `Window::set_ime_cursor_area` in
the way suggested by documentation.
@xorgy
Copy link
Author

xorgy commented Oct 25, 2024

I've added more to the documentation about the behavior, and added comments for rationale.

@xorgy xorgy changed the title X11: Calculate ime cursor position correctly. X11: Use bottom-right corner of IME cursor area as caret position. Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

set_ime_cursor_area uses the top left corner of the rectangle as the composition/cursor point on X11
2 participants