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

revert mouse #17

Closed
nadenislamarre opened this issue May 27, 2022 · 7 comments
Closed

revert mouse #17

nadenislamarre opened this issue May 27, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@nadenislamarre
Copy link

not sure it is already possible or not.
i don't find how.

is it possible to revert an axis ?
basically, map abs:x to abs:-x (because with my device, the x axis is reverted compared to my needs)

@KarsMulder
Copy link
Owner

Not possible on the current stable version. I just added a feature to do this to the main branch. The tentative syntax is:

--map abs:x abs:x:-x

Now a somewhat confusing part of this syntax is that the last x just means "whatever the value value was", and the minus means "-1 times that value". The last x does not mean "the value of the x axis", so to invert the y axis, you would also use:

--map abs:y abs:y:-x

The magic x multiplier in the value has the same consistent syntax as the magic d multiplier (which, ironically, is already stable), but since users will probably use it mainly for inverting/accelerating the x/y axes, I can imagine some poor user getting confused and trying to write --map abs:y abs:y:-y.

I could either write a specialised helpful error message for that case, or reconsider the syntax of this feature.

@KarsMulder KarsMulder added the enhancement New feature or request label May 28, 2022
@nadenislamarre
Copy link
Author

In fact it is not exacly *-1
It is more max_value - x to revert thé axis.

@nadenislamarre
Copy link
Author

In case min IS positiv

@KarsMulder
Copy link
Owner

KarsMulder commented Sep 5, 2022

This feature has now been added to the main branch. You can now e.g. write --map abs:z abs:z:127-x to map some event's value to 127 minus that event's value, which would invert the axis if abs:z were to have a range of 0~127.

@puffnfresh
Copy link

@KarsMulder since evdev events are registered with min/max values, we theoretically know the min/max. Could we add/generate another placeholder (e.g. z_min) so that we don't have to hard code the 127?

@KarsMulder
Copy link
Owner

@puffnfresh I suppose that it wouldn't be impossible to implement, but with the current internal API, it isn't simple to implement it in a way that:

  1. Is correct in all cases, i.e. including cases where multiple devices can generate abs:z events, which in turn are being transformed by other maps before reaching a map containing z_min.
  2. Does not impose a measurable performance penalty for the majority of the users who won't use this feature.

The key issue is: parsing the input arguments like abz:z to internal data structures, propagating the event capabilities, and propagating the events, happen at separate stages of the program. A feature like this blurs the line between those stages; e.g. it is currently assumed (and enforced by the compiler) that the propagation of event capabilities does not modify the event stream, and that assumption would need to change to make this work, along with at least one algorithm that relies on it.

In short, I think that I am not going to work on that feature for now because the amount of spaghettiness required to make it work outweighs the feature's utility.

@nadenislamarre
Copy link
Author

working for me. i can close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants