You are not logged in.

#1 2019-08-30 23:36:38

tomgg
Member
Registered: 2013-05-01
Posts: 40

Xorg not sending middle mouse keypress until after key is released

Hello, I'm having some trouble with a middle mouse button.

Below are two concurent logs of the following exercise: press and hold middle
mouse button for ~3 seconds.

It seems that the ButtonPress and ButtonRelease events are detected by Xorg at
the same time. Yet, the `evtest` log clearly shows the time delay.

How can I have Xorg separate these events?


evtest output:

Input driver version is 1.0.1
Input device ID: bus 0x11 vendor 0x2 product 0xa version 0x0
Input device name: "TPPS/2 Elan TrackPoint"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 272 (BTN_LEFT)
    Event code 273 (BTN_RIGHT)
    Event code 274 (BTN_MIDDLE)
  Event type 2 (EV_REL)
    Event code 0 (REL_X)
    Event code 1 (REL_Y)
Properties:
  Property type 0 (INPUT_PROP_POINTER)
  Property type 5 (INPUT_PROP_POINTING_STICK)
Testing ... (interrupt to exit)
Event: time 1567207291.440265, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 1
Event: time 1567207291.440265, -------------- SYN_REPORT ------------
Event: time 1567207294.781026, type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 0
Event: time 1567207294.781026, -------------- SYN_REPORT ------------

xev output:

ButtonPress event, serial 32, synthetic NO, window 0x2000001,
    root 0x16a, subw 0x2000002, time 168957798, (50,49), root:(1330,77),
    state 0x0, button 2, same_screen YES

EnterNotify event, serial 32, synthetic NO, window 0x2000001,
    root 0x16a, subw 0x0, time 168957798, (50,49), root:(1330,77),
    mode NotifyGrab, detail NotifyInferior, same_screen YES,
    focus YES, state 512

KeymapNotify event, serial 32, synthetic NO, window 0x0,
    keys:  106 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

ButtonRelease event, serial 32, synthetic NO, window 0x2000001,
    root 0x16a, subw 0x2000002, time 168957798, (50,49), root:(1330,77),
    state 0x200, button 2, same_screen YES

Offline

#2 2019-08-31 00:34:44

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Xorg not sending middle mouse keypress until after key is released

This is different here for me. I get one event the moment I start holding down the mouse button, and then a second event when I let go of the button. See here:

ButtonPress event, serial 25, synthetic NO, window 0x5800001,
root 0x6cc, subw 0x0, time 53619583, (75,122), root:(1266,776),
state 0x0, button 2, same_screen YES

ButtonRelease event, serial 25, synthetic NO, window 0x5800001,
root 0x6cc, subw 0x0, time 53623488, (75,122), root:(1266,776),
state 0x200, button 2, same_screen YES

You can see the "time" value has a different number for me for the two events. I held down the button for about five seconds, and that's visible there in the "time" values.

Maybe you are running a program that is doing something to the mouse button event?

Last edited by Ropid (2019-08-31 00:35:55)

Offline

#3 2019-08-31 06:06:35

tomgg
Member
Registered: 2013-05-01
Posts: 40

Re: Xorg not sending middle mouse keypress until after key is released

Hmm, I've tried this with wev/Swayland, which gives a combo of the two behaviours:

[173387.851549919] [11:      wl_pointer] button: serial: 7194; time: 173385401; button: 274 (middle), state: 1 (pressed)
[173387.851562846] [11:      wl_pointer] frame
[173387.851566814] [11:      wl_pointer] button: serial: 7195; time: 173387851; button: 274 (middle), state: 0 (released)
[173387.851570897] [11:      wl_pointer] frame

Here the event timestamps are distinct. But note that the press was
actually made 2 seconds before showing up in the log entry.

Last edited by tomgg (2019-08-31 06:08:01)

Offline

#4 2019-08-31 06:23:30

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,743

Re: Xorg not sending middle mouse keypress until after key is released

There should be no EnterNotify/KeymapNotify events what typically means the button is taken by some global shortcut and that's probably the cause for the implicit release.

Edit: do they also show up if the xev window is explicitly activated?

Last edited by seth (2019-08-31 06:24:41)

Online

#5 2019-08-31 06:32:14

tomgg
Member
Registered: 2013-05-01
Posts: 40

Re: Xorg not sending middle mouse keypress until after key is released

Dear seth,
The EnterNotify/KeymapNotify sent because I had placed the pointer inside xev's little black box. Keeping the pointer outside of the box gives:

ButtonPress event, serial 32, synthetic NO, window 0xc00001,
    root 0x16a, subw 0x0, time 177096951, (260,696), root:(1540,724),
    state 0x0, button 2, same_screen YES

ButtonRelease event, serial 32, synthetic NO, window 0xc00001,
    root 0x16a, subw 0x0, time 177096951, (260,696), root:(1540,724),
    state 0x200, button 2, same_screen YES

as you would expect. The times are still identical.

And, for clarification, the problem isn't an implicit release; it's a delayed press.

Offline

#6 2019-08-31 06:42:41

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,743

Re: Xorg not sending middle mouse keypress until after key is released

'key.
The sway test suggests the timestamps are preserved but the events passed as batch.

a) is the press also late in evtest?
b) do you use evdev or libinput in X11?
c) behavior in "libinput debug-events"?

Wild guess: Do you have "lsmod | grep psmouse"?
What if you pass "elantech_smbus=1" and "synaptics_intertouch=1" to the module?

Online

#7 2019-08-31 09:03:39

tomgg
Member
Registered: 2013-05-01
Posts: 40

Re: Xorg not sending middle mouse keypress until after key is released

Hi Seth, thanks for helping.

a) press is on time and works as expected in evtest (there's some log output in the OP)
b) libinput
c) this gives the swayland behaviour; i.e. events preserve the timing but are batched up so that press doesn't send until button is released.

Yes, I'm using psmouse. And I already have those params set for some other unreleated reason.

Offline

#8 2019-08-31 10:16:49

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,743

Re: Xorg not sending middle mouse keypress until after key is released

Smells like a libinput bug, did you try xf86-input-evdev?

Online

Board footer

Powered by FluxBB