Touchscreen and mouse as separate inputs?

Can someone give me a good reference on how to achieve this, or just tell me how its done? Google isn’t really helping me here, since it always tries to give me recommendations on touchpad :/

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

As long as your touchscreen is detected as a boring input device, you could do this with xinput. This tool allows you to define new master pointers (the virtual pointer which resembles one mouse pointer) and to detach and attach slave pointers (the actual hardware devices) from and to it.

So all you need to do is

  1. create a new master pointer
  2. reattach your touchscreen to this new master pointer

This is done similar to this:

  1. Create the new master pointer:
    $ xinput create-master touchy

    This creates a new master keyboard/pointer pair, where the keyboard is called »touch keyboard« and the pointer »touchy pointer«:
    $ xinput
       ⎡ Virtual core pointer                          id=2    [master pointer  (3)]
       ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
       ⎜   ↳ SynPS/2 Synaptics TouchPad                id=10   [slave  pointer  (2)]
       ⎜   ↳ TPPS/2 IBM TrackPoint                     id=11   [slave  pointer  (2)]
       ⎜   ↳ My Cool™ Touchscreen                      id=14   [slave  pointer  (2)]
       ⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
           ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
           ↳ Power Button                              id=6    [slave  keyboard (3)]
           ↳ Video Bus                                 id=7    [slave  keyboard (3)]
           ↳ Sleep Button                              id=8    [slave  keyboard (3)]
           ↳ AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]
           ↳ ThinkPad Extra Buttons                    id=12   [slave  keyboard (3)]
           ↳ HID 046a:0011                             id=13   [slave  keyboard (3)]
       ⎡ touchy pointer                                id=15   [master pointer  (16)]
       ⎜   ↳ touchy XTEST pointer                      id=17   [slave  pointer  (15)]
       ⎣ touchy keyboard                               id=16   [master keyboard (15)]
           ↳ touchy XTEST keyboard                     id=18   [slave  keyboard (16)]
  2. Retach your touch screen slave pointer to the new master

    In this example I’ll assume »My Cool™ Touchscreen« to be the device to use (id=14):

    $ xinput reattach 14 15

    This will result in the following:
    $ xinput
      ⎡ Virtual core pointer                          id=2    [master pointer  (3)]
      ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
      ⎜   ↳ SynPS/2 Synaptics TouchPad                id=10   [slave  pointer  (2)]
      ⎜   ↳ TPPS/2 IBM TrackPoint                     id=11   [slave  pointer  (15)]
      ⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
          ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
          ↳ Power Button                              id=6    [slave  keyboard (3)]
          ↳ Video Bus                                 id=7    [slave  keyboard (3)]
          ↳ Sleep Button                              id=8    [slave  keyboard (3)]
          ↳ AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]
          ↳ ThinkPad Extra Buttons                    id=12   [slave  keyboard (3)]
          ↳ HID 046a:0011                             id=13   [slave  keyboard (3)]
      ⎡ touchy pointer                                id=15   [master pointer  (16)]
      ⎜   ↳ My Cool™ Touchscreen                      id=14   [slave  pointer  (2)]
      ⎜   ↳ touchy XTEST pointer                      id=17   [slave  pointer  (15)]
      ⎣ touchy keyboard                               id=16   [master keyboard (15)]
          ↳ touchy XTEST keyboard                     id=18   [slave  keyboard (16)]

Now your touchscreen should act like an individual pointing device.

Edit: To get rid of the second mouse pointer, which is rather superfluous for a touchscreen, you could use this tool, which utilizes the XInput2 extension to change the pointers individually.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments