aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2009-05-16 20:06:45 +0200
committerHenrik Rydberg <rydberg@euromail.se>2009-05-16 20:06:45 +0200
commitecb6a617cc0af69fd4733d9095a5cff842b8e552 (patch)
treecb7f1a5fd88c7493bafe3fbd35c03dbbd29448e9
parent47ea8a0de5d2511ebc39151b1d428d5e4985b726 (diff)
downloadxorg-input-kobomultitouch-ecb6a617cc0af69fd4733d9095a5cff842b8e552.tar.gz
xorg-input-kobomultitouch-ecb6a617cc0af69fd4733d9095a5cff842b8e552.tar.bz2
xorg-input-kobomultitouch-ecb6a617cc0af69fd4733d9095a5cff842b8e552.zip
trailing whitespace
-rw-r--r--match/match.c66
-rw-r--r--match/test.c4
-rw-r--r--src/capabilities.c13
-rw-r--r--src/multitouch.c2
4 files changed, 43 insertions, 42 deletions
diff --git a/match/match.c b/match/match.c
index 3c5ea0c..0080ee6 100644
--- a/match/match.c
+++ b/match/match.c
@@ -59,25 +59,25 @@ static void ixoptimal(int *ix, float *mdist, int nrows, int ncols)
/* initialization */
for(row=0; row<nrows; row++)
ix[row] = -1;
-
+
mdistEnd = mdist + nrows * ncols;
/* preliminary steps */
if(nrows <= ncols) {
dmin = nrows;
-
+
for(row=0; row<nrows; row++) {
/* find the smallest element in the row */
mdistTemp = mdist + row;
minValue = *mdistTemp;
- mdistTemp += nrows;
+ mdistTemp += nrows;
while(mdistTemp < mdistEnd) {
value = *mdistTemp;
if(value < minValue)
minValue = value;
mdistTemp += nrows;
}
-
+
/* subtract the smallest element from each element of the row */
mdistTemp = mdist + row;
while(mdistTemp < mdistEnd) {
@@ -85,7 +85,7 @@ static void ixoptimal(int *ix, float *mdist, int nrows, int ncols)
mdistTemp += nrows;
}
}
-
+
/* Steps 1 and 2a */
for(row=0; row<nrows; row++)
for(col=0; col<ncols; col++)
@@ -97,25 +97,25 @@ static void ixoptimal(int *ix, float *mdist, int nrows, int ncols)
}
} else {
dmin = ncols;
-
+
for(col=0; col<ncols; col++) {
/* find the smallest element in the column */
mdistTemp = mdist + nrows*col;
columnEnd = mdistTemp + nrows;
-
- minValue = *mdistTemp++;
+
+ minValue = *mdistTemp++;
while(mdistTemp < columnEnd) {
value = *mdistTemp++;
if(value < minValue)
minValue = value;
}
-
+
/* subtract the smallest element from each element of the column */
mdistTemp = mdist + nrows*col;
while(mdistTemp < columnEnd)
*mdistTemp++ -= minValue;
}
-
+
/* Steps 1 and 2a */
for(col=0; col<ncols; col++)
for(row=0; row<nrows; row++)
@@ -127,8 +127,8 @@ static void ixoptimal(int *ix, float *mdist, int nrows, int ncols)
break;
}
memset(crow, 0, sizeof(col_t));
- }
-
+ }
+
/* move to step 2b */
step2b(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin);
}
@@ -145,9 +145,9 @@ static void step2a(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprim
SET1(ccol, col);
break;
}
- }
+ }
}
-
+
/* move to step 3 */
step2b(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin);
}
@@ -156,13 +156,13 @@ static void step2a(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprim
static void step2b(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, int dmin)
{
int col, ncc;
-
+
/* count covered columns */
ncc = 0;
for(col=0; col<ncols; col++)
if(GET1(ccol, col))
ncc++;
-
+
if(ncc == dmin) {
/* algorithm finished */
buildixvector(ix, mstar, nrows, ncols);
@@ -170,7 +170,7 @@ static void step2b(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprim
/* move to step 3 */
step3(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin);
}
-
+
}
/********************************************************/
@@ -181,19 +181,19 @@ static void step3(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprime
zerosFound = 1;
while(zerosFound) {
- zerosFound = 0;
+ zerosFound = 0;
for(col=0; col<ncols; col++)
if(!GET1(ccol,col))
for(row=0; row<nrows; row++)
if((!GET1(crow, row)) && (mdist[row + nrows*col] == 0)) {
/* prime zero */
SET2(mprime, row, col);
-
+
/* find starred zero in current row */
for(cstar=0; cstar<ncols; cstar++)
if(GET2(mstar, row, cstar))
break;
-
+
if(cstar == ncols) { /* no starred zero found */
/* move to step 4 */
step4(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin, row, col);
@@ -206,19 +206,19 @@ static void step3(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprime
}
}
}
-
+
/* move to step 5 */
step5(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin);
}
/********************************************************/
static void step4(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, int dmin, int row, int col)
-{
+{
int n, rstar, cstar, primeRow, primeCol;
/* generate temporary copy of mstar */
memcpy(nmstar, mstar, sizeof(mat_t));
-
+
/* star current zero */
SET2(nmstar, row, col);
@@ -231,29 +231,29 @@ static void step4(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprime
while(rstar<nrows) {
/* unstar the starred zero */
CLEAR2(nmstar, rstar, cstar);
-
+
/* find primed zero in current row */
primeRow = rstar;
for(primeCol=0; primeCol<ncols; primeCol++)
if(GET2(mprime, primeRow, primeCol))
break;
-
+
/* star the primed zero */
SET2(nmstar, primeRow, primeCol);
-
+
/* find starred zero in current column */
cstar = primeCol;
for(rstar=0; rstar<nrows; rstar++)
if(GET2(mstar, rstar, cstar))
break;
- }
-
+ }
+
/* use temporary copy as new mstar */
/* delete all primes, uncover all rows */
memcpy(mstar, nmstar, sizeof(mat_t));
memset(mprime, 0, sizeof(mat_t));
memset(crow, 0, sizeof(col_t));
-
+
/* move to step 2a */
step2a(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin);
}
@@ -275,23 +275,23 @@ static void step5(int *ix, float *mdist, mat_t mstar, mat_t nmstar, mat_t mprime
found = 1;
}
}
-
+
/* where to go if nothing uncovered? */
if (!found)
return;
-
+
/* add h to each covered row */
for(row=0; row<nrows; row++)
if(GET1(crow, row))
for(col=0; col<ncols; col++)
mdist[row + nrows*col] += h;
-
+
/* subtract h from each uncovered column */
for(col=0; col<ncols; col++)
if(!GET1(ccol,col))
for(row=0; row<nrows; row++)
mdist[row + nrows*col] -= h;
-
+
/* move to step 3 */
step3(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin);
}
diff --git a/match/test.c b/match/test.c
index 1f535d1..c65e581 100644
--- a/match/test.c
+++ b/match/test.c
@@ -78,7 +78,7 @@ static void speed1()
int n2 = 7;
int i, j;
-
+
for (i = 0; i < n1; i++) {
for (j = 0; j < n2; j++) {
A[i + n1 * j] =
@@ -97,7 +97,7 @@ static void speed1()
for (i = 0; i < n1; i++)
printf("match[%d] = %d\n", i, index[i]);
-
+
}
int main(int argc,char* argv[])
diff --git a/src/capabilities.c b/src/capabilities.c
index a0655c8..7f8a8f7 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -38,7 +38,7 @@ int read_capabilities(struct Capabilities *cap, int fd)
int rc;
memset(cap, 0, sizeof(struct Capabilities));
-
+
SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_SYN, sizeof(evbits)), evbits));
if (rc < 0)
return rc;
@@ -52,7 +52,6 @@ int read_capabilities(struct Capabilities *cap, int fd)
cap->has_left = getbit(keybits, BTN_LEFT);
cap->has_middle = getbit(keybits, BTN_MIDDLE);
cap->has_right = getbit(keybits, BTN_RIGHT);
- cap->has_mtdata = getbit(keybits, BTN_MT_REPORT_PACKET);
SETABS(cap, touch_major, absbits, ABS_MT_TOUCH_MAJOR, fd);
SETABS(cap, touch_minor, absbits, ABS_MT_TOUCH_MINOR, fd);
@@ -62,6 +61,8 @@ int read_capabilities(struct Capabilities *cap, int fd)
SETABS(cap, position_x, absbits, ABS_MT_POSITION_X, fd);
SETABS(cap, position_y, absbits, ABS_MT_POSITION_Y, fd);
+ cap->has_mtdata = cap->has_position_x && cap->has_position_y;
+
return 0;
}
@@ -90,19 +91,19 @@ void output_capabilities(const struct Capabilities *cap)
if (cap->has_width_major)
xf86Msg(X_INFO, "multitouch: width: %d %d\n",
cap->abs_width_major.minimum,
- cap->abs_width_major.maximum);
+ cap->abs_width_major.maximum);
if (cap->has_orientation)
xf86Msg(X_INFO, "multitouch: orientation: %d %d\n",
cap->abs_orientation.minimum,
- cap->abs_orientation.maximum);
+ cap->abs_orientation.maximum);
if (cap->has_position_x)
xf86Msg(X_INFO, "multitouch: position_x: %d %d\n",
cap->abs_position_x.minimum,
- cap->abs_position_x.maximum);
+ cap->abs_position_x.maximum);
if (cap->has_position_y)
xf86Msg(X_INFO, "multitouch: position_y: %d %d\n",
cap->abs_position_y.minimum,
- cap->abs_position_y.maximum);
+ cap->abs_position_y.maximum);
}
////////////////////////////////////////////////////////
diff --git a/src/multitouch.c b/src/multitouch.c
index 93c6339..99807b9 100644
--- a/src/multitouch.c
+++ b/src/multitouch.c
@@ -194,7 +194,7 @@ static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags)
local->private = mt;
local->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS;
local->conf_idev = dev;
-
+
xf86CollectInputOptions(local, NULL, NULL);
//xf86OptionListReport(local->options);
xf86ProcessCommonOptions(local, local->options);