diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-07-23 13:24:34 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-08-13 11:07:21 +1000 |
commit | 1a172f3297369a72865232c382abfc14281102a4 (patch) | |
tree | 668766fb10489d8109b1d27ea7d73f8a14aceea2 /xkb | |
parent | 651c36e95ec0ac60d3fb98966df4218712ae78c2 (diff) |
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>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkbActions.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index c36dba0b5..59c7fc5e5 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -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); } |