xkb: if the button isn't down, don't fake an event.
If the button we're about to fake isn't down (or up), don't fake a release (or press) event for it. Behaviour is the same as before, this just saves a few cycles. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
651c36e95e
commit
1a172f3297
|
@ -1410,6 +1410,7 @@ void
|
|||
XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
|
||||
{
|
||||
DeviceIntPtr ptr;
|
||||
int down;
|
||||
|
||||
/* If dev is a slave device, and the SD is attached, do nothing. If we'd
|
||||
* post through the attached master pointer we'd get duplicate events.
|
||||
|
@ -1427,6 +1428,10 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
|
|||
else
|
||||
return;
|
||||
|
||||
down = button_is_down(ptr, button, BUTTON_PROCESSED);
|
||||
if (press == down)
|
||||
return;
|
||||
|
||||
InjectPointerKeyEvents(dev, press ? ButtonPress : ButtonRelease,
|
||||
button, 0, 0, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user