Commit 5ddbf4bc authored by Matthew Allum's avatar Matthew Allum

Re-add support for tslib (1.0 release) and Xcalibrate extension.

parent 942b4369
......@@ -75,6 +75,12 @@ SERVERCONFIG_DATA = SecurityPolicy
AM_CFLAGS += -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGdir)/SecurityPolicy\"
endif
XCALIBRATE_SRCS = xcalibrate.c
if XCALIBRATE
BUILTIN_SRCS += $(XCALIBRATE_SRCS)
# XCalibrare needs tslib
endif
# X EVent Interception Extension: allows accessibility helpers & composite
# managers to intercept events from input devices and transform as needed
# before the clients see them.
......@@ -150,6 +156,7 @@ EXTRA_DIST = \
$(RES_SRCS) \
$(SCREENSAVER_SRCS) \
$(XCSECURITY_SRCS) \
$(XCALIBRATE_SRCS) \
$(XINERAMA_SRCS) \
$(XEVIE_SRCS) \
$(XPRINT_SRCS) \
......
/*
* $Id: xcalibrate.c,v 3.1 2004/06/02 20:49:50 pb Exp $
*
* Copyright © 2003 Philip Blundell
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Philip Blundell not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Philip Blundell makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* PHILIP BLUNDELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL PHILIP BLUNDELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_KDRIVE_CONFIG_H
#include <kdrive-config.h>
#endif
#define NEED_EVENTS
#define NEED_REPLIES
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcalibrateproto.h>
#include <X11/extensions/xcalibratewire.h>
extern void (*tslib_raw_event_hook)(int x, int y, int pressure, void *closure);
extern void *tslib_raw_event_closure;
static CARD8 XCalibrateReqCode;
int XCalibrateEventBase;
int XCalibrateReqBase;
int XCalibrateErrorBase;
static ClientPtr xcalibrate_client;
static void
xcalibrate_event_hook (int x, int y, int pressure, void *closure)
{
ClientPtr pClient = (ClientPtr) closure;
xXCalibrateRawTouchscreenEvent ev;
ev.type = XCalibrateEventBase + X_XCalibrateRawTouchscreen;
ev.sequenceNumber = pClient->sequence;
ev.x = x;
ev.y = y;
ev.pressure = pressure;
if (!pClient->clientGone)
WriteEventsToClient (pClient, 1, (xEvent *) &ev);
}
static int
ProcXCalibrateQueryVersion (ClientPtr client)
{
REQUEST(xXCalibrateQueryVersionReq);
xXCalibrateQueryVersionReply rep;
CARD16 client_major, client_minor; /* not used */
REQUEST_SIZE_MATCH (xXCalibrateQueryVersionReq);
client_major = stuff->majorVersion;
client_minor = stuff->minorVersion;
fprintf(stderr, "%s(): called\n", __func__);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XCALIBRATE_MAJOR_VERSION;
rep.minorVersion = XCALIBRATE_MINOR_VERSION;
if (client->swapped) {
int n;
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof (xXCalibrateQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
static int
SProcXCalibrateQueryVersion (ClientPtr client)
{
REQUEST(xXCalibrateQueryVersionReq);
int n;
REQUEST_SIZE_MATCH (xXCalibrateQueryVersionReq);
swaps(&stuff->majorVersion,n);
swaps(&stuff->minorVersion,n);
return ProcXCalibrateQueryVersion(client);
}
static int
ProcXCalibrateSetRawMode (ClientPtr client)
{
REQUEST(xXCalibrateRawModeReq);
xXCalibrateRawModeReply rep;
REQUEST_SIZE_MATCH (xXCalibrateRawModeReq);
memset (&rep, 0, sizeof (rep));
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
if (stuff->on)
{
if (xcalibrate_client == NULL)
{
/* Start calibrating. */
xcalibrate_client = client;
tslib_raw_event_hook = xcalibrate_event_hook;
tslib_raw_event_closure = client;
rep.status = GrabSuccess;
}
else
{
rep.status = AlreadyGrabbed;
}
}
else
{
if (xcalibrate_client == client)
{
/* Stop calibrating. */
xcalibrate_client = NULL;
tslib_raw_event_hook = NULL;
tslib_raw_event_closure = NULL;
rep.status = GrabSuccess;
/* Cycle input off and on to reload configuration. */
KdDisableInput ();
KdEnableInput ();
}
else
{
rep.status = AlreadyGrabbed;
}
}
if (client->swapped)
{
int n;
swaps (&rep.sequenceNumber, n);
swaps (&rep.status, n);
}
WriteToClient(client, sizeof (rep), (char *) &rep);
return (client->noClientException);
}
static int
SProcXCalibrateSetRawMode (ClientPtr client)
{
REQUEST(xXCalibrateRawModeReq);
int n;
REQUEST_SIZE_MATCH (xXCalibrateRawModeReq);
swaps(&stuff->on, n);
return ProcXCalibrateSetRawMode(client);
}
static void
XCalibrateResetProc (ExtensionEntry *extEntry)
{
}
static int
ProcXCalibrateDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XCalibrateQueryVersion:
return ProcXCalibrateQueryVersion(client);
case X_XCalibrateRawMode:
return ProcXCalibrateSetRawMode(client);
default: break;
}
return BadRequest;
}
static int
SProcXCalibrateDispatch (ClientPtr client)
{
REQUEST(xReq);
int n;
swaps(&stuff->length,n);
switch (stuff->data) {
case X_XCalibrateQueryVersion:
return SProcXCalibrateQueryVersion(client);
case X_XCalibrateRawMode:
return SProcXCalibrateSetRawMode(client);
default: break;
}
return BadRequest;
}
static void
XCalibrateClientCallback (CallbackListPtr *list,
pointer closure,
pointer data)
{
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
if (clientinfo->setup == NULL
&& xcalibrate_client != NULL
&& xcalibrate_client == pClient)
{
/* Stop calibrating. */
xcalibrate_client = NULL;
tslib_raw_event_hook = NULL;
tslib_raw_event_closure = NULL;
}
}
void
XCalibrateExtensionInit(void)
{
ExtensionEntry *extEntry;
if (!AddCallback (&ClientStateCallback, XCalibrateClientCallback, 0))
return;
extEntry = AddExtension(XCALIBRATE_NAME, XCalibrateNumberEvents, XCalibrateNumberErrors,
ProcXCalibrateDispatch, SProcXCalibrateDispatch,
XCalibrateResetProc, StandardMinorOpcode);
if (!extEntry)
return;
XCalibrateReqCode = (unsigned char)extEntry->base;
XCalibrateEventBase = extEntry->eventBase;
XCalibrateErrorBase = extEntry->errorBase;
xcalibrate_client = 0;
}
......@@ -414,6 +414,8 @@ AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinera
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: enabled)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=yes])
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: enabled)]), [XF86MISC=$enableval], [XF86MISC=yes])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=yes])
AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=yes])
AC_ARG_ENABLE(cup, AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: enabled)]), [CUP=$enableval], [CUP=yes])
......@@ -696,6 +698,14 @@ if test "x$XPRINT" = xyes; then
REQUIRED_MODULES="$REQUIRED_MODULES printproto"
fi
if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto"
else
XCALIBRATE=no
fi
AM_CONDITIONAL(XCALIBRATE, [test "x$XCALIBRATE" = xyes])
AC_DEFINE(RENDER, 1, [Support RENDER extension])
RENDER_LIB='$(top_builddir)/render/librender.la'
RENDER_INC='-I$(top_srcdir)/render'
......@@ -1439,6 +1449,13 @@ if test "$KDRIVE" = yes; then
fi
# tslib...
if test "x$TSLIB" = xyes; then
PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
if test "x$HAVE_TSLIB" = xno; then
AC_MSG_ERROR([tslib must be installed to build the tslib driver. See http://tslib.berlios.de/])
fi
AC_DEFINE(TSLIB, 1, [Have tslib support])
fi
# damage shadow extension glx (NOTYET) fb mi
KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
......@@ -1446,7 +1463,7 @@ if test "$KDRIVE" = yes; then
KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H"
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
# dix os fb mi extension glx (NOTYET) damage shadow xpstubs
#KDRIVE_PURE_LIBS="$DIX_LIB $OS_LIB $FB_LIB $XEXT_LIB $MIEXT_DAMAGE_LIB \
......@@ -1455,7 +1472,7 @@ if test "$KDRIVE" = yes; then
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a'
KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.a'
KDRIVE_LIBS="$DIX_LIB $KDRIVE_LIB $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB"
KDRIVE_LIBS="$DIX_LIB $KDRIVE_LIB $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB $TSLIB_LIBS"
# check if we can build Xephyr
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
......@@ -1471,7 +1488,7 @@ AC_SUBST(KDRIVE_PURE_INCS)
AC_SUBST(KDRIVE_CFLAGS)
AC_SUBST(KDRIVE_PURE_LIBS)
AC_SUBST(KDRIVE_LIBS)
AM_CONDITIONAL(TSLIB, false)
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
AM_CONDITIONAL(H3600_TS, false)
AM_CONDITIONAL(KDRIVEVESA, [test x"$ac_cv_header_sys_vm86_h" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test x"$ac_cv_header_linux_fb_h" = xyes])
......
......@@ -31,10 +31,6 @@ INCLUDES = \
bin_PROGRAMS = Xati
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libati.a
libati_a_SOURCES = \
......@@ -65,8 +61,12 @@ ATI_LIBS = \
Xati_LDADD = \
$(ATI_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xati_DEPENDENCIES = \
libati.a \
$(FBDEV_LIBS) \
$(VESA_LIBS) \
$(DRI_LIBS)
Xati_DEPENDENCIES = $(ATI_LIBS)
......@@ -5,10 +5,6 @@ INCLUDES = \
bin_PROGRAMS = Xchips
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libchips.a
libchips_a_SOURCES = \
......@@ -19,15 +15,16 @@ libchips_a_SOURCES = \
Xchips_SOURCES = \
chipsstub.c
CHIPS_LIBS = \
libchips.a \
CHIPS_LIBS = \
libchips.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@
Xchips_LDADD = \
$(CHIPS_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xchips_DEPENDENCIES = $(CHIPS_LIBS)
Xchips_DEPENDENCIES = \
libchips.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
......@@ -5,11 +5,6 @@ INCLUDES = \
noinst_LIBRARIES = libxephyr.a libxephyr-hostx.a
if TSLIB
TSLIB_LIBS = -lts
endif
bin_PROGRAMS = Xephyr
libxephyr_a_SOURCES = \
......@@ -34,7 +29,6 @@ Xephyr_LDADD = \
../../../exa/libexa.la \
@KDRIVE_LIBS@ \
@KDRIVE_LIBS@ \
$(TSLIB_LIBS) \
@XEPHYR_LIBS@
Xephyr_DEPENDENCIES = \
......
......@@ -4,10 +4,6 @@ INCLUDES = \
bin_PROGRAMS = Xepson
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libepson.a
libepson_a_SOURCES = \
......@@ -25,9 +21,8 @@ EPSON_LIBS = \
@KDRIVE_LIBS@
Xepson_LDADD = \
$(EPSON_LIBS) \
$(EPSON_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xepson_DEPENDENCIES = $(EPSON_LIBS)
Xepson_DEPENDENCIES = libepson.a
......@@ -6,10 +6,6 @@ noinst_LIBRARIES = libfbdev.a
bin_PROGRAMS = Xfbdev
if TSLIB
TSLIB_FLAG = -lts
endif
libfbdev_a_SOURCES = \
fbdev.c \
fbdev.h
......@@ -20,8 +16,7 @@ Xfbdev_SOURCES = \
Xfbdev_LDADD = \
libfbdev.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xfbdev_DEPENDENCIES = \
libfbdev.a
......@@ -6,9 +6,6 @@ bin_PROGRAMS = Xi810
noinst_LIBRARIES = libi810.a
if TSLIB
TSLIB_FLAG = -lts
endif
libi810_a_SOURCES = \
i810_cursor.c \
......@@ -29,7 +26,6 @@ I810_LIBS = \
Xi810_LDADD = \
$(I810_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xi810_DEPENDENCIES = $(I810_LIBS)
Xi810_DEPENDENCIES = libi810.a
......@@ -32,4 +32,6 @@ Xmga_LDADD = \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xmga_DEPENDENCIES = $(MGA_LIBS)
Xmga_DEPENDENCIES = \
libmga.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
......@@ -16,10 +16,6 @@ INCLUDES = \
bin_PROGRAMS = Xneomagic
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libneomagic.a
libneomagic_a_SOURCES = \
......@@ -41,7 +37,10 @@ NEOMAGIC_LIBS = \
Xneomagic_LDADD = \
$(NEOMAGIC_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xneomagic_DEPENDENCIES = $(NEOMAGIC_LIBS)
Xneomagic_DEPENDENCIES = \
libneomagic.a \
${FBDEV_LIBS} \
${VESA_LIBS}
......@@ -30,7 +30,8 @@ NVIDIA_LIBS = \
Xnvidia_LDADD = \
$(NVIDIA_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xnvidia_DEPENDENCIES = $(NVIDIA_LIBS)
Xnvidia_DEPENDENCIES = \
libnvidia.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
......@@ -5,10 +5,6 @@ INCLUDES = \
bin_PROGRAMS = Xpm2
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libpm2.a
libpm2_a_SOURCES = \
......@@ -28,7 +24,9 @@ PM2_LIBS = \
Xpm2_LDADD = \
$(PM2_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xpm2_DEPENDENCIES = $(PM2_LIBS)
Xpm2_DEPENDENCIES = \
libpm2.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
......@@ -5,10 +5,6 @@ INCLUDES = \
bin_PROGRAMS = Xr128
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libr128.a
libr128_a_SOURCES = \
......@@ -27,7 +23,9 @@ R128_LIBS = \
Xr128_LDADD = \
$(R128_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xr128_DEPENDENCIES = $(R128_LIBS)
Xr128_DEPENDENCIES = \
libr128.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
......@@ -6,10 +6,6 @@ INCLUDES = \
bin_PROGRAMS = Xsmi
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libsmi.a
# smivideo.c # not ready yet
......@@ -32,7 +28,10 @@ SMI_LIBS = \
Xsmi_LDADD = \
$(SMI_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
@XSERVER_LIBS@
Xsmi_DEPENDENCIES = $(SMI_LIBS)
Xsmi_DEPENDENCIES = \
libsmi.a \
$(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
......@@ -6,11 +6,6 @@ noinst_LIBRARIES = libvesa.a
bin_PROGRAMS = Xvesa
if TSLIB
TSLIB_FLAG = -lts
endif
libvesa_a_SOURCES = \
vesa.c \
vesa.h \
......@@ -28,7 +23,6 @@ Xvesa_LDADD = \
libvesa.a \
@KDRIVE_LIBS@ \
@KDRIVE_LIBS@ \
$(TSLIB_FLAG) \
@XSERVER_LIBS@
Xvesa_DEPENDENCIES = \
......
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