summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2002-08-02 16:15:02 +0000
committerKeith Packard <keithp@keithp.com>2002-08-02 16:15:02 +0000
commitcf49ce6f26caee30f4160e6e0b2b658863e7a145 (patch)
treee14f7b1458536cd27305f28812f75ca212d09f5c
parent1a5f923c62dcffb3a81c6532f3dc071c70345cb3 (diff)
Allow both touchscreen and mouse at the same time
-rw-r--r--hw/kdrive/linux/mouse.c8
-rw-r--r--hw/kdrive/linux/ps2.c4
-rw-r--r--hw/kdrive/linux/ts.c27
-rw-r--r--hw/kdrive/src/kdrive.h3
4 files changed, 31 insertions, 11 deletions
diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c
index 13d97f25c..b034014a4 100644
--- a/hw/kdrive/linux/mouse.c
+++ b/hw/kdrive/linux/mouse.c
@@ -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;
}
}
}
diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c
index a3fc712a3..d5e83a8cf 100644
--- a/hw/kdrive/linux/ps2.c
+++ b/hw/kdrive/linux/ps2.c
@@ -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
*
@@ -62,7 +62,7 @@ Ps2ReadBytes (int fd, char *buf, int len, int min)
char *Ps2Names[] = {
"/dev/psaux",
- "/dev/mouse",
+/* "/dev/mouse", */
"/dev/input/mice",
};
diff --git a/hw/kdrive/linux/ts.c b/hw/kdrive/linux/ts.c
index f5da7f4a6..995c3b277 100644
--- a/hw/kdrive/linux/ts.c
+++ b/hw/kdrive/linux/ts.c
@@ -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 = {
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 48f08b712..d2f0d47d5 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -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;