Xorg 1.20 changed some behaviour in how grabs are handled, which resulted in extra FocusIn and FocusOut events being sent out. This make the X11Window receives and raises extra Activated and Deactivated events to the Avalonia.Window which may cause some bugs that are hard to resolve outside of the framework.
Long press anywhere on the window using a touch screen and your finger
We will see the window is deactivated and activated almost at the same time.
If we are trying to do something on the Activated or Deactivated event, the operations will be done but the user actually don't see the real window activation changes. This may cause some unexpected behaviours.
What is the updated/expected behavior with this PR?
If this PR is merged, the Activated and Deactivated events will be raised only when the window is really activated or deactivated.
How was the solution implemented (if it's not obvious)?
If someone uses the extra Activated and Deactivated events to do some extra operations, they may lost the chance to do these. In my opition, this may not be a breaking change because the fix will make the behavior on X11 be the same as on Windows.
What does the pull request do?
Xorg 1.20 changed some behaviour in how grabs are handled, which resulted in extra FocusIn and FocusOut events being sent out. This make the X11Window receives and raises extra
Activated
andDeactivated
events to theAvalonia.Window
which may cause some bugs that are hard to resolve outside of the framework.Related Links:
What is the current behavior?
If we do these two things on an Avalonia window:
We will see the window is deactivated and activated almost at the same time.
If we are trying to do something on the
Activated
orDeactivated
event, the operations will be done but the user actually don't see the real window activation changes. This may cause some unexpected behaviours.What is the updated/expected behavior with this PR?
If this PR is merged, the
Activated
andDeactivated
events will be raised only when the window is really activated or deactivated.How was the solution implemented (if it's not obvious)?
See this official description here:
I fitered the
FocusIn
andFocusOut
events by checking themode
field of theXFocusChangeEvent
structure.Checklist
Breaking changes
If someone uses the extra
Activated
andDeactivated
events to do some extra operations, they may lost the chance to do these. In my opition, this may not be a breaking change because the fix will make the behavior on X11 be the same as on Windows.Obsoletions / Deprecations
None
Fixed issues
This fix has no related issues.