obsproject / obs-browser

CEF-based OBS Studio browser plugin
GNU General Public License v2.0
777 stars 221 forks source link

IME can't input chinese or japanese except ascii characters #69

Closed shadow0162 closed 7 years ago

shadow0162 commented 7 years ago

Version: Windows 7 cef_binary_3.2987.1592.gfbafd4e_windows64 obsstudio 17.0.2 pluginVersion 1.24.0 I can't input any asia characters(chinese or japanese) by IME. In the browser, it's only show ascii characters, not right word.When I press keys, in obs ui there is a label for preview. But in browser plugin the label is never popup. please see attach pic/ obs ui: image Browser plugin: image

I found that cef has been sopport for all text input types. see attach thread https://bitbucket.org/chromiumembedded/cef/issues/1610/ime-not-positioned-correctly-in-windows

shadow0162 commented 7 years ago

I guess the way to send key event is inappropriate.

void BrowserManager::Impl::SendKeyClick(int browserIdentifier,
    const struct obs_key_event *event, bool keyUp)
{
    ExecuteOnBrowser(browserIdentifier, [&](CefRefPtr<CefBrowser> b)
    {

        CefKeyEvent e;
        e.windows_key_code = event->native_vkey;
        e.native_key_code = 0;

        e.type = keyUp ? KEYEVENT_KEYUP : KEYEVENT_RAWKEYDOWN;

        if (event->text) {
            char16 *characters;
            os_utf8_to_wcs_ptr(event->text, 0, &characters);
            if (characters) {
                e.character = characters[0];
                bfree(characters);
            }
        }

        //e.native_key_code = event->native_vkey;
        e.modifiers = event->modifiers;

        b->GetHost()->SendKeyEvent(e);
        if (event->text && !keyUp) {
            e.type = KEYEVENT_CHAR;
            // Figure out why this works
            e.windows_key_code = e.character;
            e.character = 0;
            b->GetHost()->SendKeyEvent(e);
        }

    });
}
shadow0162 commented 7 years ago

When I wanna input Chinese Character,However, the effect is as follows: error1: http://www.wpfui.com/share/1111.jpg error2: http://www.wpfui.com/share/2222.png gif error3: http://www.wpfui.com/share/3333.gif

shadow0162 commented 7 years ago

bad luck! Can't input any text on mac 10.12.2.the problem also have in new release obs version 18.X

OsirisNL commented 7 years ago

Browser source does not support IME

shadow0162 commented 7 years ago

Oh,It seems that I have to use QWebView