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

feat(LibInputBackend) Handle events only from specific input handler devices #15001

Conversation

workgroupengineering
Copy link
Contributor

What does the pull request do?

Handle events only from specific input handler devices

  • Move HandleTouch from LibInputBackend.cs to LibInputBackend.Tocuch.cs
  • Added LibInputBackendOptions
  • Added LibInputBackend ctor overload that accepts LibInputBackendOptions
  • Moved input thread initialization from ctor to the Initialize method

What is the current behavior?

Allways handle all /dev/input/event* events

What 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

…devices

- Added LibInputBackendOptions
- Added LibInputBackend ctor overload that accepts LibInputBackendOptions
- Moved input thread initialization from ctor to the Initialize method
@avaloniaui-bot
Copy link

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

@maxkatz6 maxkatz6 requested review from kekekeks and jmacato March 15, 2024 18:42
/// <summary>
/// List Events of events handler to monitoring eg: /dev/eventX.
/// </summary>
public IReadOnlyList<string> Events { get; init; } = Array.Empty<string>();
Copy link
Member

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()

Copy link
Contributor Author

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.

Copy link
Member

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

@avaloniaui-bot
Copy link

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

}

private unsafe void InputThread(IntPtr ctx)
private unsafe void InputThread(object? state)
Copy link
Member

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;
Copy link
Member

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

Copy link
Member

@kekekeks kekekeks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise lgtm

@avaloniaui-bot
Copy link

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

@workgroupengineering workgroupengineering force-pushed the features/Linux/Libinput/Events-Filter branch from a1e51cb to 0d09ca8 Compare March 25, 2024 09:18
@workgroupengineering workgroupengineering force-pushed the features/Linux/Libinput/Events-Filter branch from 0d09ca8 to 247b77f Compare March 25, 2024 09:19
@avaloniaui-bot
Copy link

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

@maxkatz6 maxkatz6 added this pull request to the merge queue Mar 25, 2024
Merged via the queue into AvaloniaUI:master with commit 40c630b Mar 26, 2024
10 checks passed
@workgroupengineering workgroupengineering deleted the features/Linux/Libinput/Events-Filter branch March 26, 2024 07:11
@maxkatz6 maxkatz6 added the backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch label Apr 20, 2024
maxkatz6 pushed a commit that referenced this pull request Apr 20, 2024
…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
@maxkatz6 maxkatz6 added backported-11.1.x and removed backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Apr 20, 2024
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.

[LinuxFramebuffer][LibInputBackend] Handle events only from specific input handler devices
4 participants