Re: [Linuxwacom-devel] [PATCH v2] Don't assume tablet (x, y) always starts from (0, 0)

2014-06-17 Thread Ping Cheng
On Tue, Jun 17, 2014 at 4:03 PM, Peter Hutterer
peter.hutte...@who-t.net wrote:
 On Tue, Jun 10, 2014 at 12:49:55PM -0700, Ping Cheng wrote:
 Newer Cintiqs have an outbound of 200 tablet count outside of screen
 area. This causes absinfo.minimum to be 200 for some tablets instead
 of always 0 for all tablets. Update struct _WacomDeviceRec and
 _WacomCommonRec to process this change.

 Signed-off-by: Ping Cheng pi...@wacom.com
 Reviewed-by: Jason Gerecke killert...@gmail.com

 I'm surprised this is all it takes. I would've expected more calculations
 needing to be adjusted but grepping around for a bit I can't find any. so:

Brainstorming and testing took more time than actually implementing it.

 Reviewed-by: Peter Hutterer peter.hutte...@who-t.net

Thank you for your time.

Ping


 ---
 v2: updated with Jason's comments
 ---
  src/wcmUSB.c| 2 ++
  src/wcmXCommand.c   | 4 ++--
  src/xf86Wacom.c | 6 ++
  src/xf86WacomDefs.h | 8 ++--
  4 files changed, 16 insertions(+), 4 deletions(-)

 diff --git a/src/wcmUSB.c b/src/wcmUSB.c
 index 1bdaf3c..2e4d39e 100644
 --- a/src/wcmUSB.c
 +++ b/src/wcmUSB.c
 @@ -572,6 +572,7 @@ int usbWcmGetRanges(InputInfoPtr pInfo)

   if (!is_touch)
   {
 + common-wcmMinX = absinfo.minimum;
   common-wcmMaxX = absinfo.maximum;

  #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,30)
 @@ -605,6 +606,7 @@ int usbWcmGetRanges(InputInfoPtr pInfo)

   if (!is_touch)
   {
 + common-wcmMinY = absinfo.minimum;
   common-wcmMaxY = absinfo.maximum;

  #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,30)
 diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
 index 563f600..6c159ac 100644
 --- a/src/wcmXCommand.c
 +++ b/src/wcmXCommand.c
 @@ -708,8 +708,8 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
 XIPropertyValuePtr prop,
   if ((values[0] == -1)  (values[1] == -1) 
   (values[2] == -1)  (values[3] == -1))
   {
 - values[0] = 0;
 - values[1] = 0;
 + values[0] = priv-minX;
 + values[1] = priv-minX;
   values[2] = priv-maxX;
   values[3] = priv-maxY;
   }
 diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
 index 7b565a0..de0438f 100644
 --- a/src/xf86Wacom.c
 +++ b/src/xf86Wacom.c
 @@ -111,12 +111,18 @@ wcmInitialToolSize(InputInfoPtr pInfo)
   }
   else
   {
 + priv-minX = common-wcmMinX;
 + priv-minY = common-wcmMinY;
   priv-maxX = common-wcmMaxX;
   priv-maxY = common-wcmMaxY;
   priv-resolX = common-wcmResolX;
   priv-resolY = common-wcmResolY;
   }

 + if (!priv-topX)
 + priv-topX = priv-minX;
 + if (!priv-topY)
 + priv-topY = priv-minY;
   if (!priv-bottomX)
   priv-bottomX = priv-maxX;
   if (!priv-bottomY)
 diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
 index 1f6f43a..9b81fe0 100644
 --- a/src/xf86WacomDefs.h
 +++ b/src/xf86WacomDefs.h
 @@ -253,8 +253,10 @@ struct _WacomDeviceRec
   int bottomY;/* Y bottom in device coordinates */
   int resolX; /* X resolution */
   int resolY; /* Y resolution */
 - int maxX;   /* tool physical maxX in device coordinates*/
 - int maxY;   /* tool physical maxY in device coordinates*/
 + int minX;   /* tool physical minX in device coordinates */
 + int minY;   /* tool physical minY in device coordinates */
 + int maxX;   /* tool physical maxX in device coordinates */
 + int maxY;   /* tool physical maxY in device coordinates */
   unsigned int serial;/* device serial number this device takes (if 
 0, any serial is ok) */
   unsigned int cur_serial; /* current serial in prox */
   int cur_device_id;  /* current device ID in prox */
 @@ -396,6 +398,8 @@ struct _WacomCommonRec
   int wcmHWTouchSwitchState;   /* touch event disable/enabled by 
 hardware switch */

   /* These values are in tablet coordinates */
 + int wcmMinX; /* tablet min X value */
 + int wcmMinY; /* tablet min Y value */
   int wcmMaxX; /* tablet max X value */
   int wcmMaxY; /* tablet max Y value */
   int wcmMaxZ; /* tablet max Z value */
 --
 1.9.1

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems

Re: [Linuxwacom-devel] [PATCH v2] Don't assume tablet (x, y) always starts from (0, 0)

2014-06-17 Thread Peter Hutterer
On Tue, Jun 10, 2014 at 12:49:55PM -0700, Ping Cheng wrote:
 Newer Cintiqs have an outbound of 200 tablet count outside of screen
 area. This causes absinfo.minimum to be 200 for some tablets instead
 of always 0 for all tablets. Update struct _WacomDeviceRec and
 _WacomCommonRec to process this change.
 
 Signed-off-by: Ping Cheng pi...@wacom.com
 Reviewed-by: Jason Gerecke killert...@gmail.com

I'm surprised this is all it takes. I would've expected more calculations
needing to be adjusted but grepping around for a bit I can't find any. so:

Reviewed-by: Peter Hutterer peter.hutte...@who-t.net

Cheers,
   Peter

 ---
 v2: updated with Jason's comments
 ---
  src/wcmUSB.c| 2 ++
  src/wcmXCommand.c   | 4 ++--
  src/xf86Wacom.c | 6 ++
  src/xf86WacomDefs.h | 8 ++--
  4 files changed, 16 insertions(+), 4 deletions(-)
 
 diff --git a/src/wcmUSB.c b/src/wcmUSB.c
 index 1bdaf3c..2e4d39e 100644
 --- a/src/wcmUSB.c
 +++ b/src/wcmUSB.c
 @@ -572,6 +572,7 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
  
   if (!is_touch)
   {
 + common-wcmMinX = absinfo.minimum;
   common-wcmMaxX = absinfo.maximum;
  
  #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,30)
 @@ -605,6 +606,7 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
  
   if (!is_touch)
   {
 + common-wcmMinY = absinfo.minimum;
   common-wcmMaxY = absinfo.maximum;
  
  #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,30)
 diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
 index 563f600..6c159ac 100644
 --- a/src/wcmXCommand.c
 +++ b/src/wcmXCommand.c
 @@ -708,8 +708,8 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
 XIPropertyValuePtr prop,
   if ((values[0] == -1)  (values[1] == -1) 
   (values[2] == -1)  (values[3] == -1))
   {
 - values[0] = 0;
 - values[1] = 0;
 + values[0] = priv-minX;
 + values[1] = priv-minX;
   values[2] = priv-maxX;
   values[3] = priv-maxY;
   }
 diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
 index 7b565a0..de0438f 100644
 --- a/src/xf86Wacom.c
 +++ b/src/xf86Wacom.c
 @@ -111,12 +111,18 @@ wcmInitialToolSize(InputInfoPtr pInfo)
   }
   else
   {
 + priv-minX = common-wcmMinX;
 + priv-minY = common-wcmMinY;
   priv-maxX = common-wcmMaxX;
   priv-maxY = common-wcmMaxY;
   priv-resolX = common-wcmResolX;
   priv-resolY = common-wcmResolY;
   }
  
 + if (!priv-topX)
 + priv-topX = priv-minX;
 + if (!priv-topY)
 + priv-topY = priv-minY;
   if (!priv-bottomX)
   priv-bottomX = priv-maxX;
   if (!priv-bottomY)
 diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
 index 1f6f43a..9b81fe0 100644
 --- a/src/xf86WacomDefs.h
 +++ b/src/xf86WacomDefs.h
 @@ -253,8 +253,10 @@ struct _WacomDeviceRec
   int bottomY;/* Y bottom in device coordinates */
   int resolX; /* X resolution */
   int resolY; /* Y resolution */
 - int maxX;   /* tool physical maxX in device coordinates*/
 - int maxY;   /* tool physical maxY in device coordinates*/
 + int minX;   /* tool physical minX in device coordinates */
 + int minY;   /* tool physical minY in device coordinates */
 + int maxX;   /* tool physical maxX in device coordinates */
 + int maxY;   /* tool physical maxY in device coordinates */
   unsigned int serial;/* device serial number this device takes (if 
 0, any serial is ok) */
   unsigned int cur_serial; /* current serial in prox */
   int cur_device_id;  /* current device ID in prox */
 @@ -396,6 +398,8 @@ struct _WacomCommonRec
   int wcmHWTouchSwitchState;   /* touch event disable/enabled by hardware 
 switch */
  
   /* These values are in tablet coordinates */
 + int wcmMinX; /* tablet min X value */
 + int wcmMinY; /* tablet min Y value */
   int wcmMaxX; /* tablet max X value */
   int wcmMaxY; /* tablet max Y value */
   int wcmMaxZ; /* tablet max Z value */
 -- 
 1.9.1

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Re: [Linuxwacom-devel] [PATCH v2] Don't assume tablet (x, y) always starts from (0, 0)

2014-06-17 Thread Jason Gerecke
Pushed.

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one  /
(That is to say, eight) to the two, /
But you can’t take seven from three,/
So you look at the sixty-fours


On Tue, Jun 17, 2014 at 4:24 PM, Ping Cheng pingli...@gmail.com wrote:
 On Tue, Jun 17, 2014 at 4:03 PM, Peter Hutterer
 peter.hutte...@who-t.net wrote:
 On Tue, Jun 10, 2014 at 12:49:55PM -0700, Ping Cheng wrote:
 Newer Cintiqs have an outbound of 200 tablet count outside of screen
 area. This causes absinfo.minimum to be 200 for some tablets instead
 of always 0 for all tablets. Update struct _WacomDeviceRec and
 _WacomCommonRec to process this change.

 Signed-off-by: Ping Cheng pi...@wacom.com
 Reviewed-by: Jason Gerecke killert...@gmail.com

 I'm surprised this is all it takes. I would've expected more calculations
 needing to be adjusted but grepping around for a bit I can't find any. so:

 Brainstorming and testing took more time than actually implementing it.

 Reviewed-by: Peter Hutterer peter.hutte...@who-t.net

 Thank you for your time.

 Ping


 ---
 v2: updated with Jason's comments
 ---
  src/wcmUSB.c| 2 ++
  src/wcmXCommand.c   | 4 ++--
  src/xf86Wacom.c | 6 ++
  src/xf86WacomDefs.h | 8 ++--
  4 files changed, 16 insertions(+), 4 deletions(-)

 diff --git a/src/wcmUSB.c b/src/wcmUSB.c
 index 1bdaf3c..2e4d39e 100644
 --- a/src/wcmUSB.c
 +++ b/src/wcmUSB.c
 @@ -572,6 +572,7 @@ int usbWcmGetRanges(InputInfoPtr pInfo)

   if (!is_touch)
   {
 + common-wcmMinX = absinfo.minimum;
   common-wcmMaxX = absinfo.maximum;

  #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,30)
 @@ -605,6 +606,7 @@ int usbWcmGetRanges(InputInfoPtr pInfo)

   if (!is_touch)
   {
 + common-wcmMinY = absinfo.minimum;
   common-wcmMaxY = absinfo.maximum;

  #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,30)
 diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
 index 563f600..6c159ac 100644
 --- a/src/wcmXCommand.c
 +++ b/src/wcmXCommand.c
 @@ -708,8 +708,8 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
 XIPropertyValuePtr prop,
   if ((values[0] == -1)  (values[1] == -1) 
   (values[2] == -1)  (values[3] == 
 -1))
   {
 - values[0] = 0;
 - values[1] = 0;
 + values[0] = priv-minX;
 + values[1] = priv-minX;
   values[2] = priv-maxX;
   values[3] = priv-maxY;
   }
 diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
 index 7b565a0..de0438f 100644
 --- a/src/xf86Wacom.c
 +++ b/src/xf86Wacom.c
 @@ -111,12 +111,18 @@ wcmInitialToolSize(InputInfoPtr pInfo)
   }
   else
   {
 + priv-minX = common-wcmMinX;
 + priv-minY = common-wcmMinY;
   priv-maxX = common-wcmMaxX;
   priv-maxY = common-wcmMaxY;
   priv-resolX = common-wcmResolX;
   priv-resolY = common-wcmResolY;
   }

 + if (!priv-topX)
 + priv-topX = priv-minX;
 + if (!priv-topY)
 + priv-topY = priv-minY;
   if (!priv-bottomX)
   priv-bottomX = priv-maxX;
   if (!priv-bottomY)
 diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
 index 1f6f43a..9b81fe0 100644
 --- a/src/xf86WacomDefs.h
 +++ b/src/xf86WacomDefs.h
 @@ -253,8 +253,10 @@ struct _WacomDeviceRec
   int bottomY;/* Y bottom in device coordinates */
   int resolX; /* X resolution */
   int resolY; /* Y resolution */
 - int maxX;   /* tool physical maxX in device coordinates*/
 - int maxY;   /* tool physical maxY in device coordinates*/
 + int minX;   /* tool physical minX in device coordinates */
 + int minY;   /* tool physical minY in device coordinates */
 + int maxX;   /* tool physical maxX in device coordinates */
 + int maxY;   /* tool physical maxY in device coordinates */
   unsigned int serial;/* device serial number this device takes (if 
 0, any serial is ok) */
   unsigned int cur_serial; /* current serial in prox */
   int cur_device_id;  /* current device ID in prox */
 @@ -396,6 +398,8 @@ struct _WacomCommonRec
   int wcmHWTouchSwitchState;   /* touch event disable/enabled by 
 hardware switch */

   /* These values are in tablet coordinates */
 + int wcmMinX; /* tablet min X value */
 + int wcmMinY; /* tablet min Y value */
   int wcmMaxX; /* tablet max X value */
   int wcmMaxY; /* tablet max Y value */
   int wcmMaxZ; /* tablet max Z value */
 --
 1.9.1

 --
 HPCC 

[Linuxwacom-devel] [PATCH v2] Don't assume tablet (x, y) always starts from (0, 0)

2014-06-10 Thread Ping Cheng
Newer Cintiqs have an outbound of 200 tablet count outside of screen
area. This causes absinfo.minimum to be 200 for some tablets instead
of always 0 for all tablets. Update struct _WacomDeviceRec and
_WacomCommonRec to process this change.

Signed-off-by: Ping Cheng pi...@wacom.com
Reviewed-by: Jason Gerecke killert...@gmail.com
---
v2: updated with Jason's comments
---
 src/wcmUSB.c| 2 ++
 src/wcmXCommand.c   | 4 ++--
 src/xf86Wacom.c | 6 ++
 src/xf86WacomDefs.h | 8 ++--
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 1bdaf3c..2e4d39e 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -572,6 +572,7 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
 
if (!is_touch)
{
+   common-wcmMinX = absinfo.minimum;
common-wcmMaxX = absinfo.maximum;
 
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,30)
@@ -605,6 +606,7 @@ int usbWcmGetRanges(InputInfoPtr pInfo)
 
if (!is_touch)
{
+   common-wcmMinY = absinfo.minimum;
common-wcmMaxY = absinfo.maximum;
 
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,30)
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 563f600..6c159ac 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -708,8 +708,8 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
XIPropertyValuePtr prop,
if ((values[0] == -1)  (values[1] == -1) 
(values[2] == -1)  (values[3] == -1))
{
-   values[0] = 0;
-   values[1] = 0;
+   values[0] = priv-minX;
+   values[1] = priv-minX;
values[2] = priv-maxX;
values[3] = priv-maxY;
}
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 7b565a0..de0438f 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -111,12 +111,18 @@ wcmInitialToolSize(InputInfoPtr pInfo)
}
else
{
+   priv-minX = common-wcmMinX;
+   priv-minY = common-wcmMinY;
priv-maxX = common-wcmMaxX;
priv-maxY = common-wcmMaxY;
priv-resolX = common-wcmResolX;
priv-resolY = common-wcmResolY;
}
 
+   if (!priv-topX)
+   priv-topX = priv-minX;
+   if (!priv-topY)
+   priv-topY = priv-minY;
if (!priv-bottomX)
priv-bottomX = priv-maxX;
if (!priv-bottomY)
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 1f6f43a..9b81fe0 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -253,8 +253,10 @@ struct _WacomDeviceRec
int bottomY;/* Y bottom in device coordinates */
int resolX; /* X resolution */
int resolY; /* Y resolution */
-   int maxX;   /* tool physical maxX in device coordinates*/
-   int maxY;   /* tool physical maxY in device coordinates*/
+   int minX;   /* tool physical minX in device coordinates */
+   int minY;   /* tool physical minY in device coordinates */
+   int maxX;   /* tool physical maxX in device coordinates */
+   int maxY;   /* tool physical maxY in device coordinates */
unsigned int serial;/* device serial number this device takes (if 
0, any serial is ok) */
unsigned int cur_serial; /* current serial in prox */
int cur_device_id;  /* current device ID in prox */
@@ -396,6 +398,8 @@ struct _WacomCommonRec
int wcmHWTouchSwitchState;   /* touch event disable/enabled by hardware 
switch */
 
/* These values are in tablet coordinates */
+   int wcmMinX; /* tablet min X value */
+   int wcmMinY; /* tablet min Y value */
int wcmMaxX; /* tablet max X value */
int wcmMaxY; /* tablet max Y value */
int wcmMaxZ; /* tablet max Z value */
-- 
1.9.1


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel