Hide individual pointer cursor (because of flicker) in KDE in dual pointer setup with touchscreen
4
votes
0
answers
1168
views
Under Kubuntu 17.04, I'm trying to obtain a dual pointer setup where one is attached to my mouse as usual and the other is attached to the touchscreen that otherwise works correctly while attached to the core pointer (including pinch-like gestures):
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ My touchscreen id=11 [slave pointer (2)]
⎜ ↳ My mouse id=18 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
...
Following this answer , I created another pointer and attached the touchscreen to it:
$ xinput create-master Touchscreen
$ xinput reattach 11 "Touchscreen pointer"
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ My mouse id=18 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
...
⎡ Touchscreen pointer id=21 [master pointer (22)]
⎜ ↳ My touchscreen id=11 [slave pointer (21)]
⎜ ↳ Touchscreen XTEST pointer id=23 [slave pointer (21)]
⎣ Touchscreen keyboard id=22 [master keyboard (21)]
↳ Touchscreen XTEST keyboard id=24 [slave keyboard (22)]
This is also functional, including gestures. The problem is the cursor attached to the Touchscreen pointer flickers. This does not happen with the core pointer. What is weird is that the flicker only happens when the I move the mouse pointer. If I don't move the mouse, the Touchscreen pointer stays invisible when the touchscreen is not used, which is very close to what I want. **Ideally, the touchscreen pointer would stay always hidden.**
Solution 1 (doesn't work):
--------------------------
Using
xicursorset
as suggested by the above answer . The code ultimately uses XIDefineCursor
to set the cursor image for individual pointers. This simply did nothing for me under KDE, no errors. If it worked, I would set the cursor to an empty image, which I'm not sure would solve the flickering issue.
Solution 2 (only partially works):
----------------------------------
Leaving the touchscreen floating via:
$ xinput float 11
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ My mouse id=18 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
...
∼ My touchscreen id=11 [floating slave]
In this configuration, no KDE window recognizes the touchscreen but surprisingly, Chrome recognizes gestures like one finger scroll or two finger pinch zoom. If I could get this kind of functionality in every window, it would be enough for me.
Solution 3 (works in theory, not in practice due to crash):
-----------------------------------------------------------
To add/remove pointer dynamically. In other words, using the following script called ~/.local/bin/watch-touchscreen.py
:
#!/usr/bin/python
import sys;
from subprocess import call;
while True:
line = sys.stdin.readline()
if line.startswith("button press"):
call(["xinput", "create-master", "Touchscreen"])
call(["xinput", "reattach", "11", "Touchscreen pointer"])
elif line.startswith("button release"):
call(["xinput", "remove-master", "Touchscreen pointer"])
like this:
$ xinput test 11 | ~/.local/bin/watch-touchscreen.py
The idea is to create a new pointer every time the touchscreen is touched and destroy it when the touch is released, at which point the touchscreen would return to being a floating slave. This works very briefly until the X session promptly crashes, forcing me to login again. Not a clever idea to dynamically create and destroy xinput pointers after all, I guess.
Any ideas, workarounds?
Asked by Ayberk Özgür
(309 rep)
Jul 16, 2017, 12:47 PM