-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Hello,
Your script is really nice.
I have a convertible Toshiba laptop with ELAN Screen running Debian 8.5 Sid & XFCE, but i had some issues with the UInput and ui.write method.
In my system , the code as described in _initiate_right_click does not work.
The problem turned out to be the device capabilites declaration.
Instead of this:
capabilities = {ecodes.EV_ABS: (ecodes.ABS_X, ecodes.ABS_Y), ecodes.EV_KEY: (ecodes.BTN_LEFT, ecodes.BTN_RIGHT)}
I had to use this:
capabilities = { ecodes.EV_KEY : [ecodes.BTN_LEFT, ecodes.BTN_RIGHT], ecodes.EV_ABS : [(ecodes.ABS_X, AbsInfo(value=1900, min=0, max=3264, fuzz=0, flat=0, resolution=13)), (ecodes.ABS_Y, AbsInfo(1050, 0, 1856, 0, 0, 13))] }
I had to apply to AbsInfo min,max,fuzz,flat and resolution values same as my ELAN screen capabilites.
PS1: In any case, i forked your script and i used pymouse for right click injection insted of UInput.
PS2: I also had to modify the position_event part of your script, since in my screen when i'm working with fingers i have a slight change in ABS_X and ABS_Y values when i keep pressing my screen in one point probably due to the high resolution of the screen.
This small change cancels the right click event to be injected , so i modified like bellow to allow +/- 50 pixels movement without cancelling right click:
if self.position[event_code] is None:
self.position[event_code] = value
else:
OldValue = self.position[event_code]
NewValue = value
diff = OldValue - NewValue
if abs(diff) > 50:
self._moved_event()
After above modifications, your script works great for me.
The touchscreen gestures trap works like a charm.