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

Focus - Notify WPF when Browser has focus #6

Open
amaitland opened this issue Oct 9, 2020 · 0 comments
Open

Focus - Notify WPF when Browser has focus #6

amaitland opened this issue Oct 9, 2020 · 0 comments

Comments

@amaitland
Copy link
Member

amaitland commented Oct 9, 2020

Directly clicking the mouse in the browser and CEF will recieve focus, we need to let WPF know that our HWND host has focus in this scenario.

We need to set the Logical focus, not the actual focus.
Something like the following might work.

var focusScope = FocusManager.GetFocusScope(this);
if (FocusManager.GetFocusedElement(focusScope) != this)
{
    FocusManager.SetFocusedElement(focusScope, this);
}

https://referencesource.microsoft.com/#PresentationCore/Core/CSharp/System/Windows/UIElement.cs,2647

When the browser directly gets focus IFocusHandler.OnGotFocus should be called.

Follow up to #5

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

No branches or pull requests

1 participant