Instead of checking only the 'actions' property, also check the
individual 'action' properties as well. We obviously won't be able
to correctly apply the former if the latter fails midway through.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmXCommand.c | 63 +++++++++++++++++++++++++------------------------------
 1 file changed, 29 insertions(+), 34 deletions(-)

diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 80831c3..a1e23e1 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -511,7 +511,7 @@ static int wcmSetActionsProperty(DeviceIntPtr dev, Atom 
property,
 {
        InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
        WacomDevicePtr priv = (WacomDevicePtr) pInfo->private;
-       int rc;
+       int rc, i;
 
        DBG(10, priv, "\n");
 
@@ -522,44 +522,39 @@ static int wcmSetActionsProperty(DeviceIntPtr dev, Atom 
property,
        if (rc != Success)
                return rc;
 
-       if (!checkonly)
+       for (i = 0; i < prop->size; i++)
        {
-               int i;
+               int index = i;
+               Atom subproperty = ((Atom*)prop->data)[i];
+               XIPropertyValuePtr subprop;
 
-               for (i = 0; i < prop->size; i++)
-               {
-                       int index = i;
-                       Atom subproperty = ((Atom*)prop->data)[i];
-                       XIPropertyValuePtr subprop;
+               if (property == prop_btnactions)
+               { /* Driver uses physical -- not X11 -- button numbering 
internally */
+                       if (i < 3)
+                               index = i;
+                       else if (i < 7)
+                               continue;
+                       else
+                               index = i - 4;
+               }
 
+               if (subproperty == 0)
+               { /* Interpret 'None' as meaning 'reset' */
                        if (property == prop_btnactions)
-                       { /* Driver uses physical -- not X11 -- button 
numbering internally */
-                               if (i < 3)
-                                       index = i;
-                               else if (i < 7)
-                                       continue;
-                               else
-                                       index = i - 4;
-                       }
-
-                       if (subproperty == 0)
-                       { /* Interpret 'None' as meaning 'reset' */
-                               if (property == prop_btnactions)
-                                       wcmResetButtonAction(pInfo, index, 
size);
-                               else if (property == prop_strip_buttons)
-                                       wcmResetStripAction(pInfo, index);
-                               else if (property == prop_wheel_buttons)
-                                       wcmResetWheelAction(pInfo, index);
-
-                               if (subproperty != handlers[index])
-                                       subproperty = handlers[index];
-                       }
-
-                       XIGetDeviceProperty(dev, subproperty, &subprop);
-                       rc = wcmSetActionProperty(dev, subproperty, subprop, 
checkonly, &handlers[index], &actions[index]);
-                       if (rc != Success)
-                               return rc;
+                               wcmResetButtonAction(pInfo, index, size);
+                       else if (property == prop_strip_buttons)
+                               wcmResetStripAction(pInfo, index);
+                       else if (property == prop_wheel_buttons)
+                               wcmResetWheelAction(pInfo, index);
+
+                       if (subproperty != handlers[index])
+                               subproperty = handlers[index];
                }
+
+               XIGetDeviceProperty(dev, subproperty, &subprop);
+               rc = wcmSetActionProperty(dev, subproperty, subprop, checkonly, 
&handlers[index], &actions[index]);
+               if (rc != Success)
+                       return rc;
        }
 
        return Success;
-- 
1.8.1.1


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to