Allow both touchscreen and mouse at the same time

This commit is contained in:
Keith Packard 2002-08-02 16:15:02 +00:00
parent 1a5f923c62
commit cf49ce6f26
4 changed files with 31 additions and 11 deletions

View File

@ -912,6 +912,8 @@ MouseInit (void)
{ {
next = mi->next; next = mi->next;
prot = mi->prot; prot = mi->prot;
if (mi->inputType)
continue;
if (!mi->name) if (!mi->name)
{ {
for (i = 0; i < NUM_DEFAULT_MOUSE; i++) for (i = 0; i < NUM_DEFAULT_MOUSE; i++)
@ -938,6 +940,7 @@ MouseInit (void)
km->i_prot = 0; km->i_prot = 0;
km->tty = isatty (fd); km->tty = isatty (fd);
mi->driver = km; mi->driver = km;
mi->inputType = MouseInputType;
MouseFirstProtocol (km, mi->prot); MouseFirstProtocol (km, mi->prot);
if (KdRegisterFd (MouseInputType, fd, MouseRead, (void *) mi)) if (KdRegisterFd (MouseInputType, fd, MouseRead, (void *) mi))
n++; n++;
@ -945,8 +948,6 @@ MouseInit (void)
else else
close (fd); close (fd);
} }
else
KdMouseInfoDispose (mi);
} }
} }
@ -958,10 +959,11 @@ MouseFini (void)
KdUnregisterFds (MouseInputType, TRUE); KdUnregisterFds (MouseInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next) for (mi = kdMouseInfo; mi; mi = mi->next)
{ {
if (mi->driver) if (mi->inputType == MouseInputType)
{ {
xfree (mi->driver); xfree (mi->driver);
mi->driver = 0; mi->driver = 0;
mi->inputType = 0;
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/programs/Xserver/hw/kdrive/linux/ps2.c,v 1.5 2001/06/29 14:00:41 keithp Exp $ * $XFree86: xc/programs/Xserver/hw/kdrive/linux/ps2.c,v 1.6 2001/10/12 06:33:10 keithp Exp $
* *
* Copyright © 1999 Keith Packard * Copyright © 1999 Keith Packard
* *
@ -62,7 +62,7 @@ Ps2ReadBytes (int fd, char *buf, int len, int min)
char *Ps2Names[] = { char *Ps2Names[] = {
"/dev/psaux", "/dev/psaux",
"/dev/mouse", /* "/dev/mouse", */
"/dev/input/mice", "/dev/input/mice",
}; };

View File

@ -154,6 +154,8 @@ TsInit (void)
for (mi = kdMouseInfo; mi; mi = next) for (mi = kdMouseInfo; mi; mi = next)
{ {
next = mi->next; next = mi->next;
if (mi->inputType)
continue;
if (!mi->name) if (!mi->name)
{ {
for (i = 0; i < NUM_TS_NAMES; i++) for (i = 0; i < NUM_TS_NAMES; i++)
@ -170,19 +172,34 @@ TsInit (void)
fd = open (mi->name, 0); fd = open (mi->name, 0);
if (fd >= 0) if (fd >= 0)
{ {
mi->driver = (void *) fd; /*
if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi)) * Check to see if this is a touch screen
n++; */
if (ioctl (fd, TS_GET_RATE, 0) != -1)
{
mi->driver = (void *) fd;
mi->inputType = TsInputType;
if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi))
n++;
}
} }
else
KdMouseInfoDispose (mi);
} }
} }
void void
TsFini (void) TsFini (void)
{ {
KdMouseInfo *mi;
KdUnregisterFds (TsInputType, TRUE); KdUnregisterFds (TsInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next)
{
if (mi->inputType == TsInputType)
{
mi->driver = 0;
mi->inputType = 0;
}
}
} }
KdMouseFuncs TsFuncs = { KdMouseFuncs TsFuncs = {

View File

@ -21,7 +21,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.20 2001/08/09 20:45:15 dawes Exp $ */ /* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.21 2001/10/12 06:33:07 keithp Exp $ */
#include <stdio.h> #include <stdio.h>
#include "X.h" #include "X.h"
@ -198,6 +198,7 @@ typedef struct _KdMouseInfo {
xEvent heldEvent; xEvent heldEvent;
unsigned char buttonState; unsigned char buttonState;
int emulationDx, emulationDy; int emulationDx, emulationDy;
int inputType;
} KdMouseInfo; } KdMouseInfo;
extern KdMouseInfo *kdMouseInfo; extern KdMouseInfo *kdMouseInfo;