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
[input]Provider matching for input postproc calibration #5870
Conversation
subclasses mapped to their provider name. | ||
""" | ||
provider_map = {} | ||
for input_provider in MotionEventFactory.list(): |
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.
This is only called once in __init__, and I was unsure if MotionEventFactory.list() might ever change its output after this. Can anyone confirm?
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.
Touch providers are supposed/assumed to be registered before all of this already, while it would be cool to be allow to enable/disable them at runtime, this is currently not really possible anyway, so no worries here.
if issubclass(event, MotionEvent): | ||
provider_map[event] = input_provider | ||
|
||
return provider_map |
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.
This is what provider_map looks like:
{
<class 'kivy.input.providers.tuio.Tuio2dCurMotionEvent'>: 'tuio',
<class 'kivy.input.providers.tuio.Tuio2dObjMotionEvent'>: 'tuio',
<class 'kivy.input.providers.mtdev.MTDMotionEvent'>: 'mtdev',
<class 'kivy.input.providers.hidinput.HIDMotionEvent'>: 'hidinput',
<class 'kivy.input.providers.linuxwacom.LinuxWacomMotionEvent'>: 'linuxwacom',
<class 'kivy.input.providers.leapfinger.LeapFingerEvent'>: 'leapfinger'
}
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.
not tested, but LGTM, there might be performance considerations, but they'll only come up if the postproc:calibration module is used (which it's not by default), so i think it's not a big concern.
subclasses mapped to their provider name. | ||
""" | ||
provider_map = {} | ||
for input_provider in MotionEventFactory.list(): |
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.
Touch providers are supposed/assumed to be registered before all of this already, while it would be cool to be allow to enable/disable them at runtime, this is currently not really possible anyway, so no worries here.
Congrats on merging your first pull request! 🎉🎉🎉 |
Allows users to match calibration rules to any and all devices of a particular input provider. This is useful when the name of the device is not known in advance. For example, if probesysfs is used to match an mtdev touchscreen:
[input]
mtdev_%(name)s = probesysfs,provider=mtdev
then the touchscreen can be calibrated using:
[postproc:calibration]
(mtdev) = xratio=0.3333,xoffset=0.3333
The new convention is to use parentheses to denote a provider name instead of a device.
I mainly made this change to work with #5659 to apply auto calibration to a resizable app no matter what device it is installed on.
I have only tested this PR with an mtdev touchscreen, but it should work for any input that might need calibrating.