Prior to commit 61f6a7c, the value of oldState.proximity
was not set by wcmUpdateOldState. Rather, when a tool
entered proximity, the proximity flag would be explicitly
set only after the call to wcmSend(Non)PadEvents was
complete. This ensured that the condition where the pen
has just entered prox would be properly detected.

Since the aforementioned commit copies the value of ds
(whose proximity flag is set) to oldState, issues related
to the enter-prox condition have appeared. This is most
noticable in GIMP, which has trouble switching tools.

To resolve this issue, we remove the explicit setting of
oldState.proximity (which is now implicitly handled by
the call to wcmUpdateOldState after wcmSend(Non)PadEvents
finishes) and add in an explicit clearing of the same
prior to the call. In this way, it acts the same as
oldState.buttons which must also be cleared upon entering
prox to properly detect presses.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmCommon.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 65b0fe4..6dfcba4 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -685,10 +685,14 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
                x, y, z, v3, v4, v5, v6, id, serial,
                is_button ? "true" : "false", ds->buttons);
 
-       /* update the old records */
+       /* when entering prox, replace the zeroed-out oldState with a copy of
+        * the current state to prevent jumps. reset the prox and button state
+        * to zero to properly detect changes.
+        */
        if(!priv->oldState.proximity)
        {
                wcmUpdateOldState(pInfo, ds, x, y);
+               priv->oldState.proximity = 0;
                priv->oldState.buttons = 0;
        }
 
@@ -708,7 +712,6 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
                        wcmSendNonPadEvents(pInfo, ds, 0, priv->naxes, 
valuators);
        }
 
-       priv->oldState.proximity = ds->proximity;
        if (ds->proximity)
                wcmUpdateOldState(pInfo, ds, x, y);
        else
-- 
1.9.3


------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to