-
-
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
feat(LibInputBackend) Handle events only from specific input handler devices #15001
feat(LibInputBackend) Handle events only from specific input handler devices #15001
Conversation
…devices - Added LibInputBackendOptions - Added LibInputBackend ctor overload that accepts LibInputBackendOptions - Moved input thread initialization from ctor to the Initialize method
You can test this PR using the following package version. |
/// <summary> | ||
/// List Events of events handler to monitoring eg: /dev/eventX. | ||
/// </summary> | ||
public IReadOnlyList<string> Events { get; init; } = Array.Empty<string>(); |
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.
Should be nullable, so once we extend the class with extra options, one wouldn't have to manually scan devices and could just do new LibInputBackendOptions()
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.
I checked, it's nullable because Avalonia.LinuxFramebuffer doesn't have nullable enabled.
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.
I mean, it should be null
by default, not empty. One shouldn't have to manually specify the list of input devices in normal usage
src/Linux/Avalonia.LinuxFramebuffer/Input/LibInput/LibInputBackendOptions.cs
Outdated
Show resolved
Hide resolved
You can test this PR using the following package version. |
} | ||
|
||
private unsafe void InputThread(IntPtr ctx) | ||
private unsafe void InputThread(object? state) |
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.
Can we pass context IntPtr and options class separately here? Since LibInputBackendOptions are supposed to be a user-supplied options dto class, not a holder for native resources. Just use a closure in Thread ctor.
@@ -0,0 +1,20 @@ | |||
using System; |
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.
Please, add #nullable enable
for this file and mark Events as nullable
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.
Otherwise lgtm
You can test this PR using the following package version. |
a1e51cb
to
0d09ca8
Compare
0d09ca8
to
247b77f
Compare
You can test this PR using the following package version. |
…devices (#15001) * refactor(LibInputBackend): Move HandleTouch in `LibInputBackend.Tocuch.cs` * feat(LibInputBackend) Handle events only from specific input handler devices - Added LibInputBackendOptions - Added LibInputBackend ctor overload that accepts LibInputBackendOptions - Moved input thread initialization from ctor to the Initialize method * fix: nits * fix: Address review * fix: Address review
What does the pull request do?
Handle events only from specific input handler devices
LibInputBackend.cs
toLibInputBackend.Tocuch.cs
What is the current behavior?
Allways handle all
/dev/input/event*
eventsWhat is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Closes #14996