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

Windows: IME not positioned correctly with embedded windowed browser #3306

Closed
magreenblatt opened this issue Apr 7, 2022 · 39 comments
Closed
Labels
bug Bug report Framework Related to framework code or APIs windows Windows platform

Comments

@magreenblatt
Copy link
Collaborator

Original report by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


I know there was already a issue (#1610) with the same name and was fixed. Here is the new one.

When using the Microsoft Pinyin on Windows, the IME window is not positioned next to the input field that has focus.

First configure for Chinese IME Microsoft Pinyin on windows 10 21H2:

  1. Windows Settings->Time & Language->Language, On the right, click Add a language.
  2. Choose a language to install, search Chinese, select Chinese (Simplified, China), click next. Install.
  3. In the Preferred languages list, select Chinese (Simplified, China), click Options, and under Keyboards, click Add a Keyboard, select Microsoft Pinyin.

Reproducing the problem:

  1. Download prebuilt cef binard from CEF Automated Builds (spotifycdn.com), I’ve tested with cef_binary_100.0.14+g4e5ba66+chromium-100.0.4896.75_windows32_client.tar.bz2
  2. Extract files to a folder, and run cefclient.exe
  3. In the Language bar on the desktop or select under taskbar tray, change the input language to Chinese, Microsoft Pinyin
  4. Click in the page’s google search box, type aaa and press space, Microsoft Pinyin will input three chinese characters, and IME window positioned correctly.
  5. Click in the cefclient demo’s address bar, and type aaa and press space, Microsoft Pinyin will input three chinese characters, and IME window positioned correctly.
  6. Click in the page’s google search box, type aaa, the IME window not positioned correctly.

I’ve tested CEF78,92,100, under Windows 10,11 on five machines, all of them have this issue.


@magreenblatt
Copy link
Collaborator Author

Original changes by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


  • edited description

@magreenblatt
Copy link
Collaborator Author

Original comment by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


It seems that, if cefclient.exe lost focus, and we reactivate cefclient window and type in google search, the IME window will display in wrong position immediately.

@magreenblatt
Copy link
Collaborator Author

Original changes by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


  • edited description

@magreenblatt
Copy link
Collaborator Author

How does it behave with cefclient --use-views and cefclient --enable-chrome-runtime ?

@magreenblatt
Copy link
Collaborator Author

Original comment by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


Both cefclient --use-views and cefclient --enable-chrome-runtime work correctly, no problem.

@magreenblatt
Copy link
Collaborator Author

  • changed component from "Unclassified" to "Framework"
  • changed title from "IME not positioned correctly in Windows" to "Windows: IME not positioned correctly with embedded windowed browser"
  • changed priority from "major" to "minor"

@magreenblatt
Copy link
Collaborator Author

See also issue #3313.

@magreenblatt
Copy link
Collaborator Author

Original comment by Dylan Deng (Bitbucket: Dylan, GitHub: Dylan).


I think this problem is different from #3313. In the non-off-screen rendering mode, the same problem will happen.

@magreenblatt
Copy link
Collaborator Author

Agreed, issue #3313 is a different problem (with OSR, the IME code is implemented in cefclient).

@magreenblatt
Copy link
Collaborator Author

Testing with current master (M105), I am able to reproduce this issue every time I type in the text field with Chinese or Japanese (instructions from issue #3313). Similar to issue #3313, it starts in the bottom-right corner on the 1st character but then jumps to the top-left corner on 2nd+ character.

When misbehaving the composition mode also behaves differently. It shows the characters in a window specific to the IME editor instead of showing them in the search field. The search field is only populated after accepting the composition.

This reproduces with both cefclient and cefsimple.

@magreenblatt
Copy link
Collaborator Author

With logging in RootWindowWin and DesktopWindowTreeHostWin, the IME messages change substantially between “correct” and “incorrect” placement cases. In the “correct” case it looks like some other code or window is handling the composition-related IME events (WM_IME_REQUEST, WM_IME_STARTCOMPOSITION, WM_IME_COMPOSITION, WM_IME_ENDCOMPOSITION).

With correct IME window placement (native parent):

RootWindowWin::RootWndProc WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
RootWindowWin::RootWndProc WM_IME_NOTIFY WPARAM 2 LPARAM 0
RootWindowWin::RootWndProc WM_IME_REQUEST WPARAM 6 LPARAM [20307208 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20307208)
RootWindowWin::RootWndProc WM_IME_NOTIFY WPARAM 8 LPARAM 0
RootWindowWin::RootWndProc WM_IME_NOTIFY WPARAM 6 LPARAM 0
RootWindowWin::RootWndProc WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0

With correct IME window placement (--use-views):

DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 2 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 2 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 8 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 6 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 2 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0

With incorrect IME window placement:

RootWindowWin::RootWndProc WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
RootWindowWin::RootWndProc WM_IME_NOTIFY WPARAM 2 LPARAM 0
RootWindowWin::RootWndProc WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 5 LPARAM 1
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20310656 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20310656)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20310652 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20310652)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20310656 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20310656)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20310652 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20310652)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20309520 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20309520)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20309516 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20309516)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_STARTCOMPOSITION WPARAM 0 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 15 LPARAM [161548213 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/161548213)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20305608 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20305608)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20305604 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20305604)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 15 LPARAM [161548213 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/161548213)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20306520 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20306520)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20306516 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20306516)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_COMPOSITION WPARAM 97 LPARAM 440
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 269 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [20310296 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/20310296)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 15 LPARAM [161548213 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/161548213)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 15 LPARAM [161548213 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/161548213)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 7 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_COMPOSITION WPARAM 97 LPARAM 7168
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_ENDCOMPOSITION WPARAM 0 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 15 LPARAM [161548213 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/161548213)
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 270 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_CHAR WPARAM 97 LPARAM 1

@magreenblatt
Copy link
Collaborator Author

In the “correct” case, InputMethodWinTSF::OnDidChangeFocusedClient sets |focused| as the focused client and is followed by a call to InputMethodWinTSF::OnFocus. In the “incorrect” case, OnDidChangeFocusedClient is still called followed by OnFocus, but OnDidChangeFocusedClient does not set |focused| as the focused client. Looks like this is due to InputMethodWinBase::IsWindowFocused returning false.

However, fixing the above IsWindowFocused behavior does not resolve the issue. Adding more logging and testing by entering a character, then changing windows (loose focus), then returning to the cefclient window (gain focus), then entering another character:

With “correct” behavior (--use-views):

DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 2 LPARAM 0
InputMethodWinTSF::OnDidChangeFocusedClient is_window_focused=1 is_text_client_focused=1
TSFBridgeImpl::SetFocusedClient focused_window=000F0AB6 client=4C60FD68
InputMethodWinTSF::OnFocus
TSFBridgeImpl::RemoveFocusedClient client=4C60FD68
InputMethodWinTSF::OnDidChangeFocusedClient is_window_focused=0 is_text_client_focused=0
TSFBridgeImpl::RemoveFocusedClient client=4C60FD68
InputMethodWinTSF::OnBlur
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 2 LPARAM 0
InputMethodWinTSF::OnDidChangeFocusedClient is_window_focused=1 is_text_client_focused=1
TSFBridgeImpl::SetFocusedClient focused_window=000F0AB6 client=4C60FD68
InputMethodWinTSF::OnFocus
TSFBridgeImpl::RemoveFocusedClient client=4C60FD68
InputMethodWinTSF::OnDidChangeFocusedClient is_window_focused=0 is_text_client_focused=0
TSFBridgeImpl::RemoveFocusedClient client=4C60FD68
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0
TSFBridgeImpl::RemoveFocusedClient client=4C60FD68

With “incorrect” behavior”:

RootWindowWin::RootWndProc WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
RootWindowWin::RootWndProc WM_IME_NOTIFY WPARAM 2 LPARAM 0
RootWindowWin::RootWndProc WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
InputMethodWinTSF::OnFocus
InputMethodWinTSF::OnDidChangeFocusedClient is_window_focused=1 is_text_client_focused=1
TSFBridgeImpl::SetFocusedClient focused_window=00550A22 client=4C04F4C8
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 2 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 8 LPARAM 0
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 6 LPARAM 0
InputMethodWinTSF::OnDidChangeFocusedClient is_window_focused=0 is_text_client_focused=0
TSFBridgeImpl::RemoveFocusedClient client=4C04F4C8
InputMethodWinTSF::OnBlur
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_NOTIFY WPARAM 1 LPARAM 0
RootWindowWin::RootWndProc WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
RootWindowWin::RootWndProc WM_IME_NOTIFY WPARAM 2 LPARAM 0
InputMethodWinTSF::OnDidChangeFocusedClient is_window_focused=1 is_text_client_focused=1
TSFBridgeImpl::SetFocusedClient focused_window=00550A22 client=4C04F4C8
RootWindowWin::RootWndProc WM_IME_SETCONTEXT WPARAM 0 LPARAM -1073741809
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
InputMethodWinTSF::OnFocus
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_REQUEST WPARAM 6 LPARAM [4121456 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/4121456)
... and more unexpected DesktopWindowTreeHostWin::HandleIMEMessage
InputMethodWinTSF::OnDidChangeFocusedClient is_window_focused=0 is_text_client_focused=0
TSFBridgeImpl::RemoveFocusedClient client=4C04F4C8
InputMethodWinTSF::OnBlur
DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_COMPOSITION WPARAM 97 LPARAM 7168
... and more unexpected DesktopWindowTreeHostWin::HandleIMEMessage
TSFBridgeImpl::RemoveFocusedClient client=4C04F4C8

@magreenblatt
Copy link
Collaborator Author

Looks like the DesktopWindowTreeHostWin::HandleIMEMessage implementation is not actually involved in this problem, since removing the contents of that method and always returning false makes no change in the observed behavior. So, this is likely an issue with TSFBridge/InputMethodWinTSF not handling these IME events after browser re-focus, and then DefWindowProc providing the “incorrect” behavior as the resulting default.

@magreenblatt
Copy link
Collaborator Author

Original comment by WONHEE JEONG (Bitbucket: WONHEE JEONG).


When I create a browser with CefBowerHost::CreateBrowser() as child, I have the same issue in Korean Input mode too but in english mode is not.

I tried the following method to bypass this issue.

  • In CefFocusHandler::OnGotFocus, Find `Chrome_WidgetWin_0` window in host window(CefBrowserWindow).
  • Get `Chrome_WidgetWin_0` window and call ::SetFocus with this handle.

I don't know why the issue was resolved this way. But it was temporarily resolved.

@magreenblatt
Copy link
Collaborator Author

One difference between Views a non-Views on re-focus is that is this code is failing in TSFEventRouter::Delegate::SetManager. thread_manager->GetFocus is returning NULL in the non-Views case. Call stack:

>	ui_base_ime_win.dll!ui::TSFEventRouter::Delegate::SetManager(ITfThreadMgr * thread_manager) Line 194	C++
 	ui_base_ime_win.dll!ui::TSFEventRouter::SetManager(ITfThreadMgr * thread_manager) Line 291	C++
 	ui_base_ime_win.dll!ui::InputMethodWinTSF::OnFocus() Line 51	C++
 	views.dll!views::DesktopNativeWidgetAura::HandleActivationChanged(bool active) Line 484	C++
 	views.dll!views::DesktopWindowTreeHostWin::HandleActivationChanged(bool active) Line 887	C++
 	views.dll!views::HWNDMessageHandler::PostProcessActivateMessage(int activation_state, bool minimized, HWND__ * window_gaining_or_losing_activation) Line 1404	C++
 	views.dll!views::HWNDMessageHandler::OnWndProc(unsigned int message, unsigned int w_param, long l_param) Line 1118	C++

@magreenblatt
Copy link
Collaborator Author

Get `Chrome_WidgetWin_0` window and call ::SetFocus with this handle.

Thanks for that detail. I think the problem here is that the wrong HWND is getting focused (at least from TSF’s perspective). That would also explain why InputMethodWinBase::IsWindowFocused is failing as described above when checking GetFocus() == attached_window_handle_.

@magreenblatt
Copy link
Collaborator Author

In InputMethodWinBase::IsWindowFocused after re-focus:

  • attached_window_handle_=001007AA
  • GetActiveWindow()=00100798
  • GetFocus()=00100798

Window hierarchy looks like this:


@magreenblatt
Copy link
Collaborator Author

First problem: The WM_SETFOCUS event in CefBrowserPlatformDelegateNativeWin::WndProc is calling CefBrowserHostBase::SetFocus asynchronously due to issue #3040.

Second problem (after fixing the 1st problem): CefBrowserPlatformDelegateNativeWin::SetFocus (which calls ::SetFocus with the Chrome_WidgetWin_0 handle) is being called after InputMethodWinTSF::OnWillChangeFocusedClient:

[0805/135057.334:INFO:browser_platform_delegate_native_win.cc(662)] CefBrowserPlatformDelegateNativeWin::WndProc WM_SETFOCUS
[0805/135057.334:INFO:input_method_win_tsf.cc(156)] InputMethodWinTSF::OnWillChangeFocusedClient focused_before=00000000 focused=4E286BD0
[0805/135057.334:INFO:input_method_win_base.cc(269)] InputMethodWinBase::IsWindowFocused attached_window_handle_=00320964 active=00150930 focused=00150930
[0805/135057.334:INFO:input_method_win_tsf.cc(170)] InputMethodWinTSF::OnDidChangeFocusedClient focused_before=00000000 focused=4E286BD0 is_window_focused=0 is_text_client_focused=1
[0805/135057.334:INFO:browser_platform_delegate_native_win.cc(389)] CefBrowserPlatformDelegateNativeWin::SetFocus hwnd=00320964

The InputMethodWinTSF::OnWillChangeFocusedClient call appears to result from the web_contents_->Focus() call in CefBrowserPlatformDelegateNativeWin::SetFocus. Moving that call after the call to ::SetFocus with the Chrome_WidgetWin_0 handle fixes the issue:

[0805/140926.867:INFO:browser_platform_delegate_native_win.cc(662)] CefBrowserPlatformDelegateNativeWin::WndProc WM_SETFOCUS
[0805/140926.867:INFO:browser_platform_delegate_native_win.cc(383)] CefBrowserPlatformDelegateNativeWin::SetFocus hwnd=0020093C
[0805/140926.870:INFO:desktop_window_tree_host_win.cc(1111)] DesktopWindowTreeHostWin::HandleIMEMessage WM_IME_SETCONTEXT WPARAM 1 LPARAM -1073741809
[0805/140926.872:INFO:input_method_win_tsf.cc(156)] InputMethodWinTSF::OnWillChangeFocusedClient focused_before=00000000 focused=4DD48230
[0805/140926.872:INFO:input_method_win_base.cc(269)] InputMethodWinBase::IsWindowFocused attached_window_handle_=0020093C active=001F079C focused=0020093C
[0805/140926.872:INFO:input_method_win_tsf.cc(170)] InputMethodWinTSF::OnDidChangeFocusedClient focused_before=00000000 focused=4DD48230 is_window_focused=1 is_text_client_focused=1
[0805/140926.873:INFO:tsf_bridge.cc(330)] TSFBridgeImpl::SetFocusedClient focused_window=0020093C client=4DD48230

However, we’ll still need to revisit issue #3040.

@magreenblatt
Copy link
Collaborator Author

Fix issues with browser focus assignment (fixes issue #3306, fixes issue #3166, see issue #3040)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set synchronously in response to the parent window WM_SETFOCUS message and before the associated call to WebContents::Focus. See updated comments in CefBrowserPlatformDelegateNativeWin::SetFocus.

→ <<cset 21d714ab6e09 (bb)>>

@magreenblatt
Copy link
Collaborator Author

  • changed state from "new" to "resolved"

@magreenblatt
Copy link
Collaborator Author

Fix issues with browser focus assignment (fixes issue #3306, fixes issue #3166, see issue #3040)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set
synchronously in response to the parent window WM_SETFOCUS message and
before the associated call to WebContents::Focus. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.

→ <<cset 08f37697afd7 (bb)>>

@magreenblatt
Copy link
Collaborator Author

Fix issues with browser focus assignment (fixes issue #3306, fixes issue #3166, see issue #3040)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set
synchronously in response to the parent window WM_SETFOCUS message and
before the associated call to WebContents::Focus. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.

→ <<cset 2587cf23c511 (bb)>>

@magreenblatt
Copy link
Collaborator Author

Original comment by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


I’ve tested official build cef_binary_104.4.18+g2587cf2+chromium-104.0.5112.81_windows32_client.tar.bz2 and cef_binary_105.0.3+g08f3769+chromium-105.0.5195.8_windows32_beta_client.tar.bz2, the problem still exists.

And I back port change set to 4515 CEF92 version, the problem still exists too, may be need some more digging.

I’ve debug this issue these days too, and I found this problem was probably introduced in this commit, year 2020:

SHA-1: 71768ea6c32deba08d16c2c77bc9ddce5f33387b (bb)

  • Update to Chromium version 80.0.3987.0 (#722274)

Before this commit, it is Chromium 79.0.3945.1, and cefclient works just fine most times ( 78 some times not correct but I dunno why).

@magreenblatt
Copy link
Collaborator Author

Original changes by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


  • changed state from "resolved" to "open"

@magreenblatt
Copy link
Collaborator Author

What Windows version and IME language are you testing? Are you adding any command-line flags? Are your reproduction steps exactly the same as above?

@magreenblatt
Copy link
Collaborator Author

Original comment by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


@wonhee JEONG 's modification works for me.

@marshall Greenblatt :

What Windows version and IME language are you testing?

My Windows version is Windows 10 Pro workstation 21H2 With Microsoft Pinyin.

Are you adding any command-line flags?

104: run without command line flags has the bug. run with cefclient --use-views and cefclient --enable-chrome-runtime no problem.

105: run without command line flags has the bug. run with cefclient --use-views no problem. run with cefclient --enable-chrome-runtime crashed.

Are your reproduction steps exactly the same as above?

Yes, I follow my steps above:

  1. Click in the page’s google search box, type aaa and press space, Microsoft Pinyin will input three chinese characters, and IME window positioned correctly.
  2. Click in the cefclient demo’s address bar, and type aaa and press space, Microsoft Pinyin will input three chinese characters, and IME window positioned correctly.
  3. Click in the page’s google search box, type aaa, the IME window not positioned correctly.

@magreenblatt
Copy link
Collaborator Author

Original comment by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


I’ve installed a new vm with Windows 10 Pro 21H2 english version and configure the chinese IME Microsoft Pinyin. If you need a debug environment, I can upload the vm to you or, some remote access may help?

@magreenblatt
Copy link
Collaborator Author

Original comment by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


I’ve tested under Windows 7 Pro SP1 Simplified Chinese edition with Microsoft Pinyin, no problem with/wo command line flags.

And Windows 11 Pro 21H2 Simplified Chinese edition, the result is same as Windows 10.

@magreenblatt
Copy link
Collaborator Author

Thanks, I can reproduce the incorrect placement issue when switching focus in cefclient between the URL text field and the browser search field. Placement is correct when switching focus between different windows (was also incorrect previously).

@magreenblatt
Copy link
Collaborator Author

incorrect placement issue when switching focus in cefclient between the URL text field and the browser search field

In this case CefBrowserPlatformDelegateNativeWin::SetFocus and TSFBridgeImpl::SetFocusedClient are not being called when clicking into the search field. Additionally, you need to click twice before the search field gets input focus (which is also incorrect behavior).

[0810/112320.927:INFO:browser_contents_delegate.cc(547)] CefBrowserContentsDelegate::OnWebContentsFocused
[0810/112320.927:INFO:input_method_win_tsf.cc(149)] InputMethodWinTSF::OnWillChangeFocusedClient focused_before=00000000 focused=4E0CDC18
[0810/112320.927:INFO:input_method_win_base.cc(269)] InputMethodWinBase::IsWindowFocused attached_window_handle_=0010041A GetActiveWindow()=00070830 GetFocus()=0005085A
[0810/112320.927:INFO:input_method_win_tsf.cc(162)] InputMethodWinTSF::OnDidChangeFocusedClient focused_before=00000000 focused=4E0CDC18 is_window_focused=0 is_text_input_client_focused=1
[0810/112320.927:INFO:input_method_win_base.cc(269)] InputMethodWinBase::IsWindowFocused attached_window_handle_=0010041A GetActiveWindow()=00070830 GetFocus()=0005085A
[0810/112320.935:INFO:input_method_win_tsf.cc(45)] InputMethodWinTSF::OnFocus
[0810/112321.116:INFO:input_method_win_base.cc(269)] InputMethodWinBase::IsWindowFocused attached_window_handle_=0010041A GetActiveWindow()=00070830 GetFocus()=0010041A

The call to OnWebContentsFocused while GetFocus()=0005085A (the URL text field) indicates that WebContents::Focus is being called before window focus is assigned to the DesktopWindowTreeHostWin ("Chrome_WidgetWin_0"). This is the same problem that was fixed for the window switching case above.

This is the call stack for the OnWebContentsFocused call:

 	libcef.dll!CefBrowserContentsDelegate::OnWebContentsFocused(content::RenderWidgetHost * render_widget_host) Line 547	C++
 	content.dll!content::WebContentsImpl::WebContentsObserverList::NotifyObservers<void (content::WebContentsObserver::*)(content::RenderWidgetHost *) __attribute__((thiscall)),content::RenderWidgetHost *&>(void(content::WebContentsObserver::*)(content::RenderWidgetHost *) func, content::RenderWidgetHost * & args) Line 1513	C++
 	content.dll!content::WebContentsImpl::NotifyWebContentsFocused(content::RenderWidgetHost * render_widget_host) Line 5249	C++
 	content.dll!content::WebContentsViewAura::GotFocus(content::RenderWidgetHostImpl * render_widget_host) Line 1234	C++
 	content.dll!content::RenderViewHostImpl::RenderWidgetGotFocus() Line 805	C++
 	content.dll!content::RenderWidgetHostImpl::GotFocus() Line 1287	C++
 	content.dll!content::RenderWidgetHostViewAura::OnWindowFocused(aura::Window * gained_focus, aura::Window * lost_focus) Line 2066	C++
 	ui_wm.dll!wm::FocusController::SetFocusedWindow(aura::Window * window) Line 303	C++
 	ui_wm.dll!wm::FocusController::FocusAndActivateWindow(wm::ActivationChangeObserver::ActivationReason reason, aura::Window * window, bool no_stacking) Line 257	C++
 	ui_wm.dll!wm::FocusController::FocusWindow(aura::Window * window) Line 111	C++
 	aura.dll!aura::Window::Focus() Line 795	C++
 	content.dll!content::RenderWidgetHostViewAura::Focus() Line 515	C++
 	content.dll!content::WebContentsViewAura::Focus() Line 945	C++
 	content.dll!content::WebContentsImpl::Focus() Line 4981	C++
 	webview.dll!views::WebView::OnFocus() Line 258	C++
 	views.dll!views::View::Focus() Line 2262	C++
 	views.dll!views::FocusManager::SetFocusedViewWithReason(views::View * view, views::FocusManager::FocusChangeReason reason) Line 392	C++
 	views.dll!views::FocusManager::SetFocusedView(views::View * view) Line 402	C++
 	views.dll!views::View::RequestFocus() Line 1768	C++
 	views.dll!views::FocusManager::RestoreFocusedView() Line 467	C++
 	views.dll!views::DesktopNativeWidgetAura::OnWindowActivated(wm::ActivationChangeObserver::ActivationReason reason, aura::Window * gained_active, aura::Window * lost_active) Line 1305	C++
 	ui_wm.dll!wm::FocusController::SetActiveWindow(wm::ActivationChangeObserver::ActivationReason reason, aura::Window * requested_window, aura::Window * window, bool no_stacking) Line 383	C++
 	ui_wm.dll!wm::FocusController::FocusAndActivateWindow(wm::ActivationChangeObserver::ActivationReason reason, aura::Window * window, bool no_stacking) Line 235	C++
 	ui_wm.dll!wm::FocusController::FocusWindow(aura::Window * window) Line 111	C++
 	ui_wm.dll!wm::FocusController::ActivateWindow(aura::Window * window) Line 64	C++
 	views.dll!views::DesktopNativeWidgetAura::HandleActivationChanged(bool active) Line 464	C++
 	views.dll!views::DesktopWindowTreeHostWin::HandleActivationChanged(bool active) Line 887	C++
 	views.dll!views::DesktopWindowTreeHostWin::HandleNativeFocus(HWND__ * last_focused_window) Line 998	C++
>	views.dll!views::HWNDMessageHandler::OnSetFocus(HWND__ * last_focused_window) Line 2640	C++

@magreenblatt
Copy link
Collaborator Author

Additionally, you need to click twice before the search field gets input focus (which is also incorrect behavior).

It looks like the first click simply dismisses the IME composition window, and the 2nd click actually focuses the browser view.

@magreenblatt
Copy link
Collaborator Author

The call to OnWebContentsFocused while GetFocus()=0005085A (the URL text field) indicates that WebContents::Focus is being called before window focus is assigned to the DesktopWindowTreeHostWin ("Chrome_WidgetWin_0"). This is the same problem that was fixed for the window switching case above.

OnWebContentsFocused is being called before DesktopWindowTreeHostWin::HandleNativeFocus when clicking in the search field. This is problematic because GetFocus() won’t be returning the correct/expected value at this point.

[0810/123639.615:INFO:browser_contents_delegate.cc(547)] CefBrowserContentsDelegate::OnWebContentsFocused
[0810/123639.616:INFO:input_method_win_tsf.cc(149)] InputMethodWinTSF::OnWillChangeFocusedClient focused_before=00000000 focused=4E5BBA70
[0810/123639.617:INFO:input_method_win_base.cc(269)] InputMethodWinBase::IsWindowFocused attached_window_handle_=001B044E GetActiveWindow()=0054091E GetFocus()=00060900
[0810/123639.617:INFO:input_method_win_tsf.cc(162)] InputMethodWinTSF::OnDidChangeFocusedClient focused_before=00000000 focused=4E5BBA70 is_window_focused=0 is_text_input_client_focused=1
[0810/123639.618:INFO:input_method_win_base.cc(269)] InputMethodWinBase::IsWindowFocused attached_window_handle_=001B044E GetActiveWindow()=0054091E GetFocus()=00060900
[0810/123639.621:INFO:desktop_window_tree_host_win.cc(997)] DesktopWindowTreeHostWin::HandleNativeFocus last_focused_window=00060900 GetFocus()=001B044E
[0810/123639.622:INFO:desktop_window_tree_host_win.cc(887)] DesktopWindowTreeHostWin::HandleActivationChanged active=1
[0810/123639.622:INFO:input_method_win_tsf.cc(45)] InputMethodWinTSF::OnFocus

Related call stack:

>   libcef.dll!CefBrowserContentsDelegate::OnWebContentsFocused(content::RenderWidgetHost * render_widget_host) Line 550    C++
    content.dll!content::WebContentsImpl::WebContentsObserverList::NotifyObservers<void (content::WebContentsObserver::*)(content::RenderWidgetHost *) __attribute__((thiscall)),content::RenderWidgetHost *&>(void(content::WebContentsObserver::*)(content::RenderWidgetHost *) func, content::RenderWidgetHost * & args) Line 1513   C++
    content.dll!content::WebContentsImpl::NotifyWebContentsFocused(content::RenderWidgetHost * render_widget_host) Line 5249    C++
    content.dll!content::WebContentsViewAura::GotFocus(content::RenderWidgetHostImpl * render_widget_host) Line 1234    C++
    content.dll!content::RenderViewHostImpl::RenderWidgetGotFocus() Line 805    C++
    content.dll!content::RenderWidgetHostImpl::GotFocus() Line 1287 C++
    content.dll!content::RenderWidgetHostViewAura::OnWindowFocused(aura::Window * gained_focus, aura::Window * lost_focus) Line 2066    C++
    ui_wm.dll!wm::FocusController::SetFocusedWindow(aura::Window * window) Line 303 C++
    ui_wm.dll!wm::FocusController::FocusAndActivateWindow(wm::ActivationChangeObserver::ActivationReason reason, aura::Window * window, bool no_stacking) Line 257  C++
    ui_wm.dll!wm::FocusController::FocusWindow(aura::Window * window) Line 111  C++
    aura.dll!aura::Window::Focus() Line 795 C++
    content.dll!content::RenderWidgetHostViewAura::Focus() Line 515 C++
    content.dll!content::WebContentsViewAura::Focus() Line 945  C++
    content.dll!content::WebContentsImpl::Focus() Line 4981 C++
    webview.dll!views::WebView::OnFocus() Line 258  C++
    views.dll!views::View::Focus() Line 2262    C++
    views.dll!views::FocusManager::SetFocusedViewWithReason(views::View * view, views::FocusManager::FocusChangeReason reason) Line 392 C++
    views.dll!views::FocusManager::SetFocusedView(views::View * view) Line 402  C++
    views.dll!views::View::RequestFocus() Line 1768 C++
    views.dll!views::FocusManager::RestoreFocusedView() Line 467    C++
    views.dll!views::DesktopNativeWidgetAura::OnWindowActivated(wm::ActivationChangeObserver::ActivationReason reason, aura::Window * gained_active, aura::Window * lost_active) Line 1305  C++
    ui_wm.dll!wm::FocusController::SetActiveWindow(wm::ActivationChangeObserver::ActivationReason reason, aura::Window * requested_window, aura::Window * window, bool no_stacking) Line 383    C++
    ui_wm.dll!wm::FocusController::FocusAndActivateWindow(wm::ActivationChangeObserver::ActivationReason reason, aura::Window * window, bool no_stacking) Line 235  C++
    ui_wm.dll!wm::FocusController::WindowFocusedFromInputEvent(aura::Window * window, const ui::Event * event) Line 481 C++
    ui_wm.dll!wm::FocusController::OnMouseEvent(ui::MouseEvent * event) Line 134    C++
    events.dll!ui::EventHandler::OnEvent(ui::Event * event) Line 34 C++
    events.dll!ui::EventDispatcher::DispatchEvent(ui::EventHandler * handler, ui::Event * event) Line 190   C++
    events.dll!ui::EventDispatcher::DispatchEventToEventHandlers(std::Cr::vector<ui::EventHandler *,std::Cr::allocator<ui::EventHandler *>> * list, ui::Event * event) Line 177 C++
    events.dll!ui::EventDispatcher::ProcessEvent(ui::EventTarget * target, ui::Event * event) Line 125  C++
    events.dll!ui::EventDispatcherDelegate::DispatchEventToTarget(ui::EventTarget * target, ui::Event * event) Line 83  C++
    events.dll!ui::EventDispatcherDelegate::DispatchEvent(ui::EventTarget * target, ui::Event * event) Line 55  C++
    events.dll!ui::EventProcessor::OnEventFromSource(ui::Event * event) Line 49 C++
    events.dll!ui::EventSource::DeliverEventToSink(ui::Event * event) Line 118  C++
    events.dll!ui::EventSource::SendEventToSinkFromRewriter(const ui::Event * event, const ui::EventRewriter * rewriter) Line 143   C++
    events.dll!ui::EventSource::SendEventToSink(const ui::Event * event) Line 112   C++
    views.dll!views::DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent * event) Line 1016   C++
    views.dll!views::HWNDMessageHandler::HandleMouseEventInternal(unsigned int message, unsigned int w_param, long l_param, bool track_mouse) Line 3279 C++
    views.dll!views::HWNDMessageHandler::HandleMouseMessage(unsigned int message, unsigned int w_param, long l_param, bool * handled) Line 1164 C++
    content.dll!content::LegacyRenderWidgetHostHWND::OnMouseRange(unsigned int message, unsigned int w_param, long l_param, int & handled) Line 318 C++
    content.dll!content::LegacyRenderWidgetHostHWND::_ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 94    C++
    content.dll!content::LegacyRenderWidgetHostHWND::ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 87 C++

This isn’t a problem in Chrome because the WM_ACTIVATE message, which is sent to the root window, will have already assigned keyboard focus via DefaultWndProc handling (docs). In CEF, where DesktopWindowTreeHostWin is not the root window, we’ve patched DesktopWindowTreeHostWin::HandleNativeFocus to call HandleActivationChanged, and that works in the switching windows case. However, with this click behavior, the HandleNativeFocus call is arriving too late (after WebContents::Focus).

@magreenblatt
Copy link
Collaborator Author

IME logging changes, for future reference:

diff --git ui/base/ime/win/input_method_win_base.cc ui/base/ime/win/input_method_win_base.cc
index [15bc17eee38f5 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/15bc17eee38f5)..03e1b510a33d9 [100644 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/100644)
--- ui/base/ime/win/input_method_win_base.cc
+++ ui/base/ime/win/input_method_win_base.cc
@@ -266,6 +266,8 @@ bool InputMethodWinBase::IsWindowFocused(const TextInputClient* client) const {
   // We need to relax this condition by checking |GetFocus()| so this works fine
   // for embedded Chromium windows.
   // TODO(crbug/1286880): Check if this can be replaced with |GetFocus()|.
+  LOG(INFO) << "InputMethodWinBase::IsWindowFocused attached_window_handle_=" << attached_window_handle_
+      << " GetActiveWindow()=" << GetActiveWindow() << " GetFocus()=" << GetFocus();
   return attached_window_handle_ &&
          (GetActiveWindow() == attached_window_handle_ ||
           GetFocus() == attached_window_handle_);
diff --git ui/base/ime/win/input_method_win_tsf.cc ui/base/ime/win/input_method_win_tsf.cc
index [1a02b6f98c866 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/1a02b6f98c866)..c6cd6bedc9fdd [100644 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/100644)
--- ui/base/ime/win/input_method_win_tsf.cc
+++ ui/base/ime/win/input_method_win_tsf.cc
@@ -4,6 +4,7 @@
 
 #include "ui/base/ime/win/input_method_win_tsf.h"
 
+#include "base/logging.h"
 #include "ui/base/ime/text_input_client.h"
 #include "ui/base/ime/virtual_keyboard_controller.h"
 #include "ui/base/ime/win/tsf_bridge.h"
@@ -41,6 +42,7 @@ InputMethodWinTSF::InputMethodWinTSF(internal::InputMethodDelegate* delegate,
 InputMethodWinTSF::~InputMethodWinTSF() {}
 
 void InputMethodWinTSF::OnFocus() {
+  LOG(INFO) << "InputMethodWinTSF::OnFocus";
   InputMethodBase::OnFocus();
   if (!ui::TSFBridge::GetInstance()) {
     // TSFBridge can be null for tests.
@@ -53,6 +55,7 @@ void InputMethodWinTSF::OnFocus() {
 }
 
 void InputMethodWinTSF::OnBlur() {
+  LOG(INFO) << "InputMethodWinTSF::OnBlur";
   InputMethodBase::OnBlur();
   if (!ui::TSFBridge::GetInstance()) {
     // TSFBridge can be null for tests.
@@ -143,6 +146,8 @@ bool InputMethodWinTSF::IsCandidatePopupOpen() const {
 void InputMethodWinTSF::OnWillChangeFocusedClient(
     TextInputClient* focused_before,
     TextInputClient* focused) {
+  LOG(INFO) << "InputMethodWinTSF::OnWillChangeFocusedClient focused_before=" << focused_before
+     << " focused=" << focused;
   if (ui::TSFBridge::GetInstance() && IsWindowFocused(focused_before)) {
     ConfirmCompositionText();
     ui::TSFBridge::GetInstance()->RemoveFocusedClient(focused_before);
@@ -152,8 +157,13 @@ void InputMethodWinTSF::OnWillChangeFocusedClient(
 void InputMethodWinTSF::OnDidChangeFocusedClient(
     TextInputClient* focused_before,
     TextInputClient* focused) {
-  if (ui::TSFBridge::GetInstance() && IsWindowFocused(focused) &&
-      IsTextInputClientFocused(focused)) {
+  const bool is_window_focused = IsWindowFocused(focused);
+  const bool is_text_input_client_focused = IsTextInputClientFocused(focused);
+  LOG(INFO) << "InputMethodWinTSF::OnDidChangeFocusedClient focused_before=" << focused_before <<
+    " focused=" << focused << " is_window_focused=" << is_window_focused <<
+    " is_text_input_client_focused=" << is_text_input_client_focused;
+  if (ui::TSFBridge::GetInstance() && is_window_focused &&
+      is_text_input_client_focused) {
     ui::TSFBridge::GetInstance()->SetFocusedClient(attached_window_handle_,
                                                    focused);
     // Force to update the input type since client's TextInputStateChanged()
diff --git ui/base/ime/win/tsf_bridge.cc ui/base/ime/win/tsf_bridge.cc
index [1d629d46dd444 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/1d629d46dd444)..e2b45bf31f468 [100644 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/100644)
--- ui/base/ime/win/tsf_bridge.cc
+++ ui/base/ime/win/tsf_bridge.cc
@@ -320,6 +320,8 @@ bool TSFBridgeImpl::ConfirmComposition() {
 
 void TSFBridgeImpl::SetFocusedClient(HWND focused_window,
                                      TextInputClient* client) {
+  LOG(INFO) << "TSFBridgeImpl::SetFocusedClient focused_window=" << focused_window
+    << " client=" << client;
   DCHECK(base::CurrentUIThread::IsSet());
   DCHECK(client);
   DCHECK(IsInitialized());

@magreenblatt
Copy link
Collaborator Author

It would be good to also test the behavior with touch events, as that may require a similar change.

@magreenblatt
Copy link
Collaborator Author

Fix browser focus assignment on mouse click (fixes issue #3306)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set before
the associated call to WebContents::Focus. In the case of mouse click events,
this means ::SetFocus needs to be called explicitly. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.

→ <<cset 8908465546bf (bb)>>

@magreenblatt
Copy link
Collaborator Author

  • changed state from "open" to "resolved"

@magreenblatt
Copy link
Collaborator Author

Fix browser focus assignment on mouse click (fixes issue #3306)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set before
the associated call to WebContents::Focus. In the case of mouse click events,
this means ::SetFocus needs to be called explicitly. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.

→ <<cset c9b8f03731c6 (bb)>>

@magreenblatt
Copy link
Collaborator Author

Fix browser focus assignment on mouse click (fixes issue #3306)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set before
the associated call to WebContents::Focus. In the case of mouse click events,
this means ::SetFocus needs to be called explicitly. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.

→ <<cset 47dab09c5e36 (bb)>>

@magreenblatt
Copy link
Collaborator Author

Original comment by Skogkatt (Bitbucket: Skogkatt, GitHub: Skogkatt).


Oh, Thanks a lot, I merged the change set to my code, IME works fine!

wjh-la pushed a commit to loongson/cef that referenced this issue Mar 16, 2023
…d#3306, fixes issue chromiumembedded#3166, see issue chromiumembedded#3040)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set
synchronously in response to the parent window WM_SETFOCUS message and
before the associated call to WebContents::Focus. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
wjh-la pushed a commit to loongson/cef that referenced this issue Mar 16, 2023
…dded#3306)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set before
the associated call to WebContents::Focus. In the case of mouse click events,
this means ::SetFocus needs to be called explicitly. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
wjh-la pushed a commit to loongson/cef that referenced this issue Mar 16, 2023
…d#3306, fixes issue chromiumembedded#3116, see issue chromiumembedded#3040)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set
synchronously in response to the parent window WM_SETFOCUS message and
before the associated call to WebContents::Focus. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
wjh-la pushed a commit to loongson/cef that referenced this issue Mar 16, 2023
…dded#3306)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set before
the associated call to WebContents::Focus. In the case of mouse click events,
this means ::SetFocus needs to be called explicitly. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
filipnavara pushed a commit to emclient/cef that referenced this issue Dec 26, 2023
…d#3306, fixes issue chromiumembedded#3166, see issue chromiumembedded#3040)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set
synchronously in response to the parent window WM_SETFOCUS message and
before the associated call to WebContents::Focus. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
filipnavara pushed a commit to emclient/cef that referenced this issue Dec 26, 2023
…dded#3306)

DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set before
the associated call to WebContents::Focus. In the case of mouse click events,
this means ::SetFocus needs to be called explicitly. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report Framework Related to framework code or APIs windows Windows platform
Projects
None yet
Development

No branches or pull requests

1 participant