diff options
-rw-r--r-- | src/draglock.c | 4 | ||||
-rw-r--r-- | src/emuMB.c | 6 | ||||
-rw-r--r-- | src/emuWheel.c | 7 | ||||
-rw-r--r-- | src/evdev.c | 33 | ||||
-rw-r--r-- | src/evdev.h | 9 |
5 files changed, 33 insertions, 26 deletions
diff --git a/src/draglock.c b/src/draglock.c index 414166f..203f25c 100644 --- a/src/draglock.c +++ b/src/draglock.c @@ -152,13 +152,13 @@ void EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button) { EvdevPtr pEvdev = (EvdevPtr)pInfo->private; - BOOL state=0; + BOOL state = 0; /* update button state */ state = pEvdev->dragLock.lock_state[button - 1] ? FALSE : TRUE; pEvdev->dragLock.lock_state[button - 1] = state; - xf86PostButtonEvent(pInfo->dev, 0, button, state, 0, 0); + EvdevPostButtonEvent(pInfo, button, state); } /* Filter button presses looking for either a meta button or the diff --git a/src/emuMB.c b/src/emuMB.c index b29f552..dc689b6 100644 --- a/src/emuMB.c +++ b/src/emuMB.c @@ -198,7 +198,7 @@ EvdevMBEmuTimer(InputInfoPtr pInfo) pEvdev->emulateMB.pending = FALSE; if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) { - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + EvdevPostButtonEvent(pInfo, abs(id), (id >= 0)); pEvdev->emulateMB.state = stateTab[pEvdev->emulateMB.state][4][2]; } else { @@ -248,12 +248,12 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press) if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0) { - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + EvdevPostButtonEvent(pInfo, abs(id), (id >= 0)); ret = TRUE; } if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0) { - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + EvdevPostButtonEvent(pInfo, abs(id), (id >= 0)); ret = TRUE; } 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); } } 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]) { diff --git a/src/evdev.h b/src/evdev.h index 23ee003..142801c 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -25,6 +25,7 @@ * Kristian Høgsberg (krh@redhat.com) * Adam Jackson (ajax@redhat.com) * Peter Hutterer (peter@cs.unisa.edu.au) + * Oliver McFadden (oliver.mcfadden@nokia.com) */ #ifndef EVDEV_H @@ -179,6 +180,14 @@ typedef struct { EventQueueRec queue[EVDEV_MAXQUEUE]; } EvdevRec, *EvdevPtr; +/* Event posting functions */ +void EvdevPostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value); +void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value); +void EvdevPostButtonClicks(InputInfoPtr pInfo, int button, int count); +void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v, + int v[MAX_VALUATORS]); +void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v, + int v[MAX_VALUATORS]); unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code); /* Middle Button emulation */ |