chrippa/ds4drv — pull request #21 by Ape (2014-02-08 09:39:20+00:00)
Title: Mouse improvements

I made some improvements to mouse behaviour. These commits are distinct so I didn't squash them, but I'm happy to do any fixes or rebasing if needed. You may pull just some of the commits if you wish to do so.

The first commit just removes dead code that I discovered while making these improvements.

The second commit makes mouse movement smooth by storing the residual motion and applying it afterwards. With this patch the trackpad mouse is less jerky and analog stick mouse is a lot more controllable, especially when combined with the next patch that tweaks the analog stick deadzones and sensitivity.

The fourth commit makes analog stick mouse options configurable using mapping configurations. You may have multiple mappings that change the sensitivity and deadzone settings. For example try this configuration file:

```
[ds4drv]
daemon = false
hidraw = true

[controller:1]
profile-toggle = ps
profiles = mouse,quickmouse

[profile:mouse]
mapping = mouse

[mapping:mouse]
REL_X = left_analog_x
REL_Y = left_analog_y
BTN_LEFT = button_r2
BTN_RIGHT = button_l2
MOUSE_SENSITIVITY = 0.3
MOUSE_DEADZONE = 4

[profile:quickmouse]
mapping = quickmouse

[mapping:quickmouse]
REL_X = left_analog_x
REL_Y = left_analog_y
BTN_LEFT = button_r2
BTN_RIGHT = button_l2
MOUSE_SENSITIVITY = 2.0
MOUSE_DEADZONE = 0
```

I also have some further mouse improvements in mind, but I haven't implemented them yet.

The DS4 trackpad sends multi-touch information for two pointers. There is a minor issue with the current trackpad mouse. If you first use one finger, then while holding that finger on the trackpad use another, it won't control the mouse, even if you release the first finger at this point.

One option is that both fingers (i.e. both trackpad_touch0 and trackpad_touch1) always control the mouse. Another more advanced option would be implementing true multi-touch gestures. I ofter use two-finger scrolling on my laptop touchpad and I think it would be useful also with ds4drv trackpad mouse.