From 612e82053d986df70bcc9c87038244eab8c3dc13 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 5 Nov 2002 05:28:34 +0000 Subject: [PATCH] Clean up touch screen hacks for controlling pointer on alternate screen --- hw/kdrive/fbdev/fbdev.c | 8 ++------ hw/kdrive/linux/tslib.c | 6 ++---- hw/kdrive/src/kdrive.h | 12 +++++++++++- hw/kdrive/src/kinput.c | 9 +++++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c index ed08fdb62..7393ed8ac 100644 --- a/hw/kdrive/fbdev/fbdev.c +++ b/hw/kdrive/fbdev/fbdev.c @@ -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/fbdev/fbdev.c,v 1.29 2002/09/29 23:39:46 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.31 2002/10/14 18:01:40 keithp Exp $ */ #include "fbdev.h" @@ -581,10 +581,6 @@ fbdevCreateColormap (ColormapPtr pmap) } } -#ifdef TOUCHSCREEN -int TsFbdev = -1; -#endif - Bool fbdevInitScreen (ScreenPtr pScreen) { @@ -595,7 +591,7 @@ fbdevInitScreen (ScreenPtr pScreen) ShadowWindowProc window; #ifdef TOUCHSCREEN - TsFbdev = pScreen->myNum; + KdTsPhyScreen = pScreen->myNum; #endif pScreen->CreateColormap = fbdevCreateColormap; diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c index e8719d926..30413c0b4 100644 --- a/hw/kdrive/linux/tslib.c +++ b/hw/kdrive/linux/tslib.c @@ -1,5 +1,5 @@ /* - * $XFree86$ + * $XFree86: xc/programs/Xserver/hw/kdrive/linux/tslib.c,v 1.1 2002/11/01 22:27:49 keithp Exp $ * TSLIB based touchscreen driver for TinyX * Derived from ts.c by Keith Packard * Derived from ps2.c by Jim Gettys @@ -57,8 +57,6 @@ #include static long lastx = 0, lasty = 0; -int TsScreen; -extern int TsFbdev; static struct tsdev *tsDev = NULL; void @@ -84,7 +82,7 @@ TsRead (int tsPort, void *closure) * touch screen, if it is we send absolute coordinates. If not, * then we send delta's so that we can track the entire vga screen. */ - if (TsScreen == TsFbdev) { + if (KdTsCurScreen == KdTsPhyScreen) { flags = KD_BUTTON_1; x = event.x; y = event.y; diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 9ddfa76ce..9f1466da9 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.26 2002/10/14 18:01:40 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.27 2002/10/18 06:08:10 keithp Exp $ */ #include #include "X.h" @@ -208,6 +208,16 @@ typedef struct _KdMouseInfo { extern KdMouseInfo *kdMouseInfo; +#ifdef TOUCHSCREEN +/* + * HACK! Send absolute events when touch screen is current, + * else send relative events. Used to drive pointers on + * alternate screens with the touch screen + */ +extern int KdTsCurScreen; +extern int KdTsPhyScreen; +#endif + KdMouseInfo *KdMouseInfoAdd (void); void KdParseMouse (char *); diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 97b4f6fea..b1e8986fb 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -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/kinput.c,v 1.27 2002/10/30 21:25:53 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.28 2002/10/31 18:29:50 keithp Exp $ */ #include "kdrive.h" #include "inputstr.h" @@ -325,7 +325,7 @@ KdMouseProc(DeviceIntPtr pDevice, int onoff) if (kdMouseFuncs) (*kdMouseFuncs->Fini) (); #ifdef TOUCHSCREEN - if (kdTsFuncs >= 0) + if (kdTsFuncs) (*kdTsFuncs->Fini) (); #endif } @@ -1577,7 +1577,8 @@ KdCrossScreen(ScreenPtr pScreen, Bool entering) #ifdef TOUCHSCREEN /* HACK! */ -extern int TsScreen; +int KdTsCurScreen; /* current event screen */ +int KdTsPhyScreen = -1; /* screen associated with touch screen */ #endif static void @@ -1585,7 +1586,7 @@ KdWarpCursor (ScreenPtr pScreen, int x, int y) { KdBlockSigio (); #ifdef TOUCHSCREEN - TsScreen = pScreen->myNum; + KdTsCurScreen = pScreen->myNum; #endif miPointerWarpCursor (pScreen, x, y); KdUnblockSigio ();