# Mouse debouncing

## Aiwendil

Hope this is the right place to post this...

Sadly I am forced to use a pretty bad mouse since a few days...one that very often registers left clicks as double-clicks. After searching the web a bit I ran into this: http://blog.guntram.de/?p=16

The patches offered there needed some slight adjustment (due to xf86-input-evdev gaining soft scrolling support). But other than move one hunk by three line I didn't really do anything. It seems to work pretty well for me (using it since a few days now)..so thought I might post it here with the updated patches in case others have a use for it too.

Updated patch for x11-drivers/xf86-input-evdev-2.10.5: https://pastebin.com/LPk5Cc4F

Patch is almost 3000 lines and I am for sure not very versed in x11 programming...at a short glance nothing "irregular" jumps at the eye...but yeah...better check yourself, I wouldn't trust me on that. ;)

After putting the patch in /etc/portage/patches/x11-drivers/xf86-input-evdev (might want /etc/portage/patches/x11-drivers/xf86-input-evdev-2.10.5 instead though to have it only applied to this version and not future ones) and rebuilding x11-drivers/xf86-input-evdev it was just following the blog linked above for the config. I have a /etc/X11/xorg.conf.d/05-mouse.conf (not in /usr/share as the blog says) file with this now:

```
Section "InputClass"

        Identifier "evdev pointer debounce"

        MatchIsPointer "on"

        MatchDriver "evdev"

        Option "DebounceDelay" "20"

EndSection
```

For me this works pretty well and gives this old mouse a grace period before it gets trashed. So big thanks to Guntram for the blog and of course to Matt Whitlock for the patch. Maybe useful for someone else too.

----------

## Zucca

I have bouncing issue on one of the total four buttons of my Logitech Marble Trackball.

I might try this. Although choosing a capacitor carefully an placing it in parallel with the switch should solve the issue too. ;) The capacitor based hardware fix can (will) lead to some lag on button unpress.

----------

## t3k0

Hi all,

I have a very similar problem with my expensive Logitech G500 since a few weeks. (Before it worked for years without problems.)

However, I'm not absolutely sure if this is the same issue. Could you tell me before I start messing round with patches, if you observed similar behaviour:

First example:

Very often a single left or right click behaves like a double click. I.e. if I right click for a context menu, very often the first entry gets clicked as well, what is very annoying. 

Second example: 

If I left click on the play button of a music player it directly pauses since it is received as a double click.

Third example: 

If I resize a window by holding down the left button on the window edge and move the mouse, after a short distance, the mouse releases the window edge and the resizing stops. 

Same behaviour if I select text in a document. After selecting several words or sentences the mouse button releases for a very short time. The previously selected text is not selected anymore and it continues selecting the text after this event.

I don't know which package is responsible for this bug. I don't believe that my mouse button is broken, since it shows the same behaviour for both the left and the right button. The examples above are not related to a specific software. I observed this behaviour in both xfce 4.12 and mate 1.12-r1. I use x11-drivers/xf86-input-mouse-1.9.2 and x11-base/xorg-server-1.19.3.

Help is appreciated. If I can provide further information please let me know.

If it is the same issue and several people experience this, we should reopen this bug-report and file your patch in it (link).

----------

## acmondor

I had the "left single click behaves as a double click" problem show up recently. I switched back to KDE Plasma from LxQt not that long ago and I think the problem started sometime after that, but I'm not 100% sure. The problem seems to have shown up around time I switched from linux-4.9.34-gentoo to linux-4.12.5-gentoo, but again I'm not 100% certain. What I do know for sure is that I was able to get rid of the problem by adjusting "Double click interval" in the Advanced tab of System Settings -> Input Devices -> Mouse. The default value was 400msec and I changed it to 300msec.

----------

## Ant P.

libinput 1.8.2 has button debouncing built in, fwiw. Won't work in xf86-input-{mouse,evdev} for obvious reasons.

----------

