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

Move syn() convenience method from InputDevice to EventIO #224

Merged
merged 3 commits into from
Nov 12, 2024

Conversation

Lawstorant
Copy link
Contributor

This one mimicks the syn() method found in UInput class and just makes it easier to inject EV_SYNC events. It's easier to parse event blocks visually.

This one mimicks the `syn()` method found in UInput class and just
makes it easier to inject `EV_SYNC` events. It's easier to parse
event blocks visually.
@sezanzeb
Copy link
Collaborator

sezanzeb commented Nov 6, 2024

Thanks. Maybe the syn method could be moved to the EventIO BaseClass, from which both InputEvent and UInput inherit

@Lawstorant
Copy link
Contributor Author

I actually thought about that! I wasn't sure if that would work though as UInput works a bit differently and doesn't reference self. In the end, it would work the same, as the method would be just overridden, but at that point, does it make sense to inherit it just to override?

If yes, I'll update the PR

@sezanzeb
Copy link
Collaborator

sezanzeb commented Nov 7, 2024

I think it would, because the self.write method you are using right now also calls EventIO.write through inheritance, doesn't it? I think there is no need to overwrite anything.

@Lawstorant
Copy link
Contributor Author

Okay, I went through the paths and you're right. EventIO uses the same path to perform write() as the syn() method in UInput. I'll just move syn to the EventIO.

One more question, what do you think about syn() using self.write() instead of _uinput.wirte() directly? I think that's a fair abstraction. If anything ever needs to change about the write operation, it has to be done only in one place.

Makes it possible to use it with `InputDevice` as well
@Lawstorant Lawstorant changed the title Add syn() convenience method to InputDevice Movesyn() convenience method from InputDevice to EventIO Nov 9, 2024
@Lawstorant Lawstorant changed the title Movesyn() convenience method from InputDevice to EventIO Move syn() convenience method from InputDevice to EventIO Nov 9, 2024
@sezanzeb
Copy link
Collaborator

One more question, what do you think about syn() using self.write() instead of _uinput.wirte() directly? I think that's a fair abstraction. If anything ever needs to change about the write operation, it has to be done only in one place.

Yes, I agree

@sezanzeb
Copy link
Collaborator

Is this ready to be merged?

@Lawstorant
Copy link
Contributor Author

As far as I'm concerned, yes.

@sezanzeb sezanzeb merged commit 21dc595 into gvalkov:main Nov 12, 2024
6 checks passed
@sezanzeb
Copy link
Collaborator

Thanks!

@Lawstorant Lawstorant deleted the device-syn branch November 13, 2024 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants