diff options
author | Oliver McFadden <oliver.mcfadden@nokia.com> | 2009-08-02 12:03:04 +0300 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-08-04 16:07:17 +1000 |
commit | 69d6ff3e01263ce2d52ed18b08f054bf3fdb923c (patch) | |
tree | 117bd91d00a9e6e2ee572d7de40c6facddfba4e4 /src/evdev.c | |
parent | 6f4634111a83808bc52e7e53733cf2d3bab0cccd (diff) | |
download | xorg-driver-xf86-input-evdev-69d6ff3e01263ce2d52ed18b08f054bf3fdb923c.tar.gz |
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 <peter.hutterer@who-t.net>
Diffstat (limited to 'src/evdev.c')
-rw-r--r-- | src/evdev.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/evdev.c b/src/evdev.c index e4e6d72..9528dbf 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -24,6 +24,7 @@ * Kristian Høgsberg (krh@redhat.com) * Adam Jackson (ajax@redhat.com) * Peter Hutterer (peter.hutterer@redhat.com) + * Oliver McFadden (oliver.mcfadden@nokia.com) */ #ifdef HAVE_CONFIG_H @@ -248,8 +249,8 @@ static int wheel_down_button = 5; static int wheel_left_button = 6; static int wheel_right_button = 7; -static void -PostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value) +void +EvdevPostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value) { int code = ev->code + MIN_KEYCODE; static char warned[KEY_CNT]; @@ -296,8 +297,8 @@ PostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value) pEvdev->num_queue++; } -static void -PostButtonEvent(InputInfoPtr pInfo, int button, int value) +void +EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value) { EventQueuePtr pQueue; EvdevPtr pEvdev = pInfo->private; @@ -315,14 +316,14 @@ PostButtonEvent(InputInfoPtr pInfo, int button, int value) pEvdev->num_queue++; } -static void -PostButtonClicks(InputInfoPtr pInfo, int button, int count) +void +EvdevPostButtonClicks(InputInfoPtr pInfo, int button, int count) { int i; for (i = 0; i < count; i++) { - PostButtonEvent(pInfo, button, 1); - PostButtonEvent(pInfo, button, 0); + EvdevPostButtonEvent(pInfo, button, 1); + EvdevPostButtonEvent(pInfo, button, 0); } } @@ -506,9 +507,9 @@ EvdevProcessButtonEvent(InputInfoPtr pInfo, struct input_event *ev) return; if (button) - PostButtonEvent(pInfo, button, value); + EvdevPostButtonEvent(pInfo, button, value); else - PostKbdEvent(pInfo, ev, value); + EvdevPostKbdEvent(pInfo, ev, value); } /** @@ -536,17 +537,17 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev) switch (ev->code) { case REL_WHEEL: if (value > 0) - PostButtonClicks(pInfo, wheel_up_button, value); + EvdevPostButtonClicks(pInfo, wheel_up_button, value); else if (value < 0) - PostButtonClicks(pInfo, wheel_down_button, -value); + EvdevPostButtonClicks(pInfo, wheel_down_button, -value); break; case REL_DIAL: case REL_HWHEEL: if (value > 0) - PostButtonClicks(pInfo, wheel_right_button, value); + EvdevPostButtonClicks(pInfo, wheel_right_button, value); else if (value < 0) - PostButtonClicks(pInfo, wheel_left_button, -value); + EvdevPostButtonClicks(pInfo, wheel_left_button, -value); break; /* We don't post wheel events as axis motion. */ @@ -628,7 +629,7 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev) /** * Post the relative motion events. */ -static void +void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v, int v[MAX_VALUATORS]) { @@ -642,7 +643,7 @@ EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v, /** * Post the absolute motion events. */ -static void +void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v, int v[MAX_VALUATORS]) { |