summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPing Cheng <pingc@wacom.com>2009-12-22 17:48:09 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2009-12-24 09:01:05 +1000
commit72c69cfc60d6b762415828930a63e485aa00185f (patch)
tree5580206c9edbca873520d48398c873106b979e73
parentfe2d108ac2e2bbddc1a8dba96550e737a15aee9e (diff)
downloadxf86-input-wacom-72c69cfc60d6b762415828930a63e485aa00185f.tar.gz
Add local maxX, maxY, resolX, and resolY
Instead of switching maximum and resolution back and forth between touch and penabled devices globally, we define them into WacomDevice. The values are initialized in xf86WcmInitialToolSize once and used through out the life of the device. Signed-off-by: Ping Cheng <pinglinux@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/wcmCommon.c48
-rw-r--r--src/wcmXCommand.c10
-rw-r--r--src/xf86Wacom.c44
-rw-r--r--src/xf86WacomDefs.h4
4 files changed, 30 insertions, 76 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 1d2e3f2..96efcba 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1880,16 +1880,8 @@ static void rotateOneTool(WacomDevicePtr priv)
DBG(10, priv, "\n");
- if (!IsTouch(priv))
- {
- oldMaxX = common->wcmMaxX;
- oldMaxY = common->wcmMaxY;
- }
- else
- {
- oldMaxX = common->wcmMaxTouchX;
- oldMaxY = common->wcmMaxTouchY;
- }
+ oldMaxX = priv->maxX;
+ oldMaxY = priv->maxY;
tmpTopX = priv->topX;
tmpBottomX = priv->bottomX;
@@ -1898,16 +1890,8 @@ static void rotateOneTool(WacomDevicePtr priv)
if (common->wcmRotate == ROTATE_CW || common->wcmRotate == ROTATE_CCW)
{
- if (!IsTouch(priv))
- {
- common->wcmMaxX = oldMaxY;
- common->wcmMaxY = oldMaxX;
- }
- else
- {
- common->wcmMaxTouchX = oldMaxY;
- common->wcmMaxTouchY = oldMaxX;
- }
+ priv->maxX = oldMaxY;
+ priv->maxY = oldMaxX;
}
switch (common->wcmRotate) {
@@ -1969,29 +1953,13 @@ void xf86WcmRotateTablet(LocalDevicePtr local, int value)
/* rotate all devices at once! else they get misaligned */
for (tmppriv = common->wcmDevices; tmppriv; tmppriv = tmppriv->next)
{
- if (!IsTouch(priv))
- {
- oldMaxX = common->wcmMaxX;
- oldMaxY = common->wcmMaxY;
- }
- else
- {
- oldMaxX = common->wcmMaxTouchX;
- oldMaxY = common->wcmMaxTouchY;
- }
+ oldMaxX = priv->maxX;
+ oldMaxY = priv->maxY;
if (oldRotation == ROTATE_CW || oldRotation == ROTATE_CCW)
{
- if (!IsTouch(priv))
- {
- common->wcmMaxX = oldMaxY;
- common->wcmMaxY = oldMaxX;
- }
- else
- {
- common->wcmMaxTouchX = oldMaxY;
- common->wcmMaxTouchY = oldMaxX;
- }
+ priv->maxX = oldMaxY;
+ priv->maxY = oldMaxX;
}
tmpTopX = tmppriv->topX;
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index a03749f..a3bcf8c 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -345,14 +345,8 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
{
values[0] = 0;
values[1] = 0;
- if (!IsTouch(priv))
- values[2] = common->wcmMaxX;
- else
- values[2] = common->wcmMaxTouchX;
- if (!IsTouch(priv))
- values[3] = common->wcmMaxY;
- else
- values[3] = common->wcmMaxTouchY;
+ values[2] = priv->maxX;
+ values[3] = priv->maxY;
}
priv->topX = area->topX = values[0];
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 477107f..254d591 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -146,16 +146,10 @@ static int xf86WcmInitArea(LocalDevicePtr local)
WacomToolAreaPtr area = priv->toolarea, inlist;
WacomCommonPtr common = priv->common;
double screenRatio, tabletRatio;
- int bottomx = common->wcmMaxX, bottomy = common->wcmMaxY;
+ int bottomx = priv->maxX, bottomy = priv->maxY;
DBG(10, priv, "\n");
- if (IsTouch(priv))
- {
- bottomx = common->wcmMaxTouchX;
- bottomy = common->wcmMaxTouchY;
- }
-
/* Verify Box */
if (priv->topX > bottomx)
{
@@ -348,15 +342,10 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes)
WacomDevicePtr priv = (WacomDevicePtr)local->private;
WacomCommonPtr common = priv->common;
int topx = 0, topy = 0, resolution;
- int bottomx = common->wcmMaxX, bottomy = common->wcmMaxY;
+ int bottomx = priv->maxX, bottomy = priv->maxY;
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
Atom label;
#endif
- if (IsTouch(priv))
- {
- bottomx = common->wcmMaxTouchX;
- bottomy = common->wcmMaxTouchY;
- }
xf86WcmMappingFactor(local);
@@ -379,10 +368,7 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes)
#endif
}
- if (!IsTouch(priv))
- resolution = common->wcmResolX;
- else
- resolution = common->wcmTouchResolX;
+ resolution = priv->resolX;
if (common->wcmScaling)
{
/* In case xf86WcmDevConvert didn't get called */
@@ -416,10 +402,7 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes)
#endif
}
- if (!IsTouch(priv))
- resolution = common->wcmResolY;
- else
- resolution = common->wcmTouchResolY;
+ resolution = priv->resolY;
if (common->wcmScaling)
{
/* In case xf86WcmDevConvert didn't get called */
@@ -594,17 +577,22 @@ static void xf86WcmInitialToolSize(LocalDevicePtr local)
WacomCommonPtr common = priv->common;
WacomToolPtr toollist = common->wcmTool;
WacomToolAreaPtr arealist;
- int bottomx = 0, bottomy = 0;
+ /* assign max and resolution here since we don't get them during
+ * the configuration stage */
if (IsTouch(priv))
{
- bottomx = common->wcmMaxTouchX;
- bottomy = common->wcmMaxTouchY;
+ priv->maxX = common->wcmMaxTouchX;
+ priv->maxY = common->wcmMaxTouchY;
+ priv->resolX = common->wcmTouchResolX;
+ priv->resolY = common->wcmTouchResolY;
}
else
{
- bottomx = common->wcmMaxX;
- bottomy = common->wcmMaxY;
+ priv->maxX = common->wcmMaxX;
+ priv->maxY = common->wcmMaxY;
+ priv->resolX = common->wcmResolX;
+ priv->resolY = common->wcmResolY;
}
for (; toollist; toollist=toollist->next)
@@ -613,9 +601,9 @@ static void xf86WcmInitialToolSize(LocalDevicePtr local)
for (; arealist; arealist=arealist->next)
{
if (!arealist->bottomX)
- arealist->bottomX = bottomx;
+ arealist->bottomX = priv->maxX;
if (!arealist->bottomY)
- arealist->bottomY = bottomy;
+ arealist->bottomY = priv->maxY;
}
}
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 80976b9..1e4a441 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -170,6 +170,10 @@ struct _WacomDeviceRec
int topY; /* Y top */
int bottomX; /* X bottom */
int bottomY; /* Y bottom */
+ int resolX; /* X resolution */
+ int resolY; /* Y resolution */
+ int maxX; /* tool logical maxX */
+ int maxY; /* tool logical maxY */
int sizeX; /* active X size */
int sizeY; /* active Y size */
double factorX; /* X factor */