Upstream-Status: Pending

Signed-off-by: Yu Ke <ke.yu@intel.com>

---
 Xext/Makefile.am           |    6 ++++++
 configure.ac               |   11 +++++++++--
 include/kdrive-config.h.in |    3 +++
 mi/miinitext.c             |    6 ++++++
 4 files changed, 24 insertions(+), 2 deletions(-)

Index: xorg-server-1.7.99.2/mi/miinitext.c
===================================================================
--- xorg-server-1.7.99.2.orig/mi/miinitext.c	2010-02-10 18:54:11.959086237 +0000
+++ xorg-server-1.7.99.2/mi/miinitext.c	2010-02-10 18:54:12.429078513 +0000
@@ -264,6 +264,9 @@
 #ifdef DMXEXT
 extern void DMXExtensionInit(INITARGS);
 #endif
+#ifdef XCALIBRATE
+extern void XCalibrateExtensionInit(INITARGS);
+#endif
 #ifdef XFIXES
 extern void XFixesExtensionInit(INITARGS);
 #endif
@@ -493,6 +496,9 @@
 	GlxPushProvider(&__glXDRISWRastProvider);
     if (!noGlxExtension) GlxExtensionInit();
 #endif
+#ifdef  XCALIBRATE
+    XCalibrateExtensionInit ();
+#endif
 }
 
 #else /* XFree86LOADER */
Index: xorg-server-1.7.99.2/configure.ac
===================================================================
--- xorg-server-1.7.99.2.orig/configure.ac	2010-02-10 18:54:11.959086237 +0000
+++ xorg-server-1.7.99.2/configure.ac	2010-02-11 11:49:50.710736962 +0000
@@ -1985,7 +1985,7 @@
     fi
 
 
-    PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
+    PKG_CHECK_MODULES([TSLIB], [tslib-1.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
     if test "x$HAVE_TSLIB" = xno; then
         AC_CHECK_LIB(ts, ts_open, [HAVE_TSLIB="yes"])
     fi
@@ -2039,7 +2039,7 @@
     KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB $CONFIG_LIB"
     KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
     KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB $OS_LIB"
-    KDRIVE_LIBS="$TSLIB_LIBS $KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS"
+    KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $TSLIB_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS"
 
     AC_SUBST([XEPHYR_LIBS])
     AC_SUBST([XEPHYR_INCS])
Index: xorg-server-1.7.99.2/include/kdrive-config.h.in
===================================================================
--- xorg-server-1.7.99.2.orig/include/kdrive-config.h.in	2010-02-10 18:54:11.959086237 +0000
+++ xorg-server-1.7.99.2/include/kdrive-config.h.in	2010-02-10 18:54:12.429078513 +0000
@@ -28,4 +28,7 @@
 /* Have execinfo.h for backtrace(). */
 #undef HAVE_EXECINFO_H
 
+/* Enable XCalibrate extension */
+#undef XCALIBRATE
+
 #endif /* _KDRIVE_CONFIG_H_ */
Index: xorg-server-1.7.99.2/hw/kdrive/linux/tslib.c
===================================================================
--- xorg-server-1.7.99.2.orig/hw/kdrive/linux/tslib.c	2010-02-10 18:58:12.669078495 +0000
+++ xorg-server-1.7.99.2/hw/kdrive/linux/tslib.c	2010-02-10 19:04:56.927828767 +0000
@@ -50,12 +50,15 @@
     int fd;
     int lastx, lasty;
     struct tsdev *tsDev;
-    void (*raw_event_hook)(int x, int y, int pressure, void *closure);
-    void *raw_event_closure;
     int phys_screen;
 };
 
 
+/* For XCalibrate extension */
+void (*tslib_raw_event_hook)(int x, int y, int pressure, void *closure);
+void *tslib_raw_event_closure;
+
+
 static void
 TsRead (int fd, void *closure)
 {
@@ -65,10 +68,10 @@
     long                x = 0, y = 0;
     unsigned long       flags;
 
-    if (private->raw_event_hook) {
+    if (tslib_raw_event_hook) {
         while (ts_read_raw(private->tsDev, &event, 1) == 1)
-            private->raw_event_hook (event.x, event.y, event.pressure,
-                                     private->raw_event_closure);
+            tslib_raw_event_hook (event.x, event.y, event.pressure,
+                                     tslib_raw_event_closure);
         return;
     }
 
@@ -111,8 +114,8 @@
 {
     struct TslibPrivate *private = pi->driverPrivate;
 
-    private->raw_event_hook = NULL;
-    private->raw_event_closure = NULL;
+    tslib_raw_event_hook = NULL;
+    tslib_raw_event_closure = NULL;
     if (!pi->path) {
         pi->path = strdup("/dev/input/touchscreen0");
         ErrorF("[tslib/TslibEnable] no device path given, trying %s\n", pi->path);
Index: xorg-server-1.7.99.2/Xext/xcalibrate.c
===================================================================
--- xorg-server-1.7.99.2.orig/Xext/xcalibrate.c	2010-02-10 18:59:24.097829840 +0000
+++ xorg-server-1.7.99.2/Xext/xcalibrate.c	2010-02-11 11:51:00.930735731 +0000
@@ -115,6 +115,7 @@
 
   memset (&rep, 0, sizeof (rep));
   rep.type = X_Reply;
+  rep.length = 0;
   rep.sequenceNumber = client->sequence;
 
   if (stuff->on)
@@ -158,6 +159,7 @@
 
       swaps (&rep.sequenceNumber, n);
       swaps (&rep.status, n);
+      swapl (&rep.length, n);
     }
   WriteToClient(client, sizeof (rep), (char *) &rep);
   return (client->noClientException);
@@ -186,6 +188,7 @@
 
   memset (&rep, 0, sizeof (rep));
   rep.type = X_Reply;
+  rep.length = 0;
   rep.sequenceNumber = client->sequence;
   rep.x = stuff->x;
   rep.y = stuff->y;
@@ -198,6 +201,7 @@
 
       swaps (&rep.x, n);
       swaps (&rep.y, n);
+      swapl (&rep.length, n);
     }
   WriteToClient(client, sizeof (rep), (char *) &rep);
   return (client->noClientException);
