-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
XEmbed client support draft #17446
base: master
Are you sure you want to change the base?
XEmbed client support draft #17446
Conversation
You can test this PR using the following package version. |
EmbeddableControlRoot? Root => Window._inputRoot as EmbeddableControlRoot; | ||
private bool _focusedInEmbedder; | ||
private bool _embedderActivated; | ||
private IInputElement? _savedFocus; |
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.
WeakReference?
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.
Although, if element is removed from the visual tree, KeyboardDevice should notify about this change.
{ | ||
((FocusManager?)Root?.FocusManager)?.SetFocusScope(Root); | ||
if (_savedFocus != null) | ||
KeyboardDevice.Instance?.SetFocusedElement(_savedFocus, NavigationMethod.Unspecified, KeyModifiers.None); |
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.
Any particular reason to use KeyboardDevice? I don't see why we would avoid logical focus here, especially when we set focus scope explicitly.
You can use stable API and call _savedFocus.Focus(NavigationMethod.Unspecified, KeyModifiers.None)
. Which internally will also set focus correct scope, so you don't need to do it manually.
|
||
static XEmbedClientWindowMode() | ||
{ | ||
KeyboardDevice.Instance.PropertyChanged += (_, args) => |
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.
We don't have a good stable API for that. Needs something like FocusManager.GotFocus.
But InputElemement.GotFocusEvent.AddClassHandler
should work here.
This will later be split into multiple PRs since alongside with XEmbed protocol changes it needs a refactor of our resize/rendering code for smooth window resize support.