Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 :/

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
awsome, thanks :D my Cool new pointer device is working! But now I see 2 mice on the screen :P –  Alko May 15 at 8:35
1  
See Edit. Unfortunately (AFAIK) there's no standard utility which exposes the complete XInput2-API (which is required to handle multi-input setups and do things like individual cursor changing). –  Andreas Wiese May 15 at 11:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.