From 69d6ff3e01263ce2d52ed18b08f054bf3fdb923c Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Sun, 2 Aug 2009 12:03:04 +0300 Subject: evdev: Use the EvdevPost...Event() functions in the emulation code. This is similar to commit 1f641d75edba7394201c1c53938215bae696791b. It provides the same functionality of queuing the (in this case emulated) events and waiting until an EV_SYN synchronization event is received before posting them to the server. This preserves the order of events (both real and emulated) and ensures that MotionNotify events will always be posted first. It also unifies the event posting into a few small functions which improves maintainability. From this point on, you should never use the xf86Post...Event() functions in new code, but rather the EvdevPost...Event() versions. Signed-off-by: Peter Hutterer --- src/emuWheel.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/emuWheel.c') diff --git a/src/emuWheel.c b/src/emuWheel.c index a1c754d..b9337de 100644 --- a/src/emuWheel.c +++ b/src/emuWheel.c @@ -82,8 +82,7 @@ EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value) * If the button is released early enough emit the button * press/release events */ - xf86PostButtonEvent(pInfo->dev, 0, button, 1, 0, 0); - xf86PostButtonEvent(pInfo->dev, 0, button, 0, 0, 0); + EvdevPostButtonClicks(pInfo, button, 1); } } @@ -163,10 +162,8 @@ EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value) /* Produce button press events for wheel motion */ while(abs(axis->traveled_distance) > pEvdev->emulateWheel.inertia) { - axis->traveled_distance -= inertia; - xf86PostButtonEvent(pInfo->dev, 0, button, 1, 0, 0); - xf86PostButtonEvent(pInfo->dev, 0, button, 0, 0, 0); + EvdevPostButtonClicks(pInfo, button, 1); } } -- cgit v1.2.3