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

Use the focus proxy window in X11 #12751

Merged
merged 12 commits into from
Sep 4, 2023

Conversation

vlad-lubenskyi
Copy link
Contributor

In this changeset, we set the input focus (XSetInputFocus) to an invisible auxiliary window instead of setting it to the main window.

The intent is to make it possible to correctly switch the focus between the Avalonia window and an embedded window. Here's how XEmbed specification puts it:

[...] if the mouse pointer is within the embedded window,
the outer toolkit doesn't see any key events, even if the logical
keyboard focus is [] within the outer toolkit's top-level window.

[...] The topmost toolkit is required to keep the X input focus
on one of its own windows without any embedded children. Keeping
the focus on such a window ensures that key events are always
delivered to the outer toolkit and thus can be forwarded easily [...].

Source: https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html

In the case of DotNetBrowser, we will directly switch the focus back to the proxy window when the logical focus passes from the embedded Chromium to the host Avalonia window.

Checklist

In this changeset, we set the input focus (XSetInputFocus) to
an invisible auxiliary window instead of setting it to
the main window.

The intent is to make it possible to correctly switch the focus
between the Avalonia window and an embedded window. Here's how
XEmbed specification puts it:

> [...] if the mouse pointer is within the embedded window,
  the outer toolkit doesn't see any key events, even if the logical
  keyboard focus is [] within the outer toolkits toplevel window.

  [...] The topmost toolkit is required to keep the X input focus
  on one of its own windows without any embedded children. Keeping
  the focus on such a window ensures that key events are always
  delivered to the outer toolkit and thus can be forwarded easily [...].

Source: https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html

In the case of DotNetBrowser, we will directly switch the focus back to
the proxy window, when the logical focus passes from the embedded
Chromium to the host Avalonia window.
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039074-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039084-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@vlad-lubenskyi
Copy link
Contributor Author

@kekekeks a message from license/cla disappeared. Can we see it again?

@kekekeks
Copy link
Member

kekekeks commented Sep 1, 2023

No idea, it's controlled by .NET Foundation bot

@kekekeks
Copy link
Member

kekekeks commented Sep 1, 2023

Please, squash changes into a single commit, otherwise LGTM

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0039104-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 merged commit 93df05e into AvaloniaUI:master Sep 4, 2023
@vlad-lubenskyi vlad-lubenskyi deleted the x11-focus-proxy branch September 4, 2023 08:30
@maxkatz6 maxkatz6 added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Dec 5, 2023
maxkatz6 added a commit that referenced this pull request Dec 5, 2023
@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants