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

Talon Eye Tracking Plugins don't take offset of monitor into account #202

Closed
fmagin opened this issue Jan 10, 2021 · 3 comments
Closed

Talon Eye Tracking Plugins don't take offset of monitor into account #202

fmagin opened this issue Jan 10, 2021 · 3 comments
Labels
Milestone

Comments

@fmagin
Copy link

fmagin commented Jan 10, 2021

I have a monitor configuration like this, where the left monitor is the one with the eye tracker

image
The position of DP-1 in this case is (0, 840). Control Mouse and the debug overlay are both 840 pixels too high because of some assumption that is violated, potentially that the main screen is supposed to be located at (0,0).

With my own plugin and the gaze callback this is not an issue because I translate the relative position in the GazeFrame into the proper coordinates via some helpers:

setattr(Screen, 'dimensions', property(lambda s: Point2d(s.width, s.height)))
setattr(Screen, 'position', property(lambda s: Point2d(s.x, s.y)))
setattr(Screen, 'position_from_gaze', lambda self, relative_position:
relative_position * self.dimensions + self.position)

So far this seems to work without issues and makes writing eye tracking plugins quite comfortable, so adding helpers like this seems generally useful and might allow to easily fix this issue with Control Mouse.

In case this is relevant I am using i3 on Arch Linux (i.e. Xorg)

@lunixbochs
Copy link

lunixbochs commented Jan 10, 2021

I think this is a dupe of this issue talonvoice/beta#87

I believe the (0,0) assumption was true on Mac (where eye_mouse.py was created) but not Linux, and eye_mouse.py predates the entire Talon API as well as Talon being cross platform.

As mentioned in beta/87, the problem will go away once the Tracker object is screen aware (almost ready, coming as part of multimonitor tracking).

Unrelated: please don't rely on monkey patching objects in Talon's stdlib, that's likely to break.
You can already screen.rect.pos + screen.rect.size * pt I think.

@fmagin
Copy link
Author

fmagin commented Jan 11, 2021

I am aware that those patches are highly unstable, this script is currently in no way intended to be productive and stable and every time I update Talon I am fully aware that this will mean investigating if everything still works. I think those hacks predate .pos and .size properties on Rect, and I didn't think of using them for this after they were added. Good idea, thanks for that!

@lunixbochs lunixbochs added the bug label Jan 20, 2021
@lunixbochs lunixbochs added this to the v0.2.0 milestone Jan 27, 2021
@lunixbochs lunixbochs modified the milestones: v0.2.0, v0.3.0 Jun 20, 2021
@lunixbochs
Copy link

fixed in next beta

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

No branches or pull requests

2 participants