Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 229919 | Differences between
and this patch

Collapse All | Expand All

(-)synaptics-0.14.6-org/synaptics.c (-18 / +26 lines)
Lines 61-70 Link Here
61
61
62
#include <unistd.h>
62
#include <unistd.h>
63
#include <sys/ioctl.h>
63
#include <sys/ioctl.h>
64
#include <string.h>
65
#include <sys/ipc.h>
66
#include <sys/shm.h>
67
#include <sys/types.h>
68
#include <sys/stat.h>
69
#include <fcntl.h>
70
#include <stdio.h>
71
#include <math.h>
72
#include <errno.h>
64
#include <misc.h>
73
#include <misc.h>
65
#include <xf86.h>
74
#include <xf86.h>
66
#define NEED_XF86_TYPES
75
#define NEED_XF86_TYPES
67
#include <xf86_ansic.h>
68
#include <xf86_OSproc.h>
76
#include <xf86_OSproc.h>
69
#include <xf86Xinput.h>
77
#include <xf86Xinput.h>
70
#include "mipointer.h"
78
#include "mipointer.h"
Lines 224-237 Link Here
224
	return TRUE;			    /* Already allocated */
232
	return TRUE;			    /* Already allocated */
225
233
226
    if (priv->shm_config) {
234
    if (priv->shm_config) {
227
	if ((shmid = xf86shmget(SHM_SYNAPTICS, 0, 0)) != -1)
235
	if ((shmid = shmget(SHM_SYNAPTICS, 0, 0)) != -1)
228
	    xf86shmctl(shmid, XF86IPC_RMID, NULL);
236
	    shmctl(shmid, IPC_RMID, NULL);
229
	if ((shmid = xf86shmget(SHM_SYNAPTICS, sizeof(SynapticsSHM),
237
	if ((shmid = shmget(SHM_SYNAPTICS, sizeof(SynapticsSHM),
230
				0777 | XF86IPC_CREAT)) == -1) {
238
				0777 | IPC_CREAT)) == -1) {
231
	    xf86Msg(X_ERROR, "%s error shmget\n", local->name);
239
	    xf86Msg(X_ERROR, "%s error shmget\n", local->name);
232
	    return FALSE;
240
	    return FALSE;
233
	}
241
	}
234
	if ((priv->synpara = (SynapticsSHM*)xf86shmat(shmid, NULL, 0)) == NULL) {
242
	if ((priv->synpara = (SynapticsSHM*)shmat(shmid, NULL, 0)) == NULL) {
235
	    xf86Msg(X_ERROR, "%s error shmat\n", local->name);
243
	    xf86Msg(X_ERROR, "%s error shmat\n", local->name);
236
	    return FALSE;
244
	    return FALSE;
237
	}
245
	}
Lines 257-264 Link Here
257
	return;
265
	return;
258
266
259
    if (priv->shm_config) {
267
    if (priv->shm_config) {
260
	if ((shmid = xf86shmget(SHM_SYNAPTICS, 0, 0)) != -1)
268
	if ((shmid = shmget(SHM_SYNAPTICS, 0, 0)) != -1)
261
	    xf86shmctl(shmid, XF86IPC_RMID, NULL);
269
	    shmctl(shmid, IPC_RMID, NULL);
262
    } else {
270
    } else {
263
	xfree(priv->synpara);
271
	xfree(priv->synpara);
264
    }
272
    }
Lines 272-278 Link Here
272
    char *str_par;
280
    char *str_par;
273
    double value;
281
    double value;
274
    str_par = xf86FindOptionValue(options, optname);
282
    str_par = xf86FindOptionValue(options, optname);
275
    if ((!str_par) || (xf86sscanf(str_par, "%lf", &value) != 1))
283
    if ((!str_par) || (sscanf(str_par, "%lf", &value) != 1))
276
	return default_value;
284
	return default_value;
277
    return value;
285
    return value;
278
}
286
}
Lines 437-444 Link Here
437
    priv->fifofd = -1;
445
    priv->fifofd = -1;
438
    if (repeater) {
446
    if (repeater) {
439
	/* create repeater fifo */
447
	/* create repeater fifo */
440
	if ((xf86mknod(repeater, 666, XF86_S_IFIFO) != 0) &&
448
	if ((mknod(repeater, 666, S_IFIFO) != 0) &&
441
	    (xf86errno != xf86_EEXIST)) {
449
	    (errno != EEXIST)) {
442
	    xf86Msg(X_ERROR, "%s can't create repeater fifo\n", local->name);
450
	    xf86Msg(X_ERROR, "%s can't create repeater fifo\n", local->name);
443
	} else {
451
	} else {
444
	    /* open the repeater fifo */
452
	    /* open the repeater fifo */
Lines 447-453 Link Here
447
		xf86Msg(X_ERROR, "%s repeater device open failed\n", local->name);
455
		xf86Msg(X_ERROR, "%s repeater device open failed\n", local->name);
448
	    }
456
	    }
449
	}
457
	}
450
	xf86free(repeater);
458
	free(repeater);
451
    }
459
    }
452
460
453
    if (!QueryHardware(local)) {
461
    if (!QueryHardware(local)) {
Lines 634-640 Link Here
634
static int
642
static int
635
move_distance(int dx, int dy)
643
move_distance(int dx, int dy)
636
{
644
{
637
    return xf86sqrt((dx * dx) + (dy * dy));
645
    return sqrt((dx * dx) + (dy * dy));
638
}
646
}
639
647
640
/*
648
/*
Lines 669-682 Link Here
669
    double xCenter = (priv->synpara->left_edge + priv->synpara->right_edge) / 2.0;
677
    double xCenter = (priv->synpara->left_edge + priv->synpara->right_edge) / 2.0;
670
    double yCenter = (priv->synpara->top_edge + priv->synpara->bottom_edge) / 2.0;
678
    double yCenter = (priv->synpara->top_edge + priv->synpara->bottom_edge) / 2.0;
671
679
672
    return xf86atan2(-(y - yCenter), x - xCenter);
680
    return atan2(-(y - yCenter), x - xCenter);
673
}
681
}
674
682
675
/* return angle difference */
683
/* return angle difference */
676
static double
684
static double
677
diffa(double a1, double a2)
685
diffa(double a1, double a2)
678
{
686
{
679
    double da = xf86fmod(a2 - a1, 2 * M_PI);
687
    double da = fmod(a2 - a1, 2 * M_PI);
680
    if (da < 0)
688
    if (da < 0)
681
	da += 2 * M_PI;
689
	da += 2 * M_PI;
682
    if (da > M_PI)
690
    if (da > M_PI)
Lines 784-790 Link Here
784
	int c;
792
	int c;
785
	while ((c = XisbRead(priv->comm.buffer)) >= 0) {
793
	while ((c = XisbRead(priv->comm.buffer)) >= 0) {
786
	    unsigned char u = (unsigned char)c;
794
	    unsigned char u = (unsigned char)c;
787
	    xf86write(priv->fifofd, &u, 1);
795
	    write(priv->fifofd, &u, 1);
788
	    if (++count >= 3)
796
	    if (++count >= 3)
789
		break;
797
		break;
790
	}
798
	}
Lines 1280-1289 Link Here
1280
1288
1281
	    /* save the fraction, report the integer part */
1289
	    /* save the fraction, report the integer part */
1282
	    tmpf = dx * speed + x_edge_speed * dtime + priv->frac_x;
1290
	    tmpf = dx * speed + x_edge_speed * dtime + priv->frac_x;
1283
	    priv->frac_x = xf86modf(tmpf, &integral);
1291
	    priv->frac_x = modf(tmpf, &integral);
1284
	    dx = integral;
1292
	    dx = integral;
1285
	    tmpf = dy * speed + y_edge_speed * dtime + priv->frac_y;
1293
	    tmpf = dy * speed + y_edge_speed * dtime + priv->frac_y;
1286
	    priv->frac_y = xf86modf(tmpf, &integral);
1294
	    priv->frac_y = modf(tmpf, &integral);
1287
	    dy = integral;
1295
	    dy = integral;
1288
	}
1296
	}
1289
1297

Return to bug 229919