diff -U 8 -p -r xf86-input-hyperpen-1.1.0.org/ChangeLog xf86-input-hyperpen-1.1.0/ChangeLog --- xf86-input-hyperpen-1.1.0.org/ChangeLog 2006-04-07 19:35:53.000000000 +0200 +++ xf86-input-hyperpen-1.1.0/ChangeLog 2007-11-01 15:52:27.357230915 +0100 @@ -1,8 +1,14 @@ +2007-11-01 Manuel Reimer + + * src/xf86HyperPen.c: + Made it possible to disable cursor auto detect by setting + "CURSOR" in xorg.conf + 2006-04-06 Adam Jackson * configure.ac: * src/xf86HyperPen.c: Unlibcwrap. Bump server version requirement. Bump to 1.1.0. 2005-12-20 Kevin E. Martin diff -U 8 -p -r xf86-input-hyperpen-1.1.0.org/src/xf86HyperPen.c xf86-input-hyperpen-1.1.0/src/xf86HyperPen.c --- xf86-input-hyperpen-1.1.0.org/src/xf86HyperPen.c 2006-04-07 19:35:28.000000000 +0200 +++ xf86-input-hyperpen-1.1.0/src/xf86HyperPen.c 2007-11-01 15:59:18.880682300 +0100 @@ -181,18 +181,16 @@ static int debug_level = INI_DEBUG_LEVEL ** Device records */ #define ABSOLUTE_FLAG 1 #define STYLUS_FLAG 2 #define INVX_FLAG 4 #define INVY_FLAG 8 #define BAUD_19200_FLAG 16 -int stylus; - typedef struct { char *hypDevice; /* device file name */ int hypButTrans; /* button translation flags */ int hypOldX; /* previous X position */ int hypOldY; /* previous Y position */ int hypOldZ; /* previous Z position */ int hypOldProximity; /* previous proximity */ @@ -209,16 +207,17 @@ typedef struct int hypYSize; /* active area Y size */ int hypYOffset; /* active area Y offset */ int hypRes; /* resolution in lines per inch */ int flags; /* various flags */ int hypIndex; /* number of bytes read */ int modelid; /* model id */ int PT; /* pressure threshold */ int AutoPT; /* automatically set PT*/ + int AutoCursor; /* auto detect used cursor*/ int PMax; /* maximum pressure read from tablet */ unsigned char hypData[7]; /* data read on the device */ } HyperPenDeviceRec, *HyperPenDevicePtr; /* ** List of model IDs */ static struct MODEL_ID { @@ -435,16 +434,17 @@ xf86HypConfig(LocalDevicePtr *array, int LocalDevicePtr dev = array[inx]; HyperPenDevicePtr priv = (HyperPenDevicePtr)(dev->private); int token; int mtoken; DBG(1, ErrorF("xf86HypConfig\n")); priv->AutoPT=1; + priv->AutoCursor=1; priv->PMax=1000; while ((token = xf86GetToken(HypTab)) != ENDSUBSECTION) { switch(token) { case DEVICENAME: if (xf86GetToken(NULL) != STRING) xf86ConfigError("Option string expected"); else { @@ -488,19 +488,21 @@ xf86HypConfig(LocalDevicePtr *array, int case CURSOR: mtoken = xf86GetToken(HypPointTabRec); if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) xf86ConfigError("Cursor token expected"); else { switch (mtoken) { case STYLUS: priv->flags |= STYLUS_FLAG; + priv->AutoCursor = 0; // deactivate cursor auto detection break; case PUCK: priv->flags &= ~STYLUS_FLAG; + priv->AutoCursor = 0; // deactivate cursor auto detection break; default: xf86ConfigError("Illegal cursor type"); break; } } break; @@ -684,17 +686,17 @@ xf86HypReverseConvert(LocalDevicePtr loc ** xf86HypReadInput ** Reads from the HyperPen and posts any new events to the server. */ static void xf86HypReadInput(LocalDevicePtr local) { HyperPenDevicePtr priv = (HyperPenDevicePtr) local->private; int len, loop; - int is_core_pointer, is_absolute; + int is_core_pointer, is_absolute=0; int f_keys, f_key, tip; int x, y, bx, by, barrel, barrel1, prox, pressure, button, push; int hw_pressure; DeviceIntPtr device; unsigned char buffer[BUFFER_SIZE]; @@ -725,20 +727,23 @@ xf86HypReadInput(LocalDevicePtr local) prox = (priv->hypData[0] & PROXIMITY_BIT)? 0: 1; tip = (priv->hypData[0] & TIP_BITS)? 1:0; button = (priv->hypData[0] & BUTTON_BITS); f_keys = (priv->hypData[0] & F_BIT); pressure = (int) priv->hypData[6] + (((int) priv->hypData[5] & ZMASK_BIT) << 3); - if ((tip==0) && (button==0) && (pressure>2) && (pressure != 1022)) {priv->flags |= STYLUS_FLAG; stylus=1;} else - if ((tip==0) && (button==0) && (pressure==0)) {priv->flags &= ~STYLUS_FLAG; stylus=0; pressure = 1019;} - -is_absolute = stylus; + // If we are allowed, we try to auto-detect the used cursor + if (priv->AutoCursor) { + if ((tip==0) && (button==0) && (pressure>2) && (pressure != 1022)) {priv->flags |= STYLUS_FLAG; is_absolute=1;} else + if ((tip==0) && (button==0) && (pressure==0)) {priv->flags &= ~STYLUS_FLAG; is_absolute=0; pressure = 1019;} + } + else + is_absolute = (priv->flags & STYLUS_FLAG); x = priv->hypData[1] + (priv->hypData[2] << 7) + ((priv->hypData[5] & XAXIS_BITS) << 14); y = priv->hypData[3] + (priv->hypData[4] << 7) + ((priv->hypData[5] & YAXIS_BITS) << 12); if ((f_keys) && (tip)) (f_key = ((x >> 7) + 1) >> 1); else f_key =0; x -= priv->hypXOffset; y = priv->hypYSize - y + priv->hypYOffset; @@ -1431,17 +1436,16 @@ xf86HypAllocate(void) priv->hypMaxY = -1; /* max Y value */ priv->hypXSize = -1; /* active area X */ priv->hypXOffset = 0; /* active area X offset */ priv->hypYSize = -1; /* active area Y */ priv->hypYOffset = 0; /* active area Y offset */ priv->flags = ABSOLUTE_FLAG; /* various flags -- default abs format */ priv->hypIndex = 0; /* number of bytes read */ priv->hypRes = 0; /* resolution */ - stylus=0; return local; } #ifndef XFREE86_V4 /* ** HyperPen device association Only in xf86-input-hyperpen-1.1.0/src: xf86HyperPen.c.js