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

Cefsharp/79 #3053

Closed
wants to merge 23 commits into from
Closed

Cefsharp/79 #3053

wants to merge 23 commits into from

Conversation

billshinji
Copy link
Contributor

@billshinji billshinji commented Feb 12, 2020

Fixes [issue-number]

Summary: [summary of the change and which issue is fixed here]

  • I have added a small code to WpfImeKeyboardHandler.cs to address a Hangul character (Korean alphabet) is not emitting to the current input box after a Hangul is composed by IME. In other words, a user cannot make a word or a sentence using Korean IME because every time a single character is composed, it disappears and start 'composing' mode all over again.
  • According to my inspection, it seems that Korean IME keeps producing characters while IME is in IME_COMPOSITION mode even before IME_ENDCOMPOSITION is sent. It is like laying eggs while a chicken is walking. Current approach to IME implemented in CefSharp.Wpf seems that in order to "finalize" composing a text, ImeSetComposition() must be first called, and then ImeFinishComposingText() must be called.
  • I am not an expert to IME programming so I cannot guarantee my solution (together with CefSharp.Wpf's approach to IME implementation) is appropriate. But I am a native Korean and it works as expected while not creating any side effects to Japanese or Chinese IME. I can speak/write Japanese or Chinese a little bit, so I also tested those IMEs as well.

Changes: [specify the structures changed]

  • I have modified CefSharp.Wpf.Experimental.WpfImeKeyboardHandler.cs like below:
  1. add the following code:
if (languageCodeId == ImeNative.LANG_KOREAN)
{
    owner.GetBrowserHost().ImeSetComposition(text, underlines.ToArray(), new Range(int.MaxValue, int.MaxValue), new Range(compositionStart, compositionStart));
    owner.GetBrowserHost().ImeFinishComposingText(false);
}

just below the following line inside the function OnImeComposition()

owner.GetBrowserHost().ImeCommitText(text, new Range(int.MaxValue, int.MaxValue), 0);

  1. move the following declarations to the top of the function (preferrably under string text = string.Empty;) in order to reference 'underlines' and 'compositionStart' in the newly-added code above:
var underlines = new List<CompositionUnderline>();
int compositionStart = 0;

I also figured out there is no side effects to Japanese or Chinese IME even if I skipped the if test (if (languageCodeId == ImeNative.LANG_KOREAN)) but I don't want to make any side effects not found during my own test. It is 'experimental' anyway and we need to improve the WPF IME problem over time.

How Has This Been Tested?

Using CefSharp.Wpf.Example.SimpleMainWindow.xaml, (and plugging in the experimental IME keyboard handler of course) I typed several Korean, Japanese, and Chinese sentences.

Windows 10.0.18363.592 (x64) - Korean, Japanese, and Chinese IME installed

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Updated documentation

Checklist:

  • Tested the code(if applicable)
  • Commented my code
  • Changed the documentation(if applicable)
  • New files have a license disclaimer
  • The formatting is consistent with the project (project supports .editorconfig)

- Prior to version 75 the Stream.Position was set to 0 before the ResourceHandler would read the Stream.
This restores that behaviour.
- Minor refactor of if statement for Stream.Can seek, only override ResponseLength with Stream.Length of not already set

Resolves #2903
- Some classes are now excluded
- Many minor fixes should hopefully reduce the number of errors reported by Sandcastle
- Some of the xml doc is generated by Atomineer, usually in cases where CEF lacks documentation
**Breaking Change**

Resolves #3026
- Include details on version 79.1.350 release
…n if called on Non UI Thread.

- Extract error message out into a internal const so it's not duplicated
- Manually check InternalIsBrowserInitialized() method instead of using the extension method

Resolves #3032
Swiftshader will be used for CPU based software rendering
It's possible to Dispose the browser before OnAfterBrowserCreated is called
resulting in a NRE when attempting to set WasHidden(true).

Resolves #3037
… to DataOut

Previously we'd read too many bytes and attempting to write them to dataOUt would cause a see System.NotSupportedException

Resolves #3038
There is no example of Cancel in the source code and the description in the doc doesn't
really provide a clear explanation of it's intended use case.

See code comment for further details
Adding some newer video/audio/font mappings

#3041
if CefSharpSettings.LegacyJavascriptBindingEnabled then register bound and boundAsync objects
Make it clear we are setting the default to DockStyle.Fill, this may not be expected
by some. It has been that way for 5+ years, so changing the default would be difficult
and unexpected, instead we make it clearer this is the case.

Resolves #3019
@amaitland amaitland closed this Feb 12, 2020
@amaitland
Copy link
Member

You must create your own fork, push your changes to GitHub then create a pull request.

Closed as invalid as no new code has been contributed.

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

Successfully merging this pull request may close these issues.

WPF - IME Windows 8.1/10/11
2 participants