Bug 28263 - Left-click delayed - pressing middle click fixes it until reboot
Summary: Left-click delayed - pressing middle click fixes it until reboot
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/evdev (show other bugs)
Version: 7.5 (2009.10)
Hardware: x86 (IA32) Linux (All)
: medium minor
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-26 09:52 UTC by Jakob Unterwurzacher
Modified: 2010-06-01 23:06 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Jakob Unterwurzacher 2010-05-26 09:52:58 UTC
Left-click seems to be delayed, symptoms:
When i try to resize (or move) a window quickly, i miss the border (or titlebar). When i select text quickly, i miss the first few characters or even words. I have to "click hard" to make it do what i want.

The delay goes away once i have clicked the middle mouse button. It is then fixed until reboot or mouse unplug-replug.

This is Xorg 7.5 on Ubuntu 10.04 (Lucid) with a 3-Button mouse (left, right, scrollwhell).

Xorg.0.log of mouse replug: http://pastie.org/978307
Comment 1 Alan Coopersmith 2010-05-26 10:00:37 UTC
Sounds like the default mode of having 3rd button emulation mode on "auto",
in which case it's disabled the first time an actual third (middle) button
is pressed, but until then it has to wait for the timeout on presses of 
either button 1 (left) or button 2 (right) to see if you'll hit the other
one fast enough to trigger the button 3 emulation.

You should be able to "fix" by changing the configuration of mice that 
actually have 3 buttons to disable 3rd button emulation, though I'm not
up-to-date on how to do that with udev/evdev.
Comment 2 Peter Hutterer 2010-05-26 15:56:23 UTC
log copied from pastie.org.

(II) config/udev: Adding input device Logitech USB-PS/2 Optical Mouse (/dev/input/mouse2)
(II) No input driver/identifier specified (ignoring)
(II) config/udev: Adding input device Logitech USB-PS/2 Optical Mouse (/dev/input/event8)
(**) Logitech USB-PS/2 Optical Mouse: Applying InputClass "evdev pointer catchall"
(**) Logitech USB-PS/2 Optical Mouse: always reports core events
(**) Logitech USB-PS/2 Optical Mouse: Device: "/dev/input/event8"
(II) Logitech USB-PS/2 Optical Mouse: Found 3 mouse buttons
(II) Logitech USB-PS/2 Optical Mouse: Found scroll wheel(s)
(II) Logitech USB-PS/2 Optical Mouse: Found relative axes
(II) Logitech USB-PS/2 Optical Mouse: Found x and y relative axes
(II) Logitech USB-PS/2 Optical Mouse: Configuring as mouse
(**) Logitech USB-PS/2 Optical Mouse: YAxisMapping: buttons 4 and 5
(**) Logitech USB-PS/2 Optical Mouse: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
(II) XINPUT: Adding extended input device "Logitech USB-PS/2 Optical Mouse" (type: MOUSE)
(II) Logitech USB-PS/2 Optical Mouse: initialized for relative axes.


Please attach log files here directly so we don't have to rely on other websites keeping our information.
Comment 3 Peter Hutterer 2010-05-26 15:59:37 UTC
10.04 uses server 1.7, right?

Alan is right, the option you're looking for is Option "Emulate3Buttons" "off", see evdev(4) for more info. Configuration instructions are on https://fedoraproject.org/wiki/Input_device_configuration

in your fdi file, add an x11_options for the above option, example from the fedora wiki site:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.touchpad">
        <merge key="input.x11_driver" type="string">synaptics</merge>
        <merge key="input.x11_options.TapButton1" type="string">1</merge>
    </match>
  </device>
</deviceinfo>


then restart HAL, make sure that lshal shows the option and then restart X.
Comment 4 Jakob Unterwurzacher 2010-05-27 02:07:23 UTC
Yes, i have xserver 1.7.6.

The fdi thingy does not work any longer (it used to work in Ubuntu 9.10 - xserver 1.6.4).
lshal gives
udi = '/org/freedesktop/Hal/devices/usb_device_46d_c00e_noserial_if0_logicaldev_input'
[...]
  input.product = 'Logitech USB-PS/2 Optical Mouse'  (string)
  input.x11_options.Emulate3Buttons = 'false'  (string)
  linux.device_file = '/dev/input/event8'  (string)
[...]
which looks good but does not change anything. Hal is dead, no?

I am quite happy with the workaround of pressing the middle button to stop this. But only since i found out by accident!
When you search the web, there are quite a few people struggling with this (whoa, fedora user from 2004: http://forums.fedoraforum.org/showthread.php?t=15704 )

Shouldn't Emulate3Buttons be off from the start when i have 3 buttons already?
Comment 5 Peter Hutterer 2010-05-27 02:51:23 UTC
On Thu, May 27, 2010 at 02:07:23AM -0700, bugzilla-daemon@freedesktop.org wrote:
> --- Comment #4 from Jakob Unterwurzacher <jakobunt@gmail.com> 2010-05-27 02:07:23 PDT ---
> Yes, i have xserver 1.7.6.
> 
> The fdi thingy does not work any longer (it used to work in Ubuntu 9.10 -
> xserver 1.6.4).
> lshal gives
> udi =
> '/org/freedesktop/Hal/devices/usb_device_46d_c00e_noserial_if0_logicaldev_input'
> [...]
>   input.product = 'Logitech USB-PS/2 Optical Mouse'  (string)
>   input.x11_options.Emulate3Buttons = 'false'  (string)
>   linux.device_file = '/dev/input/event8'  (string)
> [...]
> which looks good but does not change anything. Hal is dead, no?

uhm, yes. in 1.8, not in 1.7. AFAIK Ubuntu and Debian have some partial udev
backport, I don't quite know which bits apply and which ones dont. check
x11_input.rules or so in the udev files.

Julien?

> I am quite happy with the workaround of pressing the middle button to stop
> this. But only since i found out by accident!

it's in the man page :)

> When you search the web, there are quite a few people struggling with this
> (whoa, fedora user from 2004:
> http://forums.fedoraforum.org/showthread.php?t=15704 )
> 
> Shouldn't Emulate3Buttons be off from the start when i have 3 buttons already?

well, that's the theory but IIRC for usb mice that field is always set,
curtesy of the PS/2 protocol not allowing any button detection.

it's one more of these things that should just have a checkbox in the GUI
instead of relying on unreliable autodetection...
Comment 6 Jakob Unterwurzacher 2010-05-27 03:10:41 UTC
On 27/05/10 11:51, bugzilla-daemon@freedesktop.org wrote:
>> I am quite happy with the workaround of pressing the middle button to stop
>> this. But only since i found out by accident!
> 
> it's in the man page :)

Oh! That's true :)

>> Shouldn't Emulate3Buttons be off from the start when i have 3 buttons already?
> 
> well, that's the theory but IIRC for usb mice that field is always set,
> curtesy of the PS/2 protocol not allowing any button detection.

What's this then? (from Xorg.0.log)

(II) Logitech USB-PS/2 Optical Mouse: Found 3 mouse buttons

Thanks,
Jakob
Comment 7 Peter Hutterer 2010-05-27 03:39:16 UTC
On Thu, May 27, 2010 at 03:10:41AM -0700, bugzilla-daemon@freedesktop.org wrote:
> > well, that's the theory but IIRC for usb mice that field is always set,
> > curtesy of the PS/2 protocol not allowing any button detection.
> 
> What's this then? (from Xorg.0.log)
> 
> (II) Logitech USB-PS/2 Optical Mouse: Found 3 mouse buttons

we're getting that data from the kernel though. the kernel sets those based
on the HID protocol descriptors but for older mice (though arguably those
don't matter much anymore) it's the PS/2 protocol. and that doesn't have a
detection mechanism so the kernel always sets those bits (link below, line 568).

so evdev will always think there's a 3+ button mouse because that's what the
kernel tells us. Now, the interesting thing would be what happens for
2-button USB mice - I don't actually know and I don't think I've got such a
device available to me.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/input/mouse/psmouse-base.c;h=979c50215282025fef1c7fa795a6bf20fedfcad4;hb=HEAD
Comment 8 Jakob Unterwurzacher 2010-05-27 08:06:04 UTC
Hm, damn.

USB mice are a lot smarter but I am not sure if the kernel takes advantage of that. It looks like this code was just setting every mouse to have 3 buttons:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/hid/usbhid/usbmouse.c#l180

 180         input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
 181                 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);

Anyway, I think 2-button USB mice are so rare that they can be ignored. 2-button touchpads in laptops are common, but they are all PS2 as far as I have seen.

Could we default Emulate3Buttons to off for USB mice, then?
Comment 9 Julien Cristau 2010-05-28 00:29:00 UTC
> --- Comment #5 from Peter Hutterer <peter.hutterer@who-t.net> 2010-05-27 02:51:23 PDT ---
> On Thu, May 27, 2010 at 02:07:23AM -0700, bugzilla-daemon@freedesktop.org
> wrote:
> > --- Comment #4 from Jakob Unterwurzacher <jakobunt@gmail.com> 2010-05-27 02:07:23 PDT ---
> > Yes, i have xserver 1.7.6.
> > 
> > The fdi thingy does not work any longer (it used to work in Ubuntu 9.10 -
> > xserver 1.6.4).
> > lshal gives
> > udi =
> > '/org/freedesktop/Hal/devices/usb_device_46d_c00e_noserial_if0_logicaldev_input'
> > [...]
> >   input.product = 'Logitech USB-PS/2 Optical Mouse'  (string)
> >   input.x11_options.Emulate3Buttons = 'false'  (string)
> >   linux.device_file = '/dev/input/event8'  (string)
> > [...]
> > which looks good but does not change anything. Hal is dead, no?
> 
> uhm, yes. in 1.8, not in 1.7. AFAIK Ubuntu and Debian have some partial udev
> backport, I don't quite know which bits apply and which ones dont. check
> x11_input.rules or so in the udev files.
> 
> Julien?
> 
on debian we've ended up backporting the whole udev+inputclass work from
1.8 (except for the NIDR api break).  i'm not sure anymore what ubuntu
10.4 ended up shipping with, but i think something like the following in
xorg.conf should work:

Section "InputClass"
        Identifier "3 buttons"
        MatchIsPointer "on"
        MatchVendor "Logitech"
        Option "Emulate3Buttons" "off"
EndSection
Comment 10 Peter Hutterer 2010-06-01 23:06:38 UTC
commit 21a2ac818e75ef918d320ce1e88b6263e68e598d
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri May 28 09:47:17 2010 +1000

    Disable middle mouse button emulation by default.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.