Having multiple areas for tool is feature that has gone untested for
possibly years and it's hard to figure out how to even configure it.
Purge it.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/wcmCommon.c         |   56 ++----------------------------
 src/wcmConfig.c         |   30 +---------------
 src/wcmValidateDevice.c |   23 ++----------
 src/wcmXCommand.c       |   31 ++--------------
 src/xf86Wacom.c         |   89 +---------------------------------------------
 src/xf86WacomDefs.h     |   19 +---------
 6 files changed, 15 insertions(+), 233 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 926fbc4..3a502a9 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1036,60 +1036,13 @@ static WacomToolPtr findTool(const WacomCommonPtr 
common,
        }
 
        /* pad does not need area check. Skip the unnecessary steps */
-       if (tool && (tool->typeid == PAD_ID) && tool->arealist)
+       if (tool && (tool->typeid == PAD_ID))
                return tool;
 
        /* Use default tool (serial == 0) if no specific was found */
        if (!tool)
                tool = tooldef;
 
-       /* 2: Find the associated area, and its InputDevice */
-       if (tool)
-       {
-               /* if the current area is not in-prox anymore, we
-                * might want to use another area. So move the
-                * current-pointer away for a moment while we have a
-                * look if there's a better area defined.
-                * Skip this if only one area is defined
-                */
-               WacomToolAreaPtr outprox = NULL;
-               if (tool->current && tool->arealist->next &&
-                       !wcmPointInArea(tool->current, ds->x, ds->y))
-               {
-                       outprox = tool->current;
-                       tool->current = NULL;
-               }
-
-               /* If only one area is defined for the tool, always
-                * use this area even if we're not inside it
-                */
-               if (!tool->current && !tool->arealist->next)
-                       tool->current = tool->arealist;
-
-               /* If no current area in-prox, find a matching area */
-               if(!tool->current)
-               {
-                       WacomToolAreaPtr area = tool->arealist;
-                       for(; area; area = area->next)
-                               if (wcmPointInArea(area, ds->x, ds->y))
-                                       break;
-                       tool->current = area;
-               }
-
-               /* If a better area was found, send a soft prox-out
-                * for the current in-prox area, else use the old one. */
-               if (outprox)
-               {
-                       if (tool->current)
-                       {
-                               /* Send soft prox-out for the old area */
-                               wcmSoftOutEvent(outprox->device);
-                       }
-                       else
-                               tool->current = outprox;
-               }
-       }
-
        return tool;
 }
 
@@ -1213,7 +1166,7 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
        tool = findTool(common, ds);
        /* if a device matched criteria, handle filtering per device
         * settings, and send event to XInput */
-       if (!tool || !tool->current || !tool->current->device)
+       if (!tool || !tool->device)
        {
                DBG(11, common, "no device matches with"
                                " id=%d, serial=%u\n",
@@ -1221,7 +1174,7 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
                return;
        }
 
-       pInfo = tool->current->device;
+       pInfo = tool->device;
        DBG(11, common, "tool id=%d for %s\n", ds->device_type, pInfo->name);
 
        /* Tool on the tablet when driver starts. This sometime causes
@@ -1364,9 +1317,6 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
                }
        }
        wcmSendEvents(pInfo, &filtered);
-       /* If out-prox, reset the current area pointer */
-       if (!filtered.proximity)
-               tool->current = NULL;
 }
 
 /*****************************************************************************
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index c2d4fba..afb5e0a 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -38,7 +38,6 @@ static int wcmAllocate(InputInfoPtr pInfo)
        WacomDevicePtr   priv   = NULL;
        WacomCommonPtr   common = NULL;
        WacomToolPtr     tool   = NULL;
-       WacomToolAreaPtr area   = NULL;
        int i;
 
        priv = calloc(1, sizeof(WacomDeviceRec));
@@ -53,10 +52,6 @@ static int wcmAllocate(InputInfoPtr pInfo)
        if(!tool)
                goto error;
 
-       area = calloc(1, sizeof(WacomToolArea));
-       if (!area)
-               goto error;
-
        pInfo->device_control = gWacomModule.DevProc;
        pInfo->read_input = gWacomModule.DevReadInput;
        pInfo->control_proc = gWacomModule.DevChangeControl;
@@ -128,18 +123,12 @@ static int wcmAllocate(InputInfoPtr pInfo)
        priv->tool = tool;
        common->wcmTool = tool;
        tool->next = NULL;          /* next tool in list */
-       tool->arealist = area;      /* list of defined areas */
+       tool->device = pInfo;
        /* tool->typeid is set once we know the type - see wcmSetType */
 
-       /* tool area */
-       priv->toolarea = area;
-       area->next = NULL;    /* next area in list */
-       area->device = pInfo; /* associated WacomDevice */
-
        return 1;
 
 error:
-       free(area);
        free(tool);
        wcmFreeCommon(&common);
        free(priv);
@@ -158,7 +147,6 @@ static void wcmFree(InputInfoPtr pInfo)
        if (!priv)
                return;
 
-       free(priv->toolarea);
        free(priv->tool);
        wcmFreeCommon(&priv->common);
        free(priv);
@@ -286,22 +274,6 @@ static void wcmUninit(InputDriverPtr drv, InputInfoPtr 
pInfo, int flags)
                pInfo->name = NULL;
        }
 
-       if (priv->toolarea)
-       {
-               WacomToolAreaPtr *prev_area = &priv->tool->arealist;
-               WacomToolAreaPtr area = *prev_area;
-               while (area)
-               {
-                       if (area == priv->toolarea)
-                       {
-                               *prev_area = area->next;
-                               break;
-                       }
-                       prev_area = &area->next;
-                       area = area->next;
-               }
-       }
-
        if (priv->tool)
        {
                WacomToolPtr *prev_tool = &common->wcmTool;
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index b8b5b6a..1b6c4e2 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -483,7 +483,6 @@ int wcmParseOptions(InputInfoPtr pInfo, int hotplugged)
        char            *s, b[12];
        int             i;
        WacomToolPtr    tool = NULL;
-       WacomToolAreaPtr area = NULL;
        int             tpc_button_is_on;
 
        /* Optional configuration */
@@ -589,11 +588,6 @@ int wcmParseOptions(InputInfoPtr pInfo, int hotplugged)
        priv->serial = xf86SetIntOption(pInfo->options, "Serial", 0);
 
        tool = priv->tool;
-       area = priv->toolarea;
-       area->topX = priv->topX;
-       area->topY = priv->topY;
-       area->bottomX = priv->bottomX;
-       area->bottomY = priv->bottomY;
        tool->serial = priv->serial;
 
        /* The first device doesn't need to add any tools/areas as it
@@ -609,18 +603,10 @@ int wcmParseOptions(InputInfoPtr pInfo, int hotplugged)
 
                if(toollist) /* Already have a tool with the same type/serial */
                {
-                       WacomToolAreaPtr arealist;
-
-                       free(tool);
-                       priv->tool = tool = toollist;
-                       arealist = toollist->arealist;
-
-                       /* Add the area to the end of the list */
-                       while(arealist->next)
-                               arealist = arealist->next;
-                       arealist->next = area;
-               }
-               else /* No match on existing tool/serial, add tool to the end 
of the list */
+                       xf86Msg(X_ERROR, "%s: already have a tool with 
type/serial %d/%d.",
+                                       pInfo->name, tool->typeid, 
tool->serial);
+                       goto error;
+               } else /* No match on existing tool/serial, add tool to the end 
of the list */
                {
                        toollist = common->wcmTool;
                        while(toollist->next)
@@ -735,7 +721,6 @@ int wcmParseOptions(InputInfoPtr pInfo, int hotplugged)
 
        return 1;
 error:
-       free(area);
        free(tool);
        return 0;
 }
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 8b9e0cd..4207dbe 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -569,33 +569,10 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
XIPropertyValuePtr prop,
        if (property == prop_tablet_area)
        {
                INT32 *values = (INT32*)prop->data;
-               WacomToolAreaPtr area = priv->toolarea;
 
                if (prop->size != 4 || prop->format != 32)
                        return BadValue;
 
-               /* value validation is unnecessary since we let utility 
programs, such as
-                * xsetwacom and userland control panel take care of the 
validation role.
-                * when all four values are set to -1, it is an area reset 
(xydefault) */
-               if ((values[0] != -1) || (values[1] != -1) ||
-                               (values[2] != -1) || (values[3] != -1))
-               {
-                       WacomToolArea tmp_area = *area;
-
-                       area->topX = values[0];
-                       area->topY = values[1];
-                       area->bottomX = values[2];
-                       area->bottomY = values[3];
-
-                       /* validate the area */
-                       if (wcmAreaListOverlap(area, priv->tool->arealist))
-                       {
-                               *area = tmp_area;
-                               return BadValue;
-                       }
-                       *area = tmp_area;
-               }
-
                if (!checkonly)
                {
                        if ((values[0] == -1) && (values[1] == -1) &&
@@ -607,10 +584,10 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
XIPropertyValuePtr prop,
                                values[3] = priv->maxY;
                        }
 
-                       priv->topX = area->topX = values[0];
-                       priv->topY = area->topY = values[1];
-                       priv->bottomX = area->bottomX = values[2];
-                       priv->bottomY = area->bottomY = values[3];
+                       priv->topX = values[0];
+                       priv->topY = values[1];
+                       priv->bottomX = values[2];
+                       priv->bottomY = values[3];
                }
        } else if (property == prop_pressurecurve)
        {
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 2961841..0962e1d 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -85,76 +85,6 @@ static void wcmKbdCtrlCallback(DeviceIntPtr di, KeybdCtrl* 
ctrl)
 {
 }
 
-static int wcmInitArea(InputInfoPtr pInfo)
-{
-       WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
-       WacomToolAreaPtr area = priv->toolarea, inlist;
-       WacomCommonPtr common = priv->common;
-       int bottomx = priv->maxX, bottomy = priv->maxY;
-
-       DBG(10, priv, "\n");
-
-       /* verify the box and initialize the area */
-       if (priv->topX > bottomx)
-               priv->topX = 0;
-
-       if (priv->topY > bottomy)
-               priv->topY = 0;
-
-       if (priv->bottomX < priv->topX || !priv->bottomX)
-               priv->bottomX = bottomx;
-
-       if (priv->bottomY < priv->topY || !priv->bottomY)
-               priv->bottomY = bottomy;
-
-       area->topX = priv->topX;
-       area->topY = priv->topY;
-       area->bottomX = priv->bottomX;
-       area->bottomY = priv->bottomY;
-
-       inlist = priv->tool->arealist;
-
-       /* The first one in the list is always valid */
-       if (area != inlist && wcmAreaListOverlap(area, inlist))
-       {
-               inlist = priv->tool->arealist;
-
-               /* remove this overlapped area from the list */
-               for (; inlist; inlist=inlist->next)
-               {
-                       if (inlist->next == area)
-                       {
-                               inlist->next = area->next;
-                               free(area);
-                               priv->toolarea = NULL;
-                       break;
-                       }
-               }
-
-               /* Remove this device from the common struct */
-               if (common->wcmDevices == priv)
-                       common->wcmDevices = priv->next;
-               else
-               {
-                       WacomDevicePtr tmp = common->wcmDevices;
-                       while(tmp->next && tmp->next != priv)
-                               tmp = tmp->next;
-                       if(tmp)
-                               tmp->next = priv->next;
-               }
-               xf86Msg(X_ERROR, "%s: Top/Bottom area overlaps with another 
devices.\n",
-                       pInfo->name);
-               return FALSE;
-       }
-       xf86Msg(X_PROBED, "%s: top X=%d top Y=%d "
-                       "bottom X=%d bottom Y=%d "
-                       "resol X=%d resol Y=%d\n",
-                       pInfo->name, priv->topX,
-                       priv->topY, priv->bottomX, priv->bottomY,
-                       priv->resolX, priv->resolY);
-       return TRUE;
-}
-
 /*****************************************************************************
  * wcmVirtualTabletPadding(InputInfoPtr pInfo)
  ****************************************************************************/
@@ -181,8 +111,6 @@ static void wcmInitialToolSize(InputInfoPtr pInfo)
 {
        WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
        WacomCommonPtr common = priv->common;
-       WacomToolPtr toollist = common->wcmTool;
-       WacomToolAreaPtr arealist;
 
        /* assign max and resolution here since we don't get them during
         * the configuration stage */
@@ -201,17 +129,8 @@ static void wcmInitialToolSize(InputInfoPtr pInfo)
                priv->resolY = common->wcmResolY;
        }
 
-       for (; toollist; toollist=toollist->next)
-       {
-               arealist = toollist->arealist;
-               for (; arealist; arealist=arealist->next)
-               {
-                       if (!arealist->bottomX) 
-                               arealist->bottomX = priv->maxX;
-                       if (!arealist->bottomY)
-                               arealist->bottomY = priv->maxY;
-               }
-       }
+       priv->bottomX = priv->maxX;
+       priv->bottomY = priv->maxY;
 
        return;
 }
@@ -515,10 +434,6 @@ static int wcmDevInit(DeviceIntPtr pWcm)
        if (!IsPad(priv))
        {
                wcmInitialToolSize(pInfo);
-
-               if (wcmInitArea(pInfo) == FALSE)
-                       return FALSE;
-
                wcmMappingFactor(pInfo);
        }
 
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 3903bdc..3d7ca11 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -289,7 +289,6 @@ struct _WacomDeviceRec
        int minPressure;        /* the minimum pressure a pen may hold */
 
        WacomToolPtr tool;         /* The common tool-structure for this device 
*/
-       WacomToolAreaPtr toolarea; /* The area defined for this device */
 
        int isParent;           /* set to 1 if the device is not 
auto-hotplugged */
 
@@ -495,23 +494,7 @@ struct _WacomTool
        int typeid; /* Tool type */
        int serial; /* Serial id, 0 == no serial id */
 
-       WacomToolAreaPtr current;  /* Current area in-prox */
-       WacomToolAreaPtr arealist; /* List of defined areas */
-};
-
-/******************************************************************************
- * WacomToolArea
- *****************************************************************************/
-struct _WacomToolArea
-{
-       WacomToolAreaPtr next;
-
-       int topX;    /* Top X/Y */
-       int topY;
-       int bottomX; /* Bottom X/Y */
-       int bottomY;
-
-       InputInfoPtr device; /* The InputDevice connected to this area */
+       InputInfoPtr device; /* The InputDevice connected to this tool */
 };
 
 #endif /*__XF86_XF86WACOMDEFS_H */
-- 
1.7.4


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to