diff options
author | Matthieu Herrb <matthieu@openbsd.org> | 2009-11-26 18:18:34 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@openbsd.org> | 2009-11-26 18:18:34 +0000 |
commit | c61294269e5b293f8d56b1842a0530f08da46f8c (patch) | |
tree | 72241f3be646e24d28f771725f29f017da5789dd | |
parent | 3c2117d210eb80c8b9ff509579dc6a94ce2e4c9f (diff) |
white space
-rw-r--r-- | src/emumb.c | 82 | ||||
-rw-r--r-- | src/ws.c | 28 | ||||
-rw-r--r-- | src/ws.h | 2 |
3 files changed, 56 insertions, 56 deletions
diff --git a/src/emumb.c b/src/emumb.c index c370e2f..7cd9ec8 100644 --- a/src/emumb.c +++ b/src/emumb.c @@ -196,11 +196,11 @@ int wsmbEmuTimer(InputInfoPtr pInfo) { WSDevicePtr priv = pInfo->private; - int sigstate; + int sigstate; int id; - - sigstate = xf86BlockSIGIO (); - + + sigstate = xf86BlockSIGIO(); + priv->emulateMB.pending = FALSE; if ((id = stateTab[priv->emulateMB.state][4][0]) != 0) { xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); @@ -210,8 +210,8 @@ wsmbEmuTimer(InputInfoPtr pInfo) ErrorF("Got unexpected buttonTimer in state %d\n", priv->emulateMB.state); } - - xf86UnblockSIGIO (sigstate); + + xf86UnblockSIGIO(sigstate); return 0; } @@ -232,25 +232,25 @@ wsmbEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press) int id; int *btstate; int ret = FALSE; - + if (!priv->emulateMB.enabled) return ret; - + if (button == 2) { wsmbEmuEnable(pInfo, FALSE); return ret; } - + /* don't care about other buttons */ if (button != 1 && button != 3) return ret; - + btstate = &priv->emulateMB.buttonstate; if (press) *btstate |= (button == 1) ? 0x1 : 0x2; else *btstate &= (button == 1) ? ~0x1 : ~0x2; - + if ((id = stateTab[priv->emulateMB.state][*btstate][0]) != 0) { xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); ret = TRUE; @@ -259,11 +259,11 @@ wsmbEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press) xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); ret = TRUE; } - + priv->emulateMB.state = stateTab[priv->emulateMB.state][*btstate][2]; - + if (stateTab[priv->emulateMB.state][4][0] != 0) { - priv->emulateMB.expires = GetTimeInMillis() + priv->emulateMB.expires = GetTimeInMillis() + priv->emulateMB.timeout; priv->emulateMB.pending = TRUE; ret = TRUE; @@ -274,15 +274,15 @@ wsmbEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press) } -void +void wsmbEmuWakeupHandler(pointer data, int i, pointer LastSelectMask) { InputInfoPtr pInfo = (InputInfoPtr)data; - WSDevicePtr priv = (WSDevicePtr)pInfo->private; + WSDevicePtr priv = (WSDevicePtr)pInfo->private; int ms; - + if (priv->emulateMB.pending) { ms = priv->emulateMB.expires - GetTimeInMillis(); if (ms <= 0) @@ -290,20 +290,20 @@ wsmbEmuWakeupHandler(pointer data, } } -void +void wsmbEmuBlockHandler(pointer data, struct timeval **waitTime, pointer LastSelectMask) { - InputInfoPtr pInfo = (InputInfoPtr) data; - WSDevicePtr priv= (WSDevicePtr) pInfo->private; - int ms; - + InputInfoPtr pInfo = (InputInfoPtr) data; + WSDevicePtr priv= (WSDevicePtr) pInfo->private; + int ms; + if (priv->emulateMB.pending) { ms = priv->emulateMB.expires - GetTimeInMillis(); if (ms <= 0) ms = 0; - AdjustWaitForDelay (waitTime, ms); + AdjustWaitForDelay(waitTime, ms); } } @@ -312,7 +312,7 @@ wsmbEmuPreInit(InputInfoPtr pInfo) { WSDevicePtr priv = (WSDevicePtr)pInfo->private; priv->emulateMB.enabled = MBEMU_AUTO; - + DBG(1, ErrorF("wsmbEmuPreInit\n")); if (xf86FindOption(pInfo->options, "Emulate3Buttons")) { priv->emulateMB.enabled = xf86SetBoolOption(pInfo->options, @@ -322,7 +322,7 @@ wsmbEmuPreInit(InputInfoPtr pInfo) "emulation %s.\n", pInfo->name, (priv->emulateMB.enabled) ? "on" : "off"); } - + priv->emulateMB.timeout = xf86SetIntOption(pInfo->options, "Emulate3Timeout", 50); } @@ -339,7 +339,7 @@ wsmbEmuFinalize(InputInfoPtr pInfo) { RemoveBlockAndWakeupHandlers(wsmbEmuBlockHandler, wsmbEmuWakeupHandler, (pointer)pInfo); - + } /* Enable/disable middle mouse button emulation. */ @@ -359,26 +359,26 @@ wsmbEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, BOOL checkonly) { InputInfoPtr pInfo = dev->public.devicePrivate; - WSDevicePtr priv = pInfo->private; - + WSDevicePtr priv = pInfo->private; + DBG(1, ErrorF("wsmbEmuSetProperty %s\n", NameForAtom(atom))); if (atom == prop_mbemu) { - if (val->format != 8 || val->size != 1 || + if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER) return BadMatch; - + if (!checkonly) priv->emulateMB.enabled = *((BOOL*)val->data); } else if (atom == prop_mbtimeout) { - if (val->format != 32 || val->size != 1 || + if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER) return BadMatch; - + if (!checkonly) priv->emulateMB.timeout = *((CARD32*)val->data); } - + return Success; } @@ -389,15 +389,15 @@ void wsmbEmuInitProperty(DeviceIntPtr dev) { InputInfoPtr pInfo = dev->public.devicePrivate; - WSDevicePtr priv = pInfo->private; - int rc; + WSDevicePtr priv = pInfo->private; + int rc; DBG(1, ErrorF("wsmbEmuInitProperty\n")); if (!dev->button) /* don't init prop for keyboards */ return; - - prop_mbemu = MakeAtom(WS_PROP_MIDBUTTON, + + prop_mbemu = MakeAtom(WS_PROP_MIDBUTTON, strlen(WS_PROP_MIDBUTTON), TRUE); rc = XIChangeDeviceProperty(dev, prop_mbemu, XA_INTEGER, 8, PropModeReplace, 1, &priv->emulateMB.enabled, FALSE); @@ -407,21 +407,21 @@ wsmbEmuInitProperty(DeviceIntPtr dev) return; } XISetDevicePropertyDeletable(dev, prop_mbemu, FALSE); - + prop_mbtimeout = MakeAtom(WS_PROP_MIDBUTTON_TIMEOUT, strlen(WS_PROP_MIDBUTTON_TIMEOUT), TRUE); - rc = XIChangeDeviceProperty(dev, prop_mbtimeout, + rc = XIChangeDeviceProperty(dev, prop_mbtimeout, XA_INTEGER, 32, PropModeReplace, 1, &priv->emulateMB.timeout, FALSE); - + if (rc != Success) { xf86Msg(X_ERROR, "cannot create device property %s\n", WS_PROP_MIDBUTTON_TIMEOUT); return; } XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE); - + XIRegisterPropertyHandler(dev, wsmbEmuSetProperty, NULL, NULL); } #endif @@ -85,7 +85,7 @@ static XF86ModuleVersionInfo VersionRec = { MODINFOSTRING2, XORG_VERSION_CURRENT, PACKAGE_VERSION_MAJOR, - PACKAGE_VERSION_MINOR, + PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL, ABI_CLASS_XINPUT, ABI_XINPUT_VERSION, @@ -152,7 +152,7 @@ wsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) #ifdef DEBUG ws_debug_level = xf86SetIntOption(pInfo->options, "DebugLevel", ws_debug_level); - xf86Msg(X_INFO, "%s: debuglevel %d\n", dev->identifier, + xf86Msg(X_INFO, "%s: debuglevel %d\n", dev->identifier, ws_debug_level); #endif priv->devName = xf86FindOptionValue(pInfo->options, "Device"); @@ -282,7 +282,7 @@ wsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) } if (priv->type == WSMOUSE_TYPE_TPANEL && priv->raw) { - if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, + if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &priv->coords) != 0) { xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n", strerror(errno)); @@ -392,7 +392,7 @@ wsDeviceInit(DeviceIntPtr pWS) #endif priv->screen_width = screenInfo.screens[priv->screen_no]->width; priv->screen_height = screenInfo.screens[priv->screen_no]->height; - + for (i = 0; i < NBUTTONS; i++) map[i + 1] = i + 1; if (!InitButtonClassDeviceStruct(pWS, @@ -402,7 +402,7 @@ wsDeviceInit(DeviceIntPtr pWS) #endif map)) return !Success; - + if (priv->type == WSMOUSE_TYPE_TPANEL) { xmin = priv->min_x; xmax = priv->max_x; @@ -438,14 +438,14 @@ wsDeviceInit(DeviceIntPtr pWS) return !Success; if (!InitPtrFeedbackClassDeviceStruct(pWS, wsControlProc)) return !Success; - + xf86InitValuatorAxisStruct(pWS, 0, #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 axes_labels[0], #endif xmin, xmax, 1, 0, 1); xf86InitValuatorDefaults(pWS, 0); - + xf86InitValuatorAxisStruct(pWS, 1, #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 axes_labels[1], @@ -491,7 +491,7 @@ wsDeviceOn(DeviceIntPtr pWS) /* set raw mode */ if (coords.samplelen != priv->raw) { coords.samplelen = priv->raw; - if (ioctl(pInfo->fd, WSMOUSEIO_SCALIBCOORDS, + if (ioctl(pInfo->fd, WSMOUSEIO_SCALIBCOORDS, &coords) != 0) { xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n", strerror(errno)); @@ -700,7 +700,7 @@ wsSendButtons(InputInfoPtr pInfo, int buttons) for (button = 1; button < NBUTTONS; button++) { mask = 1 << (button - 1); if ((mask & priv->lastButtons) != (mask & buttons)) { - if (!wsmbEmuFilterEvent(pInfo, button, + if (!wsmbEmuFilterEvent(pInfo, button, (buttons & mask) != 0)) { xf86PostButtonEvent(pInfo->dev, TRUE, button, (buttons & mask) != 0, @@ -770,7 +770,7 @@ wsControlProc(DeviceIntPtr device, PtrCtrl *ctrl) } #ifdef HAVE_PROPERTIES -static void +static void wsInitProperty(DeviceIntPtr device) { InputInfoPtr pInfo = device->public.devicePrivate; @@ -790,11 +790,11 @@ wsInitProperty(DeviceIntPtr device) XISetDevicePropertyDeletable(device, prop_calibration, FALSE); - prop_swap = MakeAtom(WS_PROP_SWAP_AXES, + prop_swap = MakeAtom(WS_PROP_SWAP_AXES, strlen(WS_PROP_SWAP_AXES), TRUE); rc = XIChangeDeviceProperty(device, prop_swap, XA_INTEGER, 8, PropModeReplace, 1, &priv->swap_axes, FALSE); - if (rc != Success) + if (rc != Success) return; return; } @@ -845,7 +845,7 @@ wsSetProperty(DeviceIntPtr device, Atom atom, XIPropertyValuePtr val, ay->max_value = priv->max_y; } } else if (atom == prop_swap) { - if (val->format != 8 || val->type != XA_INTEGER || + if (val->format != 8 || val->type != XA_INTEGER || val->size != 1) return BadMatch; if (!checkonly) { @@ -853,7 +853,7 @@ wsSetProperty(DeviceIntPtr device, Atom atom, XIPropertyValuePtr val, DBG(1, ErrorF("swap_axes %d\n", priv->swap_axes)); need_update++; } - } + } if (need_update) { /* Update the saved values to be restored on device off */ priv->coords.minx = priv->min_x; @@ -59,7 +59,7 @@ typedef struct WSDevice { int state; /* state machine (see emumb.c) */ Time expires; /* time of expiry */ Time timeout; - } emulateMB; + } emulateMB; } WSDeviceRec, *WSDevicePtr; extern int wsmbEmuTimer(InputInfoPtr); |