idlehomescreen/xmluirendering/uiengine/src/xngesturehelper.cpp
branchRCL_3
changeset 17 b8fae6b8a148
parent 12 9674c1a575e9
--- a/idlehomescreen/xmluirendering/uiengine/src/xngesturehelper.cpp	Mon Mar 15 12:39:47 2010 +0200
+++ b/idlehomescreen/xmluirendering/uiengine/src/xngesturehelper.cpp	Wed Mar 31 21:17:19 2010 +0300
@@ -251,34 +251,18 @@
             // Also, while stylus down, the same event is received repeatedly
             // even if stylus does not move. Filter out by checking if point
             // is the same as the latest point
-            if ( iDirection != EGestureCanceled )
+            iDirection = iGesture->LastDirection( CXnGesture::EAxisHorizontal );
+            
+            if ( !IsIdle() && !iGesture->IsLatestPoint( Position( aEvent ) ) )
                 {
-                if ( iDirection == EGestureUnknown )
-                    {
-                    // check current direction
-                    iDirection = iGesture->CodeFromPoints( CXnGesture::EAxisBoth );
-                    }
-                else
+                AddPointL( aEvent );
+                if ( !( iGesture->IsHolding() ||
+                        iGesture->IsNearHoldingPoint( Position( aEvent ) ) ) )
                     {
-                    // check if direction has changed
-                    if ( iDirection != iGesture->LastDirection( CXnGesture::EAxisBoth ) )
-                        {
-                        // cancel swipe
-                        iDirection = EGestureCanceled;
-                        }
-                    }
-                
-                if ( !IsIdle() && !iGesture->IsLatestPoint( Position( aEvent ) ) )
-                    {
-                    AddPointL( aEvent );
-                    if ( !( iGesture->IsHolding() ||
-                            iGesture->IsNearHoldingPoint( Position( aEvent ) ) ) )
-                        {
-                        // restart hold timer, since pointer has moved
-                        iHoldingTimer->Start();
-                        // Remember the point in which holding was started
-                        iGesture->SetHoldingPoint();
-                        }
+                    // restart hold timer, since pointer has moved
+                    iHoldingTimer->Start();
+                    // Remember the point in which holding was started
+                    iGesture->SetHoldingPoint();
                     }
                 }
             break;
@@ -293,27 +277,24 @@
                 // observer leaves
                 CleanupStack::PushL( TCleanupItem( &ResetHelper, this ) );
                 iGesture->SetComplete();
-                if ( iDirection != EGestureCanceled )
+                // if adding of the point fails, notify client with a
+                // cancelled event. It would be wrong to send another
+                // gesture code when the up point is not known
+                if ( AddPoint( aEvent ) != KErrNone )
                     {
-                    // if adding of the point fails, notify client with a
-                    // cancelled event. It would be wrong to send another
-                    // gesture code when the up point is not known
-                    if ( AddPoint( aEvent ) != KErrNone )
-                        {
-                        iGesture->SetCancelled();
-                        }
-                    else
+                    iGesture->SetCancelled();
+                    }
+                else
+                    {
+                    // send gesture code if holding has not been started
+                    if ( !iGesture->IsHolding() )
                         {
-                        // send gesture code if holding has not been started
-                        if ( !iGesture->IsHolding() )
-                            {
-                            // if client leaves, the state is automatically reset.
-                            // In this case the client will not get the released event
-                            ret = iDirection;
-                            }
-                        // send an event that stylus was lifted
-                        iGesture->SetReleased();
+                        // if client leaves, the state is automatically reset.
+                        // In this case the client will not get the released event
+                        ret = iDirection;
                         }
+                    // send an event that stylus was lifted
+                    iGesture->SetReleased();
                     }
                 // reset state
                 CleanupStack::PopAndDestroy( this );