Commit cf49ce6f authored by Keith Packard's avatar Keith Packard
Browse files

Allow both touchscreen and mouse at the same time

parent 1a5f923c
......@@ -912,6 +912,8 @@ MouseInit (void)
{
next = mi->next;
prot = mi->prot;
if (mi->inputType)
continue;
if (!mi->name)
{
for (i = 0; i < NUM_DEFAULT_MOUSE; i++)
......@@ -938,6 +940,7 @@ MouseInit (void)
km->i_prot = 0;
km->tty = isatty (fd);
mi->driver = km;
mi->inputType = MouseInputType;
MouseFirstProtocol (km, mi->prot);
if (KdRegisterFd (MouseInputType, fd, MouseRead, (void *) mi))
n++;
......@@ -945,8 +948,6 @@ MouseInit (void)
else
close (fd);
}
else
KdMouseInfoDispose (mi);
}
}
......@@ -958,10 +959,11 @@ MouseFini (void)
KdUnregisterFds (MouseInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next)
{
if (mi->driver)
if (mi->inputType == MouseInputType)
{
xfree (mi->driver);
mi->driver = 0;
mi->inputType = 0;
}
}
}
......
/*
* $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
*
......@@ -62,7 +62,7 @@ Ps2ReadBytes (int fd, char *buf, int len, int min)
char *Ps2Names[] = {
"/dev/psaux",
"/dev/mouse",
/* "/dev/mouse", */
"/dev/input/mice",
};
......
......@@ -154,6 +154,8 @@ TsInit (void)
for (mi = kdMouseInfo; mi; mi = next)
{
next = mi->next;
if (mi->inputType)
continue;
if (!mi->name)
{
for (i = 0; i < NUM_TS_NAMES; i++)
......@@ -170,19 +172,34 @@ TsInit (void)
fd = open (mi->name, 0);
if (fd >= 0)
{
mi->driver = (void *) fd;
if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi))
n++;
/*
* Check to see if this is a touch screen
*/
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
TsFini (void)
{
KdMouseInfo *mi;
KdUnregisterFds (TsInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next)
{
if (mi->inputType == TsInputType)
{
mi->driver = 0;
mi->inputType = 0;
}
}
}
KdMouseFuncs TsFuncs = {
......
......@@ -21,7 +21,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* 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 "X.h"
......@@ -198,6 +198,7 @@ typedef struct _KdMouseInfo {
xEvent heldEvent;
unsigned char buttonState;
int emulationDx, emulationDy;
int inputType;
} KdMouseInfo;
extern KdMouseInfo *kdMouseInfo;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment