[PATCH xf86-input-evdev 1/2] Re-indent: put '{' on new line
Peter Hutterer
peter.hutterer at who-t.net
Wed Jan 18 16:21:12 PST 2012
On Thu, Jan 12, 2012 at 04:00:32PM +0100, Chase Douglas wrote:
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
did you run ident or something to get this? it doesn't apply cleanly but if
it's just a ident line it'd be easy enough to reproduce.
also, given daniels' patch on the xserver, it might be a good idea to just
use the same ident option as the server.
Cheers,
Peter
> ---
> src/apple.c | 9 +-
> src/draglock.c | 57 +++++++---
> src/emuMB.c | 15 ++-
> src/emuThird.c | 3 +-
> src/emuWheel.c | 54 ++++++---
> src/evdev.c | 339 +++++++++++++++++++++++++++++++++++++-------------------
> 6 files changed, 318 insertions(+), 159 deletions(-)
>
> diff --git a/src/apple.c b/src/apple.c
> index 8e00a84..a6e72ef 100644
> --- a/src/apple.c
> +++ b/src/apple.c
> @@ -87,7 +87,8 @@ struct product_table
> {
> unsigned int vendor;
> unsigned int product;
> -} apple_keyboard_table[] = {
> +} apple_keyboard_table[] =
> +{
> { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI},
> { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO},
> { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS},
> @@ -220,7 +221,8 @@ static void set_fkeymode_property(InputInfoPtr pInfo, enum fkeymode fkeymode)
> return;
> }
>
> - if (!prop_fkeymode) {
> + if (!prop_fkeymode)
> + {
> init = TRUE;
> prop_fkeymode = MakeAtom(EVDEV_PROP_FUNCTION_KEYS, strlen(EVDEV_PROP_FUNCTION_KEYS), TRUE);
> }
> @@ -251,7 +253,8 @@ EvdevAppleGetProperty (DeviceIntPtr dev, Atom property)
> enum fkeymode fkeymode;
>
> fkeymode = get_fnmode();
> - if (fkeymode != pEvdev->fkeymode) {
> + if (fkeymode != pEvdev->fkeymode)
> + {
> /* set internal copy first, so we don't write to the file in
> * SetProperty handler */
> pEvdev->fkeymode = fkeymode;
> diff --git a/src/draglock.c b/src/draglock.c
> index ac9d9c0..8156da8 100644
> --- a/src/draglock.c
> +++ b/src/draglock.c
> @@ -69,52 +69,64 @@ EvdevDragLockPreInit(InputInfoPtr pInfo)
> next_num = option_string;
>
> /* Loop until we hit the end of our option string */
> - while (next_num != NULL) {
> + while (next_num != NULL)
> + {
> lock_button = 0;
> meta_button = strtol(next_num, &end_str, 10);
>
> /* check to see if we found anything */
> - if (next_num != end_str) {
> + if (next_num != end_str)
> + {
> /* setup for the next number */
> next_num = end_str;
> - } else {
> + } else
> + {
> /* we have nothing more to parse, drop out of the loop */
> next_num = NULL;
> }
>
> /* Check for a button to lock if we have a meta button */
> - if (meta_button != 0 && next_num != NULL ) {
> + if (meta_button != 0 && next_num != NULL )
> + {
> lock_button = strtol(next_num, &end_str, 10);
>
> /* check to see if we found anything */
> - if (next_num != end_str) {
> + if (next_num != end_str)
> + {
> /* setup for the next number */
> next_num = end_str;
> - } else {
> + } else
> + {
> /* we have nothing more to parse, drop out of the loop */
> next_num = NULL;
> }
> }
>
> /* Ok, let the user know what we found on this look */
> - if (meta_button != 0) {
> - if (lock_button == 0) {
> - if (!pairs) {
> + if (meta_button != 0)
> + {
> + if (lock_button == 0)
> + {
> + if (!pairs)
> + {
> /* We only have a meta button */
> pEvdev->dragLock.meta = meta_button;
>
> xf86IDrvMsg(pInfo, X_CONFIG, "DragLockButtons : "
> "%i as meta\n", meta_button);
> - } else {
> + } else
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "DragLockButtons : "
> "Incomplete pair specifying button pairs %s\n",
> option_string);
> }
> - } else {
> + } else
> + {
>
> /* Do bounds checking to make sure we don't crash */
> if ((meta_button <= EVDEV_MAXBUTTONS) && (meta_button >= 0 ) &&
> - (lock_button <= EVDEV_MAXBUTTONS) && (lock_button >= 0)) {
> + (lock_button <= EVDEV_MAXBUTTONS) && (lock_button >= 0))
> + {
>
> xf86IDrvMsg(pInfo, X_CONFIG,
> "DragLockButtons : %i -> %i\n",
> @@ -122,7 +134,8 @@ EvdevDragLockPreInit(InputInfoPtr pInfo)
>
> pEvdev->dragLock.lock_pair[meta_button - 1] = lock_button;
> pairs=TRUE;
> - } else {
> + } else
> + {
> /* Let the user know something was wrong
> with this pair of buttons */
> xf86IDrvMsg(pInfo, X_CONFIG,"DragLockButtons : "
> @@ -130,7 +143,8 @@ EvdevDragLockPreInit(InputInfoPtr pInfo)
> meta_button, lock_button);
> }
> }
> - } else {
> + } else
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "Found DragLockButtons "
> "with invalid lock button string : '%s'\n",
> option_string);
> @@ -179,16 +193,19 @@ EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
>
> /* Do we have a single meta key or
> several button pairings? */
> - if (pEvdev->dragLock.meta != 0) {
> + if (pEvdev->dragLock.meta != 0)
> + {
>
> - if (pEvdev->dragLock.meta == button) {
> + if (pEvdev->dragLock.meta == button)
> + {
>
> /* setup up for button lock */
> if (value)
> pEvdev->dragLock.meta_state = TRUE;
>
> return TRUE;
> - } else if (pEvdev->dragLock.meta_state) { /* waiting to lock */
> + } else if (pEvdev->dragLock.meta_state) /* waiting to lock */
> + {
>
> pEvdev->dragLock.meta_state = FALSE;
>
> @@ -196,7 +213,8 @@ EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
>
> return TRUE;
> }
> - } else if (pEvdev->dragLock.lock_pair[button - 1] && value) {
> + } else if (pEvdev->dragLock.lock_pair[button - 1] && value)
> + {
> /* A meta button in a meta/lock pair was pressed */
> EvdevDragLockLockButton(pInfo, pEvdev->dragLock.lock_pair[button - 1]);
> return TRUE;
> @@ -296,7 +314,8 @@ EvdevDragLockInitProperty(DeviceIntPtr dev)
> XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8,
> PropModeReplace, 1, &pEvdev->dragLock.meta,
> FALSE);
> - } else {
> + } else
> + {
> int highest = 0;
> int i;
> CARD8 pair[EVDEV_MAXBUTTONS] = {0};
> diff --git a/src/emuMB.c b/src/emuMB.c
> index eb01495..d6f88c8 100644
> --- a/src/emuMB.c
> +++ b/src/emuMB.c
> @@ -88,7 +88,8 @@ static Atom prop_mbtimeout = 0; /* Middle button timeout property */
> * If the buttons are in <button state>, generate <events> then go to
> * <new emulation state>.
> */
> -static signed char stateTab[11][5][3] = {
> +static signed char stateTab[11][5][3] =
> +{
> /* 0 ground */
> {
> { 0, 0, 0 }, /* nothing -> ground (no change) */
> @@ -190,12 +191,14 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
> sigstate = xf86BlockSIGIO ();
>
> pEvdev->emulateMB.pending = FALSE;
> - if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
> + if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0)
> + {
> EvdevPostButtonEvent(pInfo, abs(id),
> (id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
> pEvdev->emulateMB.state =
> stateTab[pEvdev->emulateMB.state][4][2];
> - } else {
> + } else
> + {
> ErrorF("Got unexpected buttonTimer in state %d\n",
> pEvdev->emulateMB.state);
> }
> @@ -249,11 +252,13 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
> pEvdev->emulateMB.state =
> stateTab[pEvdev->emulateMB.state][*btstate][2];
>
> - if (stateTab[pEvdev->emulateMB.state][4][0] != 0) {
> + if (stateTab[pEvdev->emulateMB.state][4][0] != 0)
> + {
> pEvdev->emulateMB.expires = GetTimeInMillis () + pEvdev->emulateMB.timeout;
> pEvdev->emulateMB.pending = TRUE;
> ret = TRUE;
> - } else {
> + } else
> + {
> pEvdev->emulateMB.pending = FALSE;
> }
>
> diff --git a/src/emuThird.c b/src/emuThird.c
> index 7461767..9d0d919 100644
> --- a/src/emuThird.c
> +++ b/src/emuThird.c
> @@ -51,7 +51,8 @@ static Atom prop_3bbutton; /* Right button target physical button */
> static Atom prop_3bthreshold; /* Right button move cancellation threshold */
>
> /* State machine for 3rd button emulation */
> -enum EmulationState {
> +enum EmulationState
> +{
> EM3B_OFF, /* no event */
> EM3B_PENDING, /* timer pending */
> EM3B_EMULATING /* in emulation */
> diff --git a/src/emuWheel.c b/src/emuWheel.c
> index ae894fa..b89fbe1 100644
> --- a/src/emuWheel.c
> +++ b/src/emuWheel.c
> @@ -66,16 +66,19 @@ EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value)
> return FALSE;
>
> /* Check for EmulateWheelButton */
> - if (pEvdev->emulateWheel.button == button) {
> + if (pEvdev->emulateWheel.button == button)
> + {
> pEvdev->emulateWheel.button_state = value;
>
> if (value)
> /* Start the timer when the button is pressed */
> pEvdev->emulateWheel.expires = pEvdev->emulateWheel.timeout +
> GetTimeInMillis();
> - else {
> + else
> + {
> ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
> - if (ms > 0) {
> + if (ms > 0)
> + {
> /*
> * If the button is released early enough emit the button
> * press/release events
> @@ -107,7 +110,8 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
> /* Handle our motion events if the emuWheel button is pressed
> * wheel button of 0 means always emulate wheel.
> */
> - if (pEvdev->emulateWheel.button_state || !pEvdev->emulateWheel.button) {
> + if (pEvdev->emulateWheel.button_state || !pEvdev->emulateWheel.button)
> + {
> /* Just return if the timeout hasn't expired yet */
> if (pEvdev->emulateWheel.button)
> {
> @@ -117,14 +121,16 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
> }
>
> /* We don't want to intercept real mouse wheel events */
> - if(pEv->type == EV_ABS) {
> + if(pEv->type == EV_ABS)
> + {
> int axis = pEvdev->axis_map[pEv->code];
> oldValue = valuator_mask_get(pEvdev->vals, axis);
> valuator_mask_set(pEvdev->vals, axis, value);
> value -= oldValue; /* make value into a differential measurement */
> }
>
> - switch(pEv->code) {
> + switch(pEv->code)
> + {
>
> /* ABS_X has the same value as REL_X, so this case catches both */
> case REL_X:
> @@ -177,16 +183,19 @@ EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value)
>
> axis->traveled_distance += value;
>
> - if (axis->traveled_distance < 0) {
> + if (axis->traveled_distance < 0)
> + {
> button = axis->up_button;
> inertia = -pEvdev->emulateWheel.inertia;
> - } else {
> + } else
> + {
> button = axis->down_button;
> inertia = pEvdev->emulateWheel.inertia;
> }
>
> /* Produce button press events for wheel motion */
> - while(abs(axis->traveled_distance) > pEvdev->emulateWheel.inertia) {
> + while(abs(axis->traveled_distance) > pEvdev->emulateWheel.inertia)
> + {
> axis->traveled_distance -= inertia;
> EvdevQueueButtonClicks(pInfo, button, 1);
> rc++;
> @@ -206,14 +215,16 @@ EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char* axis_
>
> /* Check to see if there is configuration for this axis */
> option_string = xf86SetStrOption(pInfo->options, axis_name, NULL);
> - if (option_string) {
> + if (option_string)
> + {
> int up_button = 0;
> int down_button = 0;
> char *msg = NULL;
>
> if ((sscanf(option_string, "%d %d", &up_button, &down_button) == 2) &&
> ((up_button > 0) && (up_button <= EVDEV_MAXBUTTONS)) &&
> - ((down_button > 0) && (down_button <= EVDEV_MAXBUTTONS))) {
> + ((down_button > 0) && (down_button <= EVDEV_MAXBUTTONS)))
> + {
>
> /* Use xstrdup to allocate a string for us */
> msg = xstrdup("buttons XX and YY");
> @@ -228,14 +239,16 @@ EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char* axis_
> if (up_button > pEvdev->num_buttons) pEvdev->num_buttons = up_button;
> if (down_button > pEvdev->num_buttons) pEvdev->num_buttons = down_button;
>
> - } else {
> + } else
> + {
> xf86IDrvMsg(pInfo, X_WARNING, "Invalid %s value:\"%s\"\n",
> axis_name, option_string);
> }
> free(option_string);
>
> /* Clean up and log what happened */
> - if (msg) {
> + if (msg)
> + {
> xf86IDrvMsg(pInfo, X_CONFIG, "%s: %s\n", axis_name, msg);
> free(msg);
> return TRUE;
> @@ -253,14 +266,16 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
> int inertia;
> int timeout;
>
> - if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE)) {
> + if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE))
> + {
> pEvdev->emulateWheel.enabled = TRUE;
> } else
> pEvdev->emulateWheel.enabled = FALSE;
>
> wheelButton = xf86SetIntOption(pInfo->options, "EmulateWheelButton", 4);
>
> - if ((wheelButton < 0) || (wheelButton > EVDEV_MAXBUTTONS)) {
> + if ((wheelButton < 0) || (wheelButton > EVDEV_MAXBUTTONS))
> + {
> xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelButton value: %d\n",
> wheelButton);
> xf86IDrvMsg(pInfo, X_WARNING, "Wheel emulation disabled.\n");
> @@ -272,7 +287,8 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
>
> inertia = xf86SetIntOption(pInfo->options, "EmulateWheelInertia", 10);
>
> - if (inertia <= 0) {
> + if (inertia <= 0)
> + {
> xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelInertia value: %d\n",
> inertia);
> xf86IDrvMsg(pInfo, X_WARNING, "Using built-in inertia value.\n");
> @@ -284,7 +300,8 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
>
> timeout = xf86SetIntOption(pInfo->options, "EmulateWheelTimeout", 200);
>
> - if (timeout < 0) {
> + if (timeout < 0)
> + {
> xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelTimeout value: %d\n",
> timeout);
> xf86IDrvMsg(pInfo, X_WARNING, "Using built-in timeout value.\n");
> @@ -296,7 +313,8 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
>
> /* Configure the Y axis or default it */
> if (!EvdevWheelEmuHandleButtonMap(pInfo, &(pEvdev->emulateWheel.Y),
> - "YAxisMapping")) {
> + "YAxisMapping"))
> + {
> /* Default the Y axis to sane values */
> pEvdev->emulateWheel.Y.up_button = 4;
> pEvdev->emulateWheel.Y.down_button = 5;
> diff --git a/src/evdev.c b/src/evdev.c
> index 989a255..47b9652 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -93,7 +93,8 @@
> #define ABS_MT_TRACKING_ID 0x39
> #endif
>
> -static char *evdevDefaults[] = {
> +static char *evdevDefaults[] =
> +{
> "XkbRules", "evdev",
> "XkbModel", "evdev",
> "XkbLayout", "us",
> @@ -101,7 +102,8 @@ static char *evdevDefaults[] = {
> };
>
> /* Any of those triggers a proximity event */
> -static int proximity_bits[] = {
> +static int proximity_bits[] =
> +{
> BTN_TOOL_PEN,
> BTN_TOOL_RUBBER,
> BTN_TOOL_BRUSH,
> @@ -155,7 +157,8 @@ static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
> return XI_BadMode;
> }
>
> - switch (mode) {
> + switch (mode)
> + {
> case Absolute:
> pEvdev->flags &= ~EVDEV_RELATIVE_MODE;
> break;
> @@ -176,7 +179,8 @@ static size_t EvdevCountBits(unsigned long *array, size_t nlongs)
> unsigned int i;
> size_t count = 0;
>
> - for (i = 0; i < nlongs; i++) {
> + for (i = 0; i < nlongs; i++)
> + {
> unsigned long x = array[i];
>
> while (x > 0)
> @@ -281,11 +285,14 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
> {
> char *s;
>
> - if ((s = xf86SetStrOption(pInfo->options, name, NULL))) {
> - if (!s[0]) {
> + if ((s = xf86SetStrOption(pInfo->options, name, NULL)))
> + {
> + if (!s[0])
> + {
> free(s);
> *option = NULL;
> - } else {
> + } else
> + {
> *option = s;
> }
> }
> @@ -422,7 +429,8 @@ EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count)
> {
> int i;
>
> - for (i = 0; i < count; i++) {
> + for (i = 0; i < count; i++)
> + {
> EvdevQueueButtonEvent(pInfo, button, 1);
> EvdevQueueButtonEvent(pInfo, button, 0);
> }
> @@ -439,8 +447,10 @@ EvdevProcessValuators(InputInfoPtr pInfo)
> int *delta = pEvdev->delta;
>
> /* convert to relative motion for touchpads */
> - if (pEvdev->abs_queued && (pEvdev->flags & EVDEV_RELATIVE_MODE)) {
> - if (pEvdev->in_proximity) {
> + if (pEvdev->abs_queued && (pEvdev->flags & EVDEV_RELATIVE_MODE))
> + {
> + if (pEvdev->in_proximity)
> + {
> if (valuator_mask_isset(pEvdev->vals, 0))
> {
> if (valuator_mask_isset(pEvdev->old_vals, 0))
> @@ -457,7 +467,8 @@ EvdevProcessValuators(InputInfoPtr pInfo)
> valuator_mask_set(pEvdev->old_vals, 1,
> valuator_mask_get(pEvdev->vals, 1));
> }
> - } else {
> + } else
> + {
> valuator_mask_zero(pEvdev->old_vals);
> }
> valuator_mask_zero(pEvdev->vals);
> @@ -465,10 +476,12 @@ EvdevProcessValuators(InputInfoPtr pInfo)
> pEvdev->rel_queued = 1;
> }
>
> - if (pEvdev->rel_queued) {
> + if (pEvdev->rel_queued)
> + {
> int i;
>
> - if (pEvdev->swap_axes) {
> + if (pEvdev->swap_axes)
> + {
> tmp = pEvdev->delta[REL_X];
> pEvdev->delta[REL_X] = pEvdev->delta[REL_Y];
> pEvdev->delta[REL_Y] = tmp;
> @@ -503,15 +516,18 @@ EvdevProcessValuators(InputInfoPtr pInfo)
> * initialized to 1 so devices that don't use this scheme still
> * just works.
> */
> - else if (pEvdev->abs_queued && pEvdev->in_proximity) {
> + else if (pEvdev->abs_queued && pEvdev->in_proximity)
> + {
> int i;
>
> - if (pEvdev->swap_axes) {
> + if (pEvdev->swap_axes)
> + {
> int swapped_isset[2] = {0, 0};
> int swapped_values[2];
>
> for(i = 0; i <= 1; i++)
> - if (valuator_mask_isset(pEvdev->vals, i)) {
> + if (valuator_mask_isset(pEvdev->vals, i))
> + {
> swapped_isset[1 - i] = 1;
> swapped_values[1 - i] =
> xf86ScaleAxis(valuator_mask_get(pEvdev->vals, i),
> @@ -528,7 +544,8 @@ EvdevProcessValuators(InputInfoPtr pInfo)
> valuator_mask_unset(pEvdev->vals, i);
> }
>
> - for (i = 0; i <= 1; i++) {
> + for (i = 0; i <= 1; i++)
> + {
> int val;
> int calib_min;
> int calib_max;
> @@ -538,10 +555,12 @@ EvdevProcessValuators(InputInfoPtr pInfo)
>
> val = valuator_mask_get(pEvdev->vals, i);
>
> - if (i == 0) {
> + if (i == 0)
> + {
> calib_min = pEvdev->calibration.min_x;
> calib_max = pEvdev->calibration.max_x;
> - } else {
> + } else
> + {
> calib_min = pEvdev->calibration.min_y;
> calib_max = pEvdev->calibration.max_y;
> }
> @@ -682,7 +701,8 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
> /* Get the signed value, earlier kernels had this as unsigned */
> value = ev->value;
>
> - switch (ev->code) {
> + switch (ev->code)
> + {
> #ifndef HAVE_SMOOTH_SCROLLING
> case REL_WHEEL:
> if (value > 0)
> @@ -752,19 +772,22 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
> EvdevPtr pEvdev = pInfo->private;
> int map;
>
> - if (ev->code == ABS_MT_SLOT) {
> + if (ev->code == ABS_MT_SLOT)
> + {
> EvdevProcessTouch(pInfo);
> pEvdev->cur_slot = ev->value;
> } else
> {
> if (pEvdev->slot_state == SLOTSTATE_EMPTY)
> pEvdev->slot_state = SLOTSTATE_UPDATE;
> - if (ev->code == ABS_MT_TRACKING_ID) {
> + if (ev->code == ABS_MT_TRACKING_ID)
> + {
> if (ev->value >= 0)
> pEvdev->slot_state = SLOTSTATE_OPEN;
> else
> pEvdev->slot_state = SLOTSTATE_CLOSE;
> - } else {
> + } else
> + {
> map = pEvdev->axis_map[ev->code];
> valuator_mask_set(pEvdev->mt_mask, map, ev->value);
> }
> @@ -798,10 +821,12 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
> if (EvdevWheelEmuFilterMotion(pInfo, ev))
> return;
>
> - if (ev->code >= ABS_MT_SLOT) {
> + if (ev->code >= ABS_MT_SLOT)
> + {
> EvdevProcessTouchEvent(pInfo, ev);
> pEvdev->abs_queued = 1;
> - } else if (!pEvdev->mt_mask) {
> + } else if (!pEvdev->mt_mask)
> + {
> map = pEvdev->axis_map[ev->code];
> valuator_mask_set(pEvdev->vals, map, value);
> pEvdev->abs_queued = 1;
> @@ -834,7 +859,8 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
> }
> }
>
> - switch (ev->code) {
> + switch (ev->code)
> + {
> case BTN_TOUCH:
> /* For devices that have but don't use proximity, use
> * BTN_TOUCH as the proximity notifier */
> @@ -863,7 +889,8 @@ EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
> {
> EvdevPtr pEvdev = pInfo->private;
>
> - if (pEvdev->rel_queued) {
> + if (pEvdev->rel_queued)
> + {
> xf86PostMotionEventM(pInfo->dev, Relative, pEvdev->vals);
> }
> }
> @@ -886,7 +913,8 @@ EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
> * pEvdev->in_proximity is initialized to 1 so devices that don't use
> * this scheme still just work.
> */
> - if (pEvdev->abs_queued && pEvdev->in_proximity) {
> + if (pEvdev->abs_queued && pEvdev->in_proximity)
> + {
> xf86PostMotionEventM(pInfo->dev, Absolute, pEvdev->vals);
> }
> }
> @@ -898,8 +926,10 @@ EvdevPostProximityEvents(InputInfoPtr pInfo, int which, int num_v, int first_v,
> int i;
> EvdevPtr pEvdev = pInfo->private;
>
> - for (i = 0; pEvdev->prox_queued && i < pEvdev->num_queue; i++) {
> - switch (pEvdev->queue[i].type) {
> + for (i = 0; pEvdev->prox_queued && i < pEvdev->num_queue; i++)
> + {
> + switch (pEvdev->queue[i].type)
> + {
> case EV_QUEUE_KEY:
> case EV_QUEUE_BTN:
> #ifdef MULTITOUCH
> @@ -924,8 +954,10 @@ static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int num_v, int first_v,
> int i;
> EvdevPtr pEvdev = pInfo->private;
>
> - for (i = 0; i < pEvdev->num_queue; i++) {
> - switch (pEvdev->queue[i].type) {
> + for (i = 0; i < pEvdev->num_queue; i++)
> + {
> + switch (pEvdev->queue[i].type)
> + {
> case EV_QUEUE_KEY:
> xf86PostKeyboardEvent(pInfo->dev, pEvdev->queue[i].detail.key,
> pEvdev->queue[i].val);
> @@ -936,7 +968,8 @@ static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int num_v, int first_v,
> pEvdev->queue[i].val))
> break;
>
> - if (pEvdev->abs_queued && pEvdev->in_proximity) {
> + if (pEvdev->abs_queued && pEvdev->in_proximity)
> + {
> xf86PostButtonEventP(pInfo->dev, Absolute, pEvdev->queue[i].detail.key,
> pEvdev->queue[i].val, first_v, num_v,
> v + first_v);
> @@ -1007,7 +1040,8 @@ EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev)
> static void
> EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
> {
> - switch (ev->type) {
> + switch (ev->type)
> + {
> case EV_REL:
> EvdevProcessRelativeMotionEvent(pInfo, ev);
> break;
> @@ -1068,7 +1102,8 @@ EvdevReadInput(InputInfoPtr pInfo)
>
> /* The kernel promises that we always only read a complete
> * event, so len != sizeof ev is an error. */
> - if (len % sizeof(ev[0])) {
> + if (len % sizeof(ev[0]))
> + {
> /* We use X_NONE here because it doesn't alloc */
> xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name, strerror(errno));
> break;
> @@ -1088,7 +1123,8 @@ EvdevPtrCtrlProc(DeviceIntPtr device, PtrCtrl *ctrl)
> static void
> EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl)
> {
> - static struct { int xbit, code; } bits[] = {
> + static struct { int xbit, code; } bits[] =
> + {
> { CAPSFLAG, LED_CAPSL },
> { NUMFLAG, LED_NUML },
> { SCROLLFLAG, LED_SCROLLL },
> @@ -1103,7 +1139,8 @@ EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl)
> memset(ev, 0, sizeof(ev));
>
> pInfo = device->public.devicePrivate;
> - for (i = 0; i < ArrayLength(bits); i++) {
> + for (i = 0; i < ArrayLength(bits); i++)
> + {
> ev[i].type = EV_LED;
> ev[i].code = bits[i].code;
> ev[i].value = (ctrl->leds & bits[i].xbit) > 0;
> @@ -1148,14 +1185,16 @@ EvdevAddKeyClass(DeviceIntPtr device)
> * backwards compatibility), once as ABS_MT_POSITION_X. So we need to keep a
> * mapping of those axes to make sure we only count them once
> */
> -struct mt_axis_mappings {
> +struct mt_axis_mappings
> +{
> int mt_code;
> int code;
> Bool needs_mapping; /* TRUE if both code and mt_code are present */
> int mapping; /* Logical mapping of 'code' axis */
> };
>
> -static struct mt_axis_mappings mt_axis_mappings[] = {
> +static struct mt_axis_mappings mt_axis_mappings[] =
> +{
> {ABS_MT_POSITION_X, ABS_X},
> {ABS_MT_POSITION_Y, ABS_Y},
> {ABS_MT_PRESSURE, ABS_PRESSURE},
> @@ -1229,39 +1268,47 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
> }
> }
> #endif
> - if (num_axes + num_mt_axes > MAX_VALUATORS) {
> + if (num_axes + num_mt_axes > MAX_VALUATORS)
> + {
> xf86IDrvMsg(pInfo, X_WARNING, "found %d axes, limiting to %d.\n", num_axes, MAX_VALUATORS);
> num_axes = MAX_VALUATORS;
> }
>
> - if (num_axes < 1 && num_mt_axes_total < 1) {
> + if (num_axes < 1 && num_mt_axes_total < 1)
> + {
> xf86Msg(X_WARNING, "%s: no absolute or touch axes found.\n",
> device->name);
> return !Success;
> }
>
> pEvdev->num_vals = num_axes;
> - if (num_axes > 0) {
> + if (num_axes > 0)
> + {
> pEvdev->vals = valuator_mask_new(num_axes);
> pEvdev->old_vals = valuator_mask_new(num_axes);
> - if (!pEvdev->vals || !pEvdev->old_vals) {
> + if (!pEvdev->vals || !pEvdev->old_vals)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "failed to allocate valuator masks.\n");
> goto out;
> }
> }
> #ifdef MULTITOUCH
> - if (num_mt_axes_total > 0) {
> + if (num_mt_axes_total > 0)
> + {
> pEvdev->mt_mask = valuator_mask_new(num_mt_axes_total);
> - if (!pEvdev->mt_mask) {
> + if (!pEvdev->mt_mask)
> + {
> xf86Msg(X_ERROR, "%s: failed to allocate MT valuator mask.\n",
> device->name);
> goto out;
> }
>
> - for (i = 0; i < EVDEV_MAXQUEUE; i++) {
> + for (i = 0; i < EVDEV_MAXQUEUE; i++)
> + {
> pEvdev->queue[i].touchMask =
> valuator_mask_new(num_mt_axes_total);
> - if (!pEvdev->queue[i].touchMask) {
> + if (!pEvdev->queue[i].touchMask)
> + {
> xf86Msg(X_ERROR, "%s: failed to allocate MT valuator masks for "
> "evdev event queue.\n", device->name);
> goto out;
> @@ -1272,7 +1319,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
> atoms = malloc((pEvdev->num_vals + num_mt_axes) * sizeof(Atom));
>
> i = 0;
> - for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) {
> + for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++)
> + {
> int j;
> int mapping;
> pEvdev->axis_map[axis] = -1;
> @@ -1300,7 +1348,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
> EvdevInitAxesLabels(pEvdev, pEvdev->num_vals + num_mt_axes, atoms);
>
> if (!InitValuatorClassDeviceStruct(device, num_axes + num_mt_axes, atoms,
> - GetMotionHistorySize(), Absolute)) {
> + GetMotionHistorySize(), Absolute))
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "failed to initialize valuator class device.\n");
> goto out;
> }
> @@ -1316,7 +1365,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
> num_touches = pEvdev->mtdev->caps.slot.maximum;
>
> if (!InitTouchClassDeviceStruct(device, num_touches, mode,
> - num_mt_axes_total)) {
> + num_mt_axes_total))
> + {
> xf86Msg(X_ERROR, "%s: failed to initialize touch class device.\n",
> device->name);
> goto out;
> @@ -1324,7 +1374,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
> }
> #endif
>
> - for (axis = ABS_X; axis < ABS_MT_SLOT; axis++) {
> + for (axis = ABS_X; axis < ABS_MT_SLOT; axis++)
> + {
> int axnum = pEvdev->axis_map[axis];
> int resolution = 0;
>
> @@ -1346,7 +1397,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
> }
>
> #ifdef MULTITOUCH
> - for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++) {
> + for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++)
> + {
> int axnum = pEvdev->axis_map[axis];
> int resolution = 0;
> int j;
> @@ -1390,7 +1442,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
> {
> InitProximityClassDeviceStruct(device);
> pEvdev->prox = valuator_mask_new(num_axes);
> - if (!pEvdev->prox) {
> + if (!pEvdev->prox)
> + {
> xf86IDrvMsg(pInfo, X_ERROR,
> "failed to allocate proximity valuator " "mask.\n");
> goto out;
> @@ -1399,7 +1452,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
> }
> }
>
> - if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc)) {
> + if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
> + {
> xf86IDrvMsg(pInfo, X_ERROR,
> "failed to initialize pointer feedback class device.\n");
> goto out;
> @@ -1469,13 +1523,15 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
> goto out;
> #endif
>
> - if (num_axes > MAX_VALUATORS) {
> + if (num_axes > MAX_VALUATORS)
> + {
> xf86IDrvMsg(pInfo, X_WARNING, "found %d axes, limiting to %d.\n", num_axes, MAX_VALUATORS);
> num_axes = MAX_VALUATORS;
> }
>
> pEvdev->num_vals = num_axes;
> - if (num_axes > 0) {
> + if (num_axes > 0)
> + {
> pEvdev->vals = valuator_mask_new(num_axes);
> if (!pEvdev->vals)
> goto out;
> @@ -1499,12 +1555,14 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
> EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
>
> if (!InitValuatorClassDeviceStruct(device, num_axes, atoms,
> - GetMotionHistorySize(), Relative)) {
> + GetMotionHistorySize(), Relative))
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "failed to initialize valuator class device.\n");
> goto out;
> }
>
> - if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc)) {
> + if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "failed to initialize pointer feedback class "
> "device.\n");
> goto out;
> @@ -1629,9 +1687,11 @@ EvdevInitAbsValuators(DeviceIntPtr device, EvdevPtr pEvdev)
> {
> InputInfoPtr pInfo = device->public.devicePrivate;
>
> - if (EvdevAddAbsValuatorClass(device) == Success) {
> + if (EvdevAddAbsValuatorClass(device) == Success)
> + {
> xf86IDrvMsg(pInfo, X_INFO,"initialized for absolute axes.\n");
> - } else {
> + } else
> + {
> xf86IDrvMsg(pInfo, X_ERROR,"failed to initialize for absolute axes.\n");
> pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
> }
> @@ -1643,16 +1703,19 @@ EvdevInitRelValuators(DeviceIntPtr device, EvdevPtr pEvdev)
> InputInfoPtr pInfo = device->public.devicePrivate;
> int has_abs_axes = pEvdev->flags & EVDEV_ABSOLUTE_EVENTS;
>
> - if (EvdevAddRelValuatorClass(device) == Success) {
> + if (EvdevAddRelValuatorClass(device) == Success)
> + {
>
> xf86IDrvMsg(pInfo, X_INFO,"initialized for relative axes.\n");
>
> - if (has_abs_axes) {
> + if (has_abs_axes)
> + {
> xf86IDrvMsg(pInfo, X_WARNING,"ignoring absolute axes.\n");
> pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
> }
>
> - } else {
> + } else
> + {
> xf86IDrvMsg(pInfo, X_ERROR,"failed to initialize for relative axes.\n");
>
> pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
> @@ -1667,7 +1730,8 @@ EvdevInitTouchDevice(DeviceIntPtr device, EvdevPtr pEvdev)
> {
> InputInfoPtr pInfo = device->public.devicePrivate;
>
> - if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) {
> + if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
> + {
> xf86IDrvMsg(pInfo, X_WARNING, "touchpads, tablets and touchscreens "
> "ignore relative axes.\n");
> pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
> @@ -1802,7 +1866,8 @@ EvdevProc(DeviceIntPtr device, int what)
>
> case DEVICE_CLOSE:
> xf86IDrvMsg(pInfo, X_INFO, "Close\n");
> - if (pInfo->fd != -1) {
> + if (pInfo->fd != -1)
> + {
> close(pInfo->fd);
> pInfo->fd = -1;
> }
> @@ -1856,7 +1921,8 @@ EvdevCache(InputInfoPtr pInfo)
> pEvdev->id_vendor = id.vendor;
> pEvdev->id_product = id.product;
>
> - if (ioctl(pInfo->fd, EVIOCGNAME(sizeof(name) - 1), name) < 0) {
> + if (ioctl(pInfo->fd, EVIOCGNAME(sizeof(name) - 1), name) < 0)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGNAME failed: %s\n", strerror(errno));
> goto error;
> }
> @@ -1864,7 +1930,8 @@ EvdevCache(InputInfoPtr pInfo)
> strcpy(pEvdev->name, name);
>
> len = ioctl(pInfo->fd, EVIOCGBIT(0, sizeof(bitmask)), bitmask);
> - if (len < 0) {
> + if (len < 0)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n",
> strerror(errno));
> goto error;
> @@ -1873,7 +1940,8 @@ EvdevCache(InputInfoPtr pInfo)
> memcpy(pEvdev->bitmask, bitmask, len);
>
> len = ioctl(pInfo->fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask);
> - if (len < 0) {
> + if (len < 0)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n",
> strerror(errno));
> goto error;
> @@ -1882,7 +1950,8 @@ EvdevCache(InputInfoPtr pInfo)
> memcpy(pEvdev->rel_bitmask, rel_bitmask, len);
>
> len = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask);
> - if (len < 0) {
> + if (len < 0)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n",
> strerror(errno));
> goto error;
> @@ -1891,7 +1960,8 @@ EvdevCache(InputInfoPtr pInfo)
> memcpy(pEvdev->abs_bitmask, abs_bitmask, len);
>
> len = ioctl(pInfo->fd, EVIOCGBIT(EV_LED, sizeof(led_bitmask)), led_bitmask);
> - if (len < 0) {
> + if (len < 0)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n",
> strerror(errno));
> goto error;
> @@ -1903,10 +1973,13 @@ EvdevCache(InputInfoPtr pInfo)
> * Do not try to validate absinfo data since it is not expected
> * to be static, always refresh it in evdev structure.
> */
> - for (i = ABS_X; i <= ABS_MAX; i++) {
> - if (EvdevBitIsSet(abs_bitmask, i)) {
> + for (i = ABS_X; i <= ABS_MAX; i++)
> + {
> + if (EvdevBitIsSet(abs_bitmask, i))
> + {
> len = ioctl(pInfo->fd, EVIOCGABS(i), &pEvdev->absinfo[i]);
> - if (len < 0) {
> + if (len < 0)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGABSi(%d) failed: %s\n",
> i, strerror(errno));
> goto error;
> @@ -1917,7 +1990,8 @@ EvdevCache(InputInfoPtr pInfo)
> }
>
> len = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask);
> - if (len < 0) {
> + if (len < 0)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n",
> strerror(errno));
> goto error;
> @@ -1946,7 +2020,8 @@ EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab)
>
> if (pEvdev->grabDevice)
> {
> - if (grab && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
> + if (grab && ioctl(pInfo->fd, EVIOCGRAB, (void *)1))
> + {
> xf86IDrvMsg(pInfo, X_WARNING, "Grab failed (%s)\n",
> strerror(errno));
> return FALSE;
> @@ -2023,17 +2098,21 @@ EvdevProbe(InputInfoPtr pInfo)
> xf86IDrvMsg(pInfo, X_PROBED, "Found %d mouse buttons\n", num_buttons);
> }
>
> - for (i = 0; i < REL_MAX; i++) {
> - if (EvdevBitIsSet(pEvdev->rel_bitmask, i)) {
> + for (i = 0; i < REL_MAX; i++)
> + {
> + if (EvdevBitIsSet(pEvdev->rel_bitmask, i))
> + {
> has_rel_axes = TRUE;
> break;
> }
> }
>
> - if (has_rel_axes) {
> + if (has_rel_axes)
> + {
> if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_WHEEL) ||
> EvdevBitIsSet(pEvdev->rel_bitmask, REL_HWHEEL) ||
> - EvdevBitIsSet(pEvdev->rel_bitmask, REL_DIAL)) {
> + EvdevBitIsSet(pEvdev->rel_bitmask, REL_DIAL))
> + {
> xf86IDrvMsg(pInfo, X_PROBED, "Found scroll wheel(s)\n");
> has_scroll = TRUE;
> if (!num_buttons)
> @@ -2049,25 +2128,31 @@ EvdevProbe(InputInfoPtr pInfo)
> pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
>
> if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_X) &&
> - EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y)) {
> + EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y))
> + {
> xf86IDrvMsg(pInfo, X_PROBED, "Found x and y relative axes\n");
> }
> - } else {
> + } else
> + {
> xf86IDrvMsg(pInfo, X_INFO, "Relative axes present but ignored.\n");
> has_rel_axes = FALSE;
> }
> }
>
> - for (i = 0; i < ABS_MAX; i++) {
> - if (EvdevBitIsSet(pEvdev->abs_bitmask, i)) {
> + for (i = 0; i < ABS_MAX; i++)
> + {
> + if (EvdevBitIsSet(pEvdev->abs_bitmask, i))
> + {
> has_abs_axes = TRUE;
> break;
> }
> }
>
> #ifdef MULTITOUCH
> - for (i = ABS_MT_SLOT; i < ABS_MAX; i++) {
> - if (EvdevBitIsSet(pEvdev->abs_bitmask, i)) {
> + for (i = ABS_MT_SLOT; i < ABS_MAX; i++)
> + {
> + if (EvdevBitIsSet(pEvdev->abs_bitmask, i))
> + {
> has_mt = TRUE;
> break;
> }
> @@ -2078,7 +2163,8 @@ EvdevProbe(InputInfoPtr pInfo)
> {
> xf86IDrvMsg(pInfo, X_INFO, "Absolute axes present but ignored.\n");
> has_abs_axes = FALSE;
> - } else if (has_abs_axes) {
> + } else if (has_abs_axes)
> + {
> xf86IDrvMsg(pInfo, X_PROBED, "Found absolute axes\n");
> pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
>
> @@ -2086,7 +2172,8 @@ EvdevProbe(InputInfoPtr pInfo)
> xf86IDrvMsg(pInfo, X_PROBED, "Found absolute multitouch axes\n");
>
> if ((EvdevBitIsSet(pEvdev->abs_bitmask, ABS_X) &&
> - EvdevBitIsSet(pEvdev->abs_bitmask, ABS_Y))) {
> + EvdevBitIsSet(pEvdev->abs_bitmask, ABS_Y)))
> + {
> xf86IDrvMsg(pInfo, X_PROBED, "Found x and y absolute axes\n");
> if (EvdevBitIsSet(pEvdev->key_bitmask, BTN_TOOL_PEN) ||
> EvdevBitIsSet(pEvdev->key_bitmask, BTN_STYLUS) ||
> @@ -2100,17 +2187,21 @@ EvdevProbe(InputInfoPtr pInfo)
> pEvdev->flags |= EVDEV_BUTTON_EVENTS;
> }
> } else if (EvdevBitIsSet(pEvdev->abs_bitmask, ABS_PRESSURE) ||
> - EvdevBitIsSet(pEvdev->key_bitmask, BTN_TOUCH)) {
> - if (has_lmr || EvdevBitIsSet(pEvdev->key_bitmask, BTN_TOOL_FINGER)) {
> + EvdevBitIsSet(pEvdev->key_bitmask, BTN_TOUCH))
> + {
> + if (has_lmr || EvdevBitIsSet(pEvdev->key_bitmask, BTN_TOOL_FINGER))
> + {
> xf86IDrvMsg(pInfo, X_PROBED, "Found absolute touchpad.\n");
> pEvdev->flags |= EVDEV_TOUCHPAD;
> - } else {
> + } else
> + {
> xf86IDrvMsg(pInfo, X_PROBED, "Found absolute touchscreen\n");
> pEvdev->flags |= EVDEV_TOUCHSCREEN;
> pEvdev->flags |= EVDEV_BUTTON_EVENTS;
> }
> } else if (!(EvdevBitIsSet(pEvdev->rel_bitmask, REL_X) &&
> - EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y)) && has_lmr) {
> + EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y)) && has_lmr)
> + {
> /* some touchscreens use BTN_LEFT rather than BTN_TOUCH */
> xf86IDrvMsg(pInfo, X_PROBED, "Found absolute touchscreen\n");
> pEvdev->flags |= EVDEV_TOUCHSCREEN;
> @@ -2119,8 +2210,10 @@ EvdevProbe(InputInfoPtr pInfo)
> }
> }
>
> - for (i = 0; i < BTN_MISC; i++) {
> - if (EvdevBitIsSet(pEvdev->key_bitmask, i)) {
> + for (i = 0; i < BTN_MISC; i++)
> + {
> + if (EvdevBitIsSet(pEvdev->key_bitmask, i))
> + {
> xf86IDrvMsg(pInfo, X_PROBED, "Found keys\n");
> pEvdev->flags |= EVDEV_KEYBOARD_EVENTS;
> has_keys = TRUE;
> @@ -2138,7 +2231,8 @@ EvdevProbe(InputInfoPtr pInfo)
> pEvdev->swap_axes = xf86SetBoolOption(pInfo->options, "SwapAxes", FALSE);
>
> str = xf86CheckStrOption(pInfo->options, "Calibration", NULL);
> - if (str) {
> + if (str)
> + {
> num_calibration = sscanf(str, "%d %d %d %d",
> &calibration[0], &calibration[1],
> &calibration[2], &calibration[3]);
> @@ -2152,19 +2246,24 @@ EvdevProbe(InputInfoPtr pInfo)
> }
> }
>
> - if (has_rel_axes || has_abs_axes || num_buttons) {
> + if (has_rel_axes || has_abs_axes || num_buttons)
> + {
> pInfo->flags |= XI86_SEND_DRAG_EVENTS;
> - if (pEvdev->flags & EVDEV_TOUCHPAD) {
> + if (pEvdev->flags & EVDEV_TOUCHPAD)
> + {
> xf86IDrvMsg(pInfo, X_INFO, "Configuring as touchpad\n");
> pInfo->type_name = XI_TOUCHPAD;
> pEvdev->use_proximity = 0;
> - } else if (pEvdev->flags & EVDEV_TABLET) {
> + } else if (pEvdev->flags & EVDEV_TABLET)
> + {
> xf86IDrvMsg(pInfo, X_INFO, "Configuring as tablet\n");
> pInfo->type_name = XI_TABLET;
> - } else if (pEvdev->flags & EVDEV_TOUCHSCREEN) {
> + } else if (pEvdev->flags & EVDEV_TOUCHSCREEN)
> + {
> xf86IDrvMsg(pInfo, X_INFO, "Configuring as touchscreen\n");
> pInfo->type_name = XI_TOUCHSCREEN;
> - } else {
> + } else
> + {
> xf86IDrvMsg(pInfo, X_INFO, "Configuring as mouse\n");
> pInfo->type_name = XI_MOUSE;
> }
> @@ -2172,7 +2271,8 @@ EvdevProbe(InputInfoPtr pInfo)
> rc = 0;
> }
>
> - if (has_keys) {
> + if (has_keys)
> + {
> xf86IDrvMsg(pInfo, X_INFO, "Configuring as keyboard\n");
> pInfo->type_name = XI_KEYBOARD;
> rc = 0;
> @@ -2197,13 +2297,15 @@ EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4])
> {
> EvdevPtr pEvdev = pInfo->private;
>
> - if (num_calibration == 0) {
> + if (num_calibration == 0)
> + {
> pEvdev->flags &= ~EVDEV_CALIBRATED;
> pEvdev->calibration.min_x = 0;
> pEvdev->calibration.max_x = 0;
> pEvdev->calibration.min_y = 0;
> pEvdev->calibration.max_y = 0;
> - } else if (num_calibration == 4) {
> + } else if (num_calibration == 4)
> + {
> pEvdev->flags |= EVDEV_CALIBRATED;
> pEvdev->calibration.min_x = calibration[0];
> pEvdev->calibration.max_x = calibration[1];
> @@ -2221,7 +2323,8 @@ EvdevOpenDevice(InputInfoPtr pInfo)
> if (!device)
> {
> device = xf86CheckStrOption(pInfo->options, "Device", NULL);
> - if (!device) {
> + if (!device)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "No device specified.\n");
> return BadValue;
> }
> @@ -2232,11 +2335,13 @@ EvdevOpenDevice(InputInfoPtr pInfo)
>
> if (pInfo->fd < 0)
> {
> - do {
> + do
> + {
> pInfo->fd = open(device, O_RDWR | O_NONBLOCK, 0);
> } while (pInfo->fd < 0 && errno == EINTR);
>
> - if (pInfo->fd < 0) {
> + if (pInfo->fd < 0)
> + {
> xf86IDrvMsg(pInfo, X_ERROR, "Unable to open evdev device \"%s\".\n", device);
> return BadValue;
> }
> @@ -2246,7 +2351,8 @@ EvdevOpenDevice(InputInfoPtr pInfo)
> pEvdev->mtdev = mtdev_new_open(pInfo->fd);
> if (pEvdev->mtdev)
> pEvdev->cur_slot = pEvdev->mtdev->caps.slot.value;
> - else {
> + else
> + {
> xf86Msg(X_ERROR, "%s: Couldn't open mtdev device\n", pInfo->name);
> return FALSE;
> }
> @@ -2330,7 +2436,8 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
>
> EvdevInitButtonMapping(pInfo);
>
> - if (EvdevCache(pInfo) || EvdevProbe(pInfo)) {
> + if (EvdevCache(pInfo) || EvdevProbe(pInfo))
> + {
> rc = BadMatch;
> goto error;
> }
> @@ -2353,7 +2460,8 @@ error:
> return rc;
> }
>
> -_X_EXPORT InputDriverRec EVDEV = {
> +_X_EXPORT InputDriverRec EVDEV =
> +{
> 1,
> "evdev",
> NULL,
> @@ -2438,7 +2546,8 @@ EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code)
> /* Aligned with linux/input.h.
> Note that there are holes in the ABS_ range, these are simply replaced with
> MISC here */
> -static char* abs_labels[] = {
> +static char* abs_labels[] =
> +{
> AXIS_LABEL_PROP_ABS_X, /* 0x00 */
> AXIS_LABEL_PROP_ABS_Y, /* 0x01 */
> AXIS_LABEL_PROP_ABS_Z, /* 0x02 */
> @@ -2501,7 +2610,8 @@ static char* abs_labels[] = {
> AXIS_LABEL_PROP_ABS_MT_PRESSURE, /* 0x3a */
> };
>
> -static char* rel_labels[] = {
> +static char* rel_labels[] =
> +{
> AXIS_LABEL_PROP_REL_X,
> AXIS_LABEL_PROP_REL_Y,
> AXIS_LABEL_PROP_REL_Z,
> @@ -2514,7 +2624,8 @@ static char* rel_labels[] = {
> AXIS_LABEL_PROP_REL_MISC
> };
>
> -static char* btn_labels[][16] = {
> +static char* btn_labels[][16] =
> +{
> { /* BTN_MISC group offset 0x100*/
> BTN_LABEL_PROP_BTN_0, /* 0x00 */
> BTN_LABEL_PROP_BTN_1, /* 0x01 */
> @@ -2734,7 +2845,8 @@ EvdevInitProperty(DeviceIntPtr dev)
>
> prop_calibration = MakeAtom(EVDEV_PROP_CALIBRATION,
> strlen(EVDEV_PROP_CALIBRATION), TRUE);
> - if (pEvdev->flags & EVDEV_CALIBRATED) {
> + if (pEvdev->flags & EVDEV_CALIBRATED)
> + {
> int calibration[4];
>
> calibration[0] = pEvdev->calibration.min_x;
> @@ -2745,7 +2857,8 @@ EvdevInitProperty(DeviceIntPtr dev)
> rc = XIChangeDeviceProperty(dev, prop_calibration, XA_INTEGER,
> 32, PropModeReplace, 4, calibration,
> FALSE);
> - } else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS) {
> + } else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
> + {
> rc = XIChangeDeviceProperty(dev, prop_calibration, XA_INTEGER,
> 32, PropModeReplace, 0, NULL,
> FALSE);
> --
> 1.7.5.4
>
More information about the xorg-devel
mailing list