Ubuntu – mouse sometimes doubleclicks when i click once


I have a problem which is becoming a nightmare, to the extent that I am thinking that it might be easier to just scrap Ubuntu completely and try something else. I have an HP PC running Ubuntu 12.04. When I left-click with my mouse, it sometimes double-clicks (maybe 50% of the time).

So far this has led to: randomly sending unfinished emails, randomly highlighting and deleting things I didn't want to delete whilst writing emails (very frustrating), randomly deleting two browser tabs instead of one (several times), and (in some sense the most annoying) a very very frustating end-user experience when attempting to move windows around on the desktop or to cut-and-paste from a terminal window. Thank goodness for AltF7 — but I don't want to have to learn keyboard shortcuts for every program I use as well as for the OS (and not being able to copy-paste is a great loss for me).

I am not the only person with this problem, but googling indicates that there may well be multiple reasons for it; none of the fixes I have read online have worked for me. Let me go through everything, including fixes that have worked for other people but not for me. Oh — I have an hp optical mouse.

  • It is not a broken mouse. I have tried two mice on my system — both exhibit the problem. Both of these mice work fine on my home laptop also running Ubuntu 12.04.

  • My /etc/X11/xorg.conf is only a few lines long and has no "InputDevice" section.

  • I don't have hald, or the hal package installed.

  • It started about a week ago, and doesn't seem to be getting any better or worse.

  • In desperation I just upgraded to 12.10 but this has not fixed the problem and now I am running a distro that is not an LTS (and hence is not ideal for me :-\ )

But it is rendering my system very hard to use.

Possibly important update: I tried doing some investigations with xev. It seems to me that it looks like a bad connection in these mice — is this common? I can hold down the mouse button, and then get (mouse click) (pause) (mouse release) (very very short pause) (mouse click) (pause) (mouse release) (very very short pause) (mouse click) etc. I wonder whether e.g. other operating systems say "you can't release and then click again within 0.05 seconds, so that must have been a glitch and I'll assume the button was never released". Can I tell Ubuntu to ignore release-and-then-reclick-almost-instantly events??

This so looks like a bad mouse issue. Maybe I should dig out a newer mouse? I've only tried very old ones :-\

Best Answer

OK after extensive testing using xev on the affected machine, and switching around between various mice on various systems, I believe I have solved this problem. Of course YMMV.

My solution: it is a broken mouse.

More precisely, the connector activated when clicking is a bit old or dirty or something, and sometimes, when holding the button down, the connection is made, and then momentarily broken, and then made again, causing the double click.

Objection: But the mouse works fine when I plug it into my Windows machine!

Counter: Wouldn't it be just trivial to put into a driver, or an OS, the following line of pseudocode: "if the user unclicks the mouse and then clicks it again within 0.05 seconds, then that's probably a dirty connector, so let's just ignore that". Thus isn't it possible that if you switch your mouse to another computer running another OS and/or using another driver on different hardware (even with the same OS you could well be using different hardware, right?), you could get different results?

Objection: But I tried another old mouse and it exhibited the same problem!

Counter: amazing how two old mice from the same company can both break in the same way, eh? And you never noticed because that second old mouse you tried was exhibiting no problems when plugged into different hardware (see previous counter).

If you really don't believe your mouse is broken, then test it:

$ xev

and then find the square with the black background, click in it, and watch the output. Do you definitely, always, get one clean "click" and nothing else? I would often get a clean click but occasionally a "bounce "(click unclick click). Even better perhaps:

$ xev | grep ButtonRelease

Now stick the mouse into the square with the black outline (or anywhere in that window) and click and unclick 20 times. You should get a "ButtonRelease" line every time you release the button, and never otherwise. I would occasionally get one when I clicked.

Nightmare over.

Related Question