-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[RDY] win32 ime #6223
[RDY] win32 ime #6223
Conversation
} | ||
case WindowsMessage.WM_IME_SETCONTEXT: | ||
{ | ||
// TODO if we implement preedit, disable the composition window: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically preedit and other advanced features are already in the API:
Avalonia/src/Avalonia.Input/TextInput/ITextInputMethodClient.cs
Lines 27 to 51 in d2347bf
bool SupportsPreedit { get; } | |
/// <summary> | |
/// Sets the non-committed input string | |
/// </summary> | |
void SetPreeditText(string text); | |
/// <summary> | |
/// Indicates if text input client is capable of providing the text around the cursor | |
/// </summary> | |
bool SupportsSurroundingText { get; } | |
/// <summary> | |
/// Returns the text around the cursor, usually the current paragraph, the cursor position inside that text and selection start position | |
/// </summary> | |
TextInputMethodSurroundingText SurroundingText { get; } | |
/// <summary> | |
/// Should be fired when surrounding text changed | |
/// </summary> | |
event EventHandler SurroundingTextChanged; | |
/// <summary> | |
/// Returns the text before the cursor. Must return a non-empty string if cursor is not at the beginning of the text entry | |
/// </summary> | |
string TextBeforeCursor { get; } | |
/// <summary> | |
/// Returns the text before the cursor. Must return a non-empty string if cursor is not at the end of the text entry | |
/// </summary> | |
string TextAfterCursor { get; } |
but we have this chicken and egg problem: platform code doesn't handle preedit and textbox doesn't support it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need some control in the control catalog or sandbox to test the platform support.
NotifyInputMethodUpdated(root); | ||
} | ||
|
||
public void NotifyInputMethodUpdated(ITextInputMethodRoot? root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exactly do we need this? Is it needed to handle keyboard layout switch between basic and IME-enabled languages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if that should be handled on the xplat layer though. I'd expect that state to be tracked by the platform code that encapsulates such switches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how other users do this, but for me I heavily rely on win+space to switch between en/zh on the fly.
The ime manager queries client capabilities when it gets focus (or init?), but doesn't handle IME switch when the control is focused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I'd expect the WindowImpl.cs to always have an active Imm32InputMethod
instance (just like X11Window does) that maintains its state rather than going through the requery process. Your approach also adds more ties between input method handling and toplevels while we are kinda planning to add built-in OSK support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WindowImpl
always have that. InputMethodManager
doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial idea was that InputMethodManager synchronizes the control with the native window implementation. The native window implementation is supposed to keep track of what was previously passed to it rather than requery that information on demand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Maybe it's possible to put the mutable states in IMM32InputMethod.
Good Job! can't wait to see this merged! |
I've merged this(with minor tweaks) to my private fork and our QA will test this until the weekend. I will notify about the result. For the first look - everything is perfect. |
We are missing some things:
Possible Improvement: |
Also here is a some bugs:
|
This PR was completed with that one #7007 |
wip, does not work yetwip, partially working.Almost ready now.
Problems/TODO:
This is a TextBox bug.A TextBoxTextInputMethodClient bug.Composition content support(Let's save it for the next time...)