Revision: 201003 default PDK_3.0.g
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 00:56:45 +0200
changeset 28 d39add9822e2
parent 27 6297cdf66332
child 32 ea4b2e4f7cac
Revision: 201003 Kit: 201005
brdo.layers.sysdef.xml
browserutilities/browserdialogsprovider/Src/BrowserSelectElementDlg.cpp
browserutilities/browserdialogsprovider/Src/BrowserViewImagesPopup.cpp
browserutilities/connectionmanager/Group/ConnectionManager.mmp
browserutilities/connectionmanager/Src/ConnManActiveConnector.cpp
browserutilities/connectionmanager/Src/InternetConnectionManager.cpp
browserutilities/downloadmgr/DownloadMgrServEng/Group/HttpDMServEng.mmp
browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp
browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpStorage.cpp
browserutilities/downloadmgr/DownloadMgrUiLib/Data/DownloadMgrUiLib.rss
browserutilities/downloadmgr/DownloadMgrUiLib/Group/DownloadMgrUiLib.mmp
browserutilities/downloadmgr/DownloadMgrUiLib/Inc/CDownloadsListDlg.h
browserutilities/downloadmgr/DownloadMgrUiLib/Inc/DownloadMgrUiLib.hrh
browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiDownloadsList.cpp
browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListDlg.cpp
browserutilities/downloadmgr/DownloadMgrUiLib/loc/DownloadMgrUiLib.loc
browserutilities/downloadmgr/downloadmgruilib/Inc/CDownloadsStylusPopupMenu.h
browserutilities/downloadmgr/downloadmgruilib/Src/CDownloadsStylusPopupMenu.cpp
browserutilities/webutils/conf/webutils.confml
codhandler/codeng/group/CodEng.mmp
codhandler/codeng/src/Connection.cpp
web_plat/browser_platform_api/inc/Browser_platform_variant.hrh
web_plat/group/bld.inf
web_plat/rt_gesturehelper_api/group/bld.inf
web_plat/rt_gesturehelper_api/inc/rt_gesturehelper.h
web_plat/rt_gesturehelper_api/inc/rt_gestureobserver.h
web_plat/rt_gesturehelper_api/rt_gesturehelper_api.metaxml
web_plat/stmgesturefw_api/group/bld.inf
web_plat/stmgesturefw_api/inc/rt_gesturehelper.h
web_plat/stmgesturefw_api/inc/rt_gestureif.h
web_plat/stmgesturefw_api/inc/rt_gesturelistener.h
web_plat/stmgesturefw_api/inc/rt_gestureobserver.h
web_plat/stmgesturefw_api/inc/rt_uievent.h
web_plat/stmgesturefw_api/inc/stmgestureinterface.h
web_plat/stmgesturefw_api/inc/stmgesturelistener.h
web_plat/stmgesturefw_api/stmgesturefw_api.metaxml
web_pub/download_mgr_ui_api/inc/CDownloadMgrUiDownloadsList.h
web_pub/download_mgr_ui_api/inc/DownloadsListDlgObserver.h
web_pub/favourites_engine_api/tsrc/inc/FavouritesEngineTest.h
web_pub/favourites_engine_api/tsrc/src/FavouritesEngineTest.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesItemTestCases.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesWapApTestCases.cpp
webengine/osswebengine/MemoryManager/Src/MemoryPool.cpp
webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.cpp
webengine/osswebengine/WebKit/s60/formcontrols/WebFormFillPopup.cpp
webengine/osswebengine/WebKit/s60/group/browserengine/browserengine.mmp
webengine/osswebengine/WebKit/s60/group/webkit/webkit.mmp
webengine/osswebengine/WebKit/s60/plugins/PluginSkin.cpp
webengine/osswebengine/WebKit/s60/plugins/PluginStream.cpp
webengine/osswebengine/WebKit/s60/plugins/PluginStream.h
webengine/osswebengine/WebKit/s60/plugins/PluginStreamLoaderClient.cpp
webengine/osswebengine/WebKit/s60/plugins/PluginStreamLoaderClient.h
webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp
webengine/osswebengine/WebKit/s60/plugins/PluginWin.h
webengine/osswebengine/WebKit/s60/webview/BrCtl.cpp
webengine/osswebengine/WebKit/s60/webview/BrCtl.h
webengine/osswebengine/WebKit/s60/webview/PageView.cpp
webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.h
webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.cpp
webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.h
webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.cpp
webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.h
webengine/osswebengine/WebKit/s60/webview/WebScrollingDeceleratorGH.cpp
webengine/osswebengine/WebKit/s60/webview/WebScrollingDeceleratorGH.h
webengine/osswebengine/WebKit/s60/webview/WebTextFormatMask.cpp
webengine/osswebengine/WebKit/s60/webview/WebView.cpp
webengine/osswebengine/WebKit/s60/webview/WebView.h
webengine/osswebengine/webkit/s60/webview/WebGestureInterface.cpp
webengine/osswebengine/webkit/s60/webview/WebGestureInterface.h
webengine/osswebengine/webkit/s60/webview/WebPagePinchZoomHandler.cpp
webengine/osswebengine/webkit/s60/webview/WebPagePinchZoomHandler.h
webengine/webkitutils/group/bld.inf
webengine/webkitutils/rt_gesturehelper/bwins/rt_gesturehelperu.def
webengine/webkitutils/rt_gesturehelper/eabi/rt_gesturehelperu.def
webengine/webkitutils/rt_gesturehelper/group/bld.inf
webengine/webkitutils/rt_gesturehelper/group/rt_gesturehelper.mmp
webengine/webkitutils/rt_gesturehelper/rom/rt_gesturehelper.iby
webengine/webkitutils/rt_gesturehelper/src/gesture.cpp
webengine/webkitutils/rt_gesturehelper/src/gesture.h
webengine/webkitutils/rt_gesturehelper/src/gesturedefs.h
webengine/webkitutils/rt_gesturehelper/src/gestureevent.h
webengine/webkitutils/rt_gesturehelper/src/gestureeventfilter.cpp
webengine/webkitutils/rt_gesturehelper/src/gestureeventfilter.h
webengine/webkitutils/rt_gesturehelper/src/gesturehelper.cpp
webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.cpp
webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.h
webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.cpp
webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.h
webengine/webkitutils/rt_gesturehelper/src/gesturerecogniser.cpp
webengine/webkitutils/rt_gesturehelper/src/gesturerecogniser.h
webengine/webkitutils/rt_gesturehelper/src/pointarray.cpp
webengine/webkitutils/rt_gesturehelper/src/pointarray.h
webengine/webkitutils/rt_gesturehelper/src/utils.cpp
webengine/webkitutils/rt_gesturehelper/src/utils.h
webengine/webkitutils/stmgesturefw/bwins/stmgesturefwu.def
webengine/webkitutils/stmgesturefw/eabi/stmgesturefwu.def
webengine/webkitutils/stmgesturefw/group/bld.inf
webengine/webkitutils/stmgesturefw/group/stmgesturefw.mmp
webengine/webkitutils/stmgesturefw/inc/callbacktimer.h
webengine/webkitutils/stmgesturefw/inc/edgescrollgesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/filelogger.h
webengine/webkitutils/stmgesturefw/inc/flickgesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/genericsimplegesture.h
webengine/webkitutils/stmgesturefw/inc/gesturedefs.h
webengine/webkitutils/stmgesturefw/inc/gestureengine.h
webengine/webkitutils/stmgesturefw/inc/gestureframework.h
webengine/webkitutils/stmgesturefw/inc/gestureframeworkimpl.h
webengine/webkitutils/stmgesturefw/inc/gesturehelpereventsender.h
webengine/webkitutils/stmgesturefw/inc/hoveringgesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/leftrightgesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/longpressgesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/pangesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/pinchgesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/releasegesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/rt_gestureengineif.h
webengine/webkitutils/stmgesturefw/inc/rt_gesturelistener.h
webengine/webkitutils/stmgesturefw/inc/stateengine.h
webengine/webkitutils/stmgesturefw/inc/stateengineconfiguration.h
webengine/webkitutils/stmgesturefw/inc/statemachine.h
webengine/webkitutils/stmgesturefw/inc/statemachine_v2.h
webengine/webkitutils/stmgesturefw/inc/tapgesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/timerinterface.h
webengine/webkitutils/stmgesturefw/inc/touchgesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/uievent.h
webengine/webkitutils/stmgesturefw/inc/uieventsender.h
webengine/webkitutils/stmgesturefw/inc/unknowngesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/updowngesturerecogniser.h
webengine/webkitutils/stmgesturefw/inc/utils.h
webengine/webkitutils/stmgesturefw/inc/zoomgesturerecogniser.h
webengine/webkitutils/stmgesturefw/rom/stmgesturefw.iby
webengine/webkitutils/stmgesturefw/sis/backup_registration.xml
webengine/webkitutils/stmgesturefw/src/UiEvent.cpp
webengine/webkitutils/stmgesturefw/src/edgescrollgesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/filelogger.cpp
webengine/webkitutils/stmgesturefw/src/flickgesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/genericsimplegesture.cpp
webengine/webkitutils/stmgesturefw/src/gestureengine.cpp
webengine/webkitutils/stmgesturefw/src/gestureframework.cpp
webengine/webkitutils/stmgesturefw/src/gestureframeworkimpl.cpp
webengine/webkitutils/stmgesturefw/src/gesturehelpereventsender.cpp
webengine/webkitutils/stmgesturefw/src/hoveringgesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/leftrightgesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/longpressgesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/pangesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/pinchgesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/releasegesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/stateengine.cpp
webengine/webkitutils/stmgesturefw/src/stateengineconfiguration.cpp
webengine/webkitutils/stmgesturefw/src/statemachine.cpp
webengine/webkitutils/stmgesturefw/src/stmgestureinterface.cpp
webengine/webkitutils/stmgesturefw/src/tapgesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/touchgesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/uieventsender.cpp
webengine/webkitutils/stmgesturefw/src/unknowngesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/updowngesturerecogniser.cpp
webengine/webkitutils/stmgesturefw/src/utils.cpp
webengine/webkitutils/stmgesturefw/src/zoomgesturerecogniser.cpp
webengine/widgetinstaller/Inc/WidgetBackupRegistryXml.h
webengine/widgetinstaller/Src/WidgetBackupRegistryXml.cpp
webengine/widgetregistry/Server/inc/WidgetMMCHandler.h
webengine/widgetregistry/Server/src/WidgetMMCHandler.cpp
webengine/wmlengine/src/xhtml/src/Image/ImageMapPopup.cpp
webengine/wrtharvester/inc/wrtusbhandler.h
webengine/wrtharvester/rom/wrtharvesterResources.iby
webengine/wrtharvester/src/wrtharvesterpsnotifier.cpp
webengine/wrtharvester/src/wrtusbhandler.cpp
widgets/widgetapp/group/WidgetUi.mmp
widgets/widgetapp/inc/WidgetUiNetworkListener.h
widgets/widgetapp/src/WidgetUiNetworkListener.cpp
widgets/widgetapp/src/WidgetUiWindowManager.cpp
widgets/widgetsidchecker/data/10281FC0.rss
widgets/widgetsidchecker/group/widgetsidchecker.mmp
widgets/widgetsidchecker/src/widgetsidchecker.cpp
--- a/brdo.layers.sysdef.xml	Mon Jan 18 21:20:18 2010 +0200
+++ b/brdo.layers.sysdef.xml	Tue Feb 02 00:56:45 2010 +0200
@@ -17,7 +17,7 @@
         <unit unitID="feeds_engine_api" name="feeds_engine_api" bldFile="&layer_real_source_path;/web_plat/feeds_engine_api/group" mrp=""/>        
         <unit unitID="launcher_api" name="launcher_api" bldFile="&layer_real_source_path;/web_plat/launcher_api/group" mrp=""/>                  
         <unit unitID="recent_url_store_api" name="recent_url_store_api" bldFile="&layer_real_source_path;/web_plat/recent_url_store_api/group" mrp=""/>    
-        <unit unitID="rt_gesturehelper_api" name="rt_gesturehelper_api" bldFile="&layer_real_source_path;/web_plat/rt_gesturehelper_api/group" mrp=""/>    
+        <unit unitID="stmgesturefw_api" name="stmgesturefw_api" bldFile="&layer_real_source_path;/web_plat/stmgesturefw_api/group" mrp=""/>    
         <unit unitID="scriptable_plugin_api" name="scriptable_plugin_api" bldFile="&layer_real_source_path;/web_plat/scriptable_plugin_api/group" mrp=""/>            
         <unit unitID="webutils_api" name="webutils_api" bldFile="&layer_real_source_path;/web_plat/webutils_api/group" mrp=""/>                    
         <unit unitID="widget_registry_api" name="widget_registry_api" bldFile="&layer_real_source_path;/web_plat/widget_registry_api/group" mrp=""/>                         
--- a/browserutilities/browserdialogsprovider/Src/BrowserSelectElementDlg.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/browserdialogsprovider/Src/BrowserSelectElementDlg.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -18,6 +18,7 @@
 
 
 // INCLUDE FILES
+#include <browser_platform_variant.hrh>
 #include "BrowserSelectElementDlg.h"
 #include "BrowserSelectElementListBox.h"
 #include "BrowserSelectElementModel.h"
@@ -185,7 +186,11 @@
     
     if(AknLayoutUtils::PenEnabled())
         {
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
+        if((aEventType == EEventItemDoubleClicked) || (aEventType == EEventItemSingleClicked))
+#else            
         if(aEventType == EEventItemDoubleClicked)
+#endif            
             {
             penSelect = ETrue;
             }
--- a/browserutilities/browserdialogsprovider/Src/BrowserViewImagesPopup.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/browserdialogsprovider/Src/BrowserViewImagesPopup.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -19,6 +19,7 @@
 
 
 // USER INCLUDES
+#include <browser_platform_variant.hrh>
 #include <browserdialogsprovider.h>
 #include "BrowserDialogsProvider.hrh"
 #include "BrowserViewImagesPopup.h"
@@ -140,7 +141,11 @@
 void CBrowserViewImagesPopup::HandleListBoxEventL( CEikListBox* aListBox, 
                                                     TListBoxEvent aEventType )
     {
-    if((aEventType==EEventEnterKeyPressed || aEventType==EEventItemDoubleClicked) && aListBox==ListBox())
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF      
+    if((aEventType==EEventEnterKeyPressed || aEventType==EEventItemDoubleClicked || aEventType==EEventItemSingleClicked) && aListBox==ListBox())
+#else
+    if((aEventType==EEventEnterKeyPressed || aEventType==EEventItemDoubleClicked ) && aListBox==ListBox())
+#endif        
         {
         ProcessCommandL( EDialogsProviderCmdViewImagesView );
         }
--- a/browserutilities/connectionmanager/Group/ConnectionManager.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/connectionmanager/Group/ConnectionManager.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -79,6 +79,12 @@
 LIBRARY     cmmanager.lib
 DEBUGLIBRARY    flogger.lib
 
+//Below libs are required for One-Click-Connectivity feature
+#ifdef BRDO_OCC_ENABLED_FF
+LIBRARY    extendedconnpref.lib
+LIBRARY    netmeta.lib
+#endif
+
 #if defined(ARMCC)
     DEFFILE ../EABI/CONNECTIONMANAGERU_EKA2.def
 #else
--- a/browserutilities/connectionmanager/Src/ConnManActiveConnector.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/connectionmanager/Src/ConnManActiveConnector.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -19,13 +19,17 @@
 */
 
 
-
+#include <browser_platform_variant.hrh>
 #include "ConnManActiveConnector.h"
 #include "ConnectionManagerLogger.h"
 
 #include <nifvar.h>
 #include <CommDbConnPref.h>
 
+#ifdef BRDO_OCC_ENABLED_FF
+#include <extendedconnpref.h>
+#endif
+
 //--------------------------------------------------------------------------
 //CConnManActiveConnector::CConnManActiveConnector()
 //--------------------------------------------------------------------------
@@ -34,7 +38,7 @@
     : CActive( aPriority )
     , iConnection( aConnection )
 	{
-    iWait = EFalse;
+    
 	CLOG_CREATE;
 	CActiveScheduler::Add( this );//inserting this into the queue
 	}
@@ -44,7 +48,7 @@
 //--------------------------------------------------------------------------
 CConnManActiveConnector::~CConnManActiveConnector()
 	{
-    iWait = EFalse;
+    
 	Cancel();//The standard way of destroying an Active object
 	CLOG_CLOSE;
 	}
@@ -53,18 +57,55 @@
 //CConnManActiveConnector::StartConnection()
 //--------------------------------------------------------------------------
 void CConnManActiveConnector::StartConnection( TCommDbConnPref* aSettings, TRequestStatus& aStatus)
-	{
-	CLOG_WRITE( "CConnManActiveConnector:StartConnection is called");
-	iExternalRequestStatus = &aStatus;
-	
+{
+    CLOG_WRITE( "CConnManActiveConnector:StartConnection AlwaysAsk/Ap is called");
+    iExternalRequestStatus = &aStatus;
+
+#ifdef BRDO_OCC_ENABLED_FF
+
+    TExtendedConnPref extPref;
+    CLOG_WRITE( "CConnManActiveConnector:StartConnection Setting OCC parameters");
+
+#ifdef __WINS__ //This is only for emulator testing purpose
+
+    //For emulator
+    CLOG_WRITE( "CConnManActiveConnector:StartConnection Emulator OCC settings " );
+    extPref.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+    extPref.SetConnSelectionDialog(ETrue);
+    extPref.SetForcedRoaming(EFalse);
+
+#else
+
+    //For hardware
+    TUint32 bookmarkIap = aSettings->IapId();
+    CLOG_WRITE_1( "CConnManActiveConnector:StartConnection Active Bookmark Iap: %d", bookmarkIap );
+    if (bookmarkIap)
+    {
+       CLOG_WRITE( "CConnManActiveConnector:StartConnection Iap is found for this bookmark");
+       extPref.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+       extPref.SetIapId(bookmarkIap);
+    }
+    else
+    {
+       CLOG_WRITE( "CConnManActiveConnector:StartConnection Using Internet Snap");
+       extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet);
+    }
+
+#endif //__WINS__   
+
+    extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault);
+    TConnPrefList prefList;
+    TRAP_IGNORE(prefList.AppendL(&extPref));
+#endif //BRDO_OCC_ENABLED_FF
+
     if( aSettings )
-        {
-#ifdef __WINS__
-     //  aSettings->SetDialogPreference( ECommDbDialogPrefPrompt );
-#endif
-
-	    iConnection.Start( *aSettings, iStatus );
-        }
+    {
+      #ifdef BRDO_OCC_ENABLED_FF
+        iConnection.Start( prefList, iStatus );
+      #else
+        iConnection.Start( *aSettings, iStatus );
+      #endif
+    }
     else
         {
         iConnection.Start( iStatus );
@@ -79,14 +120,45 @@
 //CConnManActiveConnector::StartConnection()
 //--------------------------------------------------------------------------
 void CConnManActiveConnector::StartConnection( TConnSnapPref* aSettings, TRequestStatus& aStatus)
-	{
-	CLOG_WRITE( "CConnManActiveConnector:StartConnection is called");
-	iExternalRequestStatus = &aStatus;
-	
+{
+    CLOG_WRITE( "CConnManActiveConnector:StartConnection SNAP is called");
+    iExternalRequestStatus = &aStatus;
+
+#ifdef BRDO_OCC_ENABLED_FF
+
+    CLOG_WRITE( "CConnManActiveConnector:StartConnection Setting OCC parameters");
+    TExtendedConnPref extPref;
+
+#ifdef __WINS__ 
+
+    //For emulator
+    CLOG_WRITE( "CConnManActiveConnector:StartConnection Emulator OCC settings " );
+    extPref.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+    extPref.SetConnSelectionDialog(ETrue);
+    extPref.SetForcedRoaming(EFalse);
+
+#else
+    
+    //For hardware
+    CLOG_WRITE( "CConnManActiveConnector:StartConnection Using Internet Snap");
+    extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet);
+
+#endif //__WINS__
+
+    extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault);
+    TConnPrefList prefList;
+    TRAP_IGNORE(prefList.AppendL(&extPref));
+
+#endif
+
     if( aSettings )
-        {
-	    iConnection.Start( *aSettings, iStatus );
-        }
+    {
+      #ifdef BRDO_OCC_ENABLED_FF
+        iConnection.Start( prefList, iStatus );
+      #else
+        iConnection.Start( *aSettings, iStatus );
+      #endif
+    }
     else
         {
         iConnection.Start( iStatus );
@@ -103,11 +175,10 @@
 void CConnManActiveConnector::DoCancel()
 	{
 	CLOG_WRITE( "CConnManActiveConnector: DoCancel called");
-    if(iWait)
-        {
-        iConnection.Close();
-        User::RequestComplete( iExternalRequestStatus, KErrCancel );//completing user req
-        }
+    
+	iConnection.Close();
+	User::RequestComplete( iExternalRequestStatus, KErrCancel );//completing user req
+    
 	CLOG_WRITE( "CConnManActiveConnector: DoCancel returned");
 	}
 
@@ -116,7 +187,7 @@
 //--------------------------------------------------------------------------
 void CConnManActiveConnector::RunL()
 	{
-    iWait = ETrue;
+    
     CLOG_WRITE_1( "CConnManAct::RunL(): %d", iStatus.Int() );
 	User::RequestComplete( iExternalRequestStatus, iStatus.Int() );
 	}
@@ -200,14 +271,12 @@
 //--------------------------------------------------------------------------
 void CActiveConnectorSyncWrapper::DoCancel()
 	{
-    if(iActiveConnector->IsActive())
-        {
-        iActiveConnector->Cancel();
-        }
-	if(iWait.IsStarted())
-	  {
-	   iWait.AsyncStop();	
-	  }
+    
+    iActiveConnector->Cancel();
+   	if(iWait.IsStarted())
+	{
+	  iWait.AsyncStop();	
+	}
 	
 	}
 
--- a/browserutilities/connectionmanager/Src/InternetConnectionManager.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/connectionmanager/Src/InternetConnectionManager.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -641,7 +641,7 @@
 EXPORT_C void CInternetConnectionManager::StopConnectionL()
 	{
     CLOG_ENTERFN( "StopConnectionL()" );
-    CancelConnection();
+
     StopConnectionObserving();
     iConnection.Close();
 //    iServ.Close();
--- a/browserutilities/downloadmgr/DownloadMgrServEng/Group/HttpDMServEng.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Group/HttpDMServEng.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -97,4 +97,9 @@
 LIBRARY     DcfRep.lib
 LIBRARY     FeatMgr.lib
 
+#ifdef BRDO_OCC_ENABLED_FF
+LIBRARY    extendedconnpref.lib
+LIBRARY    netmeta.lib
+#endif
+
 // End of File
--- a/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -32,6 +32,10 @@
 #include <cdblen.h>
 //#include <deflatefilterinterface.h>
 #include <cookiefilterinterface.h>
+#include <platform/mw/browser_platform_variant.hrh>
+#ifdef BRDO_OCC_ENABLED_FF
+#include <extendedconnpref.h>
+#endif
 
 // EXTERNAL DATA STRUCTURES
 //extern  ?external_data;
@@ -286,6 +290,9 @@
     iHttpSession.OpenL();
     CLOG_WRITE8( "Session open" );
     InitSessionL();
+
+	//Set it to zero
+	iIapId = 0;
     }
 
 // -----------------------------------------------------------------------------
@@ -378,7 +385,29 @@
                 iPref.SetDialogPreference( ECommDbDialogPrefPrompt );
                 }
 
+        #ifdef BRDO_OCC_ENABLED_FF
+           TExtendedConnPref extPref;
+           CLOG_WRITE( "Setting OCC parameters");
+           CLOG_WRITE_1( "Iap: %d", iIapId );
+           if (iIapId)
+           {
+              CLOG_WRITE( "Iap is found");
+              extPref.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+              extPref.SetIapId(iIapId);
+           }
+           else
+           {
+              CLOG_WRITE( "Using Internet Snap");
+              extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet);
+           }
+
+           extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
+           TConnPrefList prefList;
+           prefList.AppendL(&extPref);
+           iConnection.Start( prefList, iStatus );
+        #else
             iConnection.Start( iPref, iStatus );
+        #endif //BRDO_OCC_ENABLED_FF
 
             // RConnection will complete us.
             doComplete = EFalse;
--- a/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpStorage.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpStorage.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -729,7 +729,7 @@
         			       ( &fs, bytesToWrite ); )
         if(!mmcOk)
         	{
-            iRemovableStatus = TDownloadUiData::EDriveInternal ;
+            iRemovableStatus = KDriveAttInternal ;
         	CLOG_WRITE( "no MMC present" );
         	return EDriveC;
         	}
@@ -740,8 +740,8 @@
         fs.Volume(volInfoE,EDriveE);
         TInt64 freeC = volInfoC.iFree;//free memory available in that drive
         TInt64 freeE = volInfoE.iFree;
-        freeC>=freeE?EDriveC:EDriveE;//put the file in which ever drive has more memory
-        iRemovableStatus = (EDriveC == freeC) ? TDownloadUiData::EDriveInternal : ( TDownloadUiData::EDriveExternallyMountable | TDownloadUiData::EDriveRemovable ) ;
+        freeC = freeE?EDriveC:EDriveE;//put the file in which ever drive has more memory
+        iRemovableStatus = (EDriveC == freeC) ? KDriveAttInternal :  KDriveAttRemovable ;
         return freeC;
 #endif
         }
@@ -861,9 +861,9 @@
     if( !iDownload->ClientApp()->Engine()->Fs().Drive( driveInfo, drive) )
         {
         if (driveInfo.iDriveAtt & KDriveAttRemovable)
-            iRemovableStatus = ( TDownloadUiData::EDriveExternallyMountable | TDownloadUiData::EDriveRemovable ) ;
+            iRemovableStatus =  KDriveAttRemovable ;
         else
-            iRemovableStatus = TDownloadUiData::EDriveInternal ;
+            iRemovableStatus = KDriveAttInternal ;
         CLOG_WRITE_1( "Removable: [%d]", iRemovableStatus );
         }
     else
@@ -1072,9 +1072,9 @@
         if( !iDownload->ClientApp()->Engine()->Fs().Drive( driveInfo, drive) )
             {
             if (driveInfo.iDriveAtt & KDriveAttRemovable)
-            	iRemovableStatus = ( TDownloadUiData::EDriveExternallyMountable | TDownloadUiData::EDriveRemovable ) ;
+            	iRemovableStatus = KDriveAttRemovable ;
             else
-                iRemovableStatus = TDownloadUiData::EDriveInternal ;
+                iRemovableStatus = KDriveAttInternal ;
             CLOG_WRITE_1( "Removable: [%d]", iRemovableStatus );
             }
         else
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Data/DownloadMgrUiLib.rss	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Data/DownloadMgrUiLib.rss	Tue Feb 02 00:56:45 2010 +0200
@@ -20,6 +20,7 @@
 NAME    DMUL
 
 //  INCLUDES
+#include <browser_platform_variant.hrh>
 #include "DownloadMgrUiLib.hrh"
 #include <downloadmgruilib.loc>
 #include <avkon.loc>
@@ -319,7 +320,7 @@
         MENU_TITLE { menu_pane = r_dmul_downloadslist_menu; txt = ""; }
         };
     }
-
+#ifndef BRDO_SINGLE_CLICK_ENABLED_FF
 RESOURCE MENU_PANE r_dmul_downloadslist_menu
     {
     items =
@@ -339,7 +340,25 @@
         MENU_ITEM { command = EDownloadsListCmdCancelAll; txt = qtn_browser_downloads_cancel_all; }
         };
     }
+#else
+RESOURCE MENU_PANE r_dmul_downloadslist_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EDownloadsListCmdResumeAll; txt = qtn_browser_downloads_resume_all; },
+        MENU_ITEM { command = EDownloadsListCmdCancelAll; txt = qtn_browser_downloads_cancel_all; }
+        };
+    }
 
+RESOURCE MENU_PANE r_dmul_aiw_popup
+    {
+    items =
+        {
+        MENU_ITEM { command = EAiwCmdContact; txt = qtn_mg_options_assign_to_contact ;  },
+        MENU_ITEM {command = EAiwCmdRingtone;txt = qtn_mg_options_set_as_rt; }
+        };
+    }
+#endif
 STRUCT DMUL_AIW_INTEREST_MENUPANE_MAPPING_LIST
     {
     STRUCT pairs[];
@@ -363,6 +382,22 @@
     {
     items=
         {
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF                
+        AIW_CRITERIA_ITEM
+            {
+            id = EAiwCmdRingtone;
+            serviceCmd = KAiwCmdAssign;
+            contentType = "*";
+            serviceClass = KAiwClassMenu;
+            },
+        AIW_CRITERIA_ITEM
+           {
+           id = EAiwCmdContact;
+           serviceCmd = KAiwCmdAssign;
+           contentType = "*";
+           serviceClass = KAiwClassMenu;
+           }
+#else
         AIW_CRITERIA_ITEM
             {
             id = EDownloadsListCmdUseAs;
@@ -370,6 +405,7 @@
             contentType = "*";
             serviceClass = KAiwClassMenu;
             }
+#endif            
         };
     }
 
@@ -380,7 +416,11 @@
         DMUL_AIW_INTEREST_MENUPANE_PAIR
             {
             interest = r_dmul_aiw_use_as_interest;
+#ifdef  BRDO_SINGLE_CLICK_ENABLED_FF       
+            menupane = r_dmul_aiw_popup;
+#else
             menupane = r_dmul_downloadslist_menu;
+#endif            
             }
         };
     }
@@ -490,6 +530,20 @@
         };
     }
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+RESOURCE STYLUS_POPUP_MENU r_stylus_long_tap_popup_dl_menu
+    {       
+    items =     
+        {
+        STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_downloads_delete; command = EDownloadsListCmdDelete;},
+        STYLUS_POPUP_MENU_ITEM {  txt = qtn_browser_downloads_set_as_rt; command = EAiwCmdRingtone; },
+        STYLUS_POPUP_MENU_ITEM {  txt =  qtn_browser_downloads_assign_to_contact ; command = EAiwCmdContact ; },
+        STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_downloads_open_file_manager; command = EDownloadsListCmdFileManager;},
+        STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_downloads_cancel_download; command = EDownloadsListCmdCancel;},
+        STYLUS_POPUP_MENU_ITEM { txt = qtn_browser_downloads_resume; command = EDownloadsListCmdResume;}
+        };
+    }
+#endif    
 // End of File
 
 
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Group/DownloadMgrUiLib.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Group/DownloadMgrUiLib.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -62,6 +62,7 @@
 USERINCLUDE     ../../DownloadMgrClntSrv/inc
 
 MW_LAYER_SYSTEMINCLUDE
+
 #if defined(__PLATFORM_VERSION_50_TUBE__) || defined( __PLATFORM_VERSION_50__)
 APP_LAYER_SYSTEMINCLUDE
 #endif
@@ -81,6 +82,9 @@
 SOURCE          DMgrUiLibPanic.cpp
 SOURCE          ProgressInfoCreator.cpp
 SOURCE          UserInteractionsEventHandler.cpp
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF 
+SOURCE          CDownloadsStylusPopupMenu.cpp
+#endif
 
 LIBRARY         AKNNOTIFY.lib
 LIBRARY         AknNotifyPlugin.lib
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Inc/CDownloadsListDlg.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Inc/CDownloadsListDlg.h	Tue Feb 02 00:56:45 2010 +0200
@@ -24,7 +24,7 @@
 #include <e32base.h>
 #include <eikmobs.h>
 #include <aknPopup.h>
-
+#include <browser_platform_variant.hrh>
 // DATA TYPES
 enum TDownloadsListDlgEvent
     {
@@ -41,6 +41,9 @@
 class MDownloadsListDlgObserver;
 class RHttpDownload;
 class CDownloadUtils;
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+class CDlStylusPopupMenu;
+#endif
 
 // CONSTANTS
 /// Refresh timer setting. If this is zero, no timer is used! (Micro is 10^(-6))
@@ -132,7 +135,10 @@
         void ProcessCommandL( TInt aCommandId );
         void SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis );
         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+        CDownloadsListArray* DownloadsListArray(){ return iDownloadsListArray;} 
+        void AddAiwItemsL();
+#endif        
     public: // from MEikListBoxObserver
     	void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
 
@@ -201,6 +207,10 @@
         CDownloadUtils* iDownloadUtils; ///< Owned. 
         TBool iIsMSKChangeHandled;
 		TBool iProgressiveDownload;
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+		CDlStylusPopupMenu *iStylusMenu;
+		TPointerEvent iPointerEvent;
+#endif
     };
 
 #endif /* CDOWNLOADSLISTDLG_H */
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Inc/DownloadMgrUiLib.hrh	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Inc/DownloadMgrUiLib.hrh	Tue Feb 02 00:56:45 2010 +0200
@@ -54,6 +54,14 @@
     EAIWPluginSubMenu 	=  0x7000
     };
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+enum TAiwCommandId    // pls dont modify these values.
+    {
+    EAiwCmdRingtone = 0x6025,
+    EAiwCmdContact = 0x6026
+    };
+#endif
+
 #endif /* DOWNLOADMGRUILIB_HRH */
 
 // End of File
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiDownloadsList.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiDownloadsList.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -1999,7 +1999,27 @@
 	            
 	            if ( cancelled )
 	                {
-	                DeleteDownloadL( currDownload );
+                    DeleteDownloadL( currDownload );
+                    
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF     
+                    TInt currentItemIndex = aDialog.CurrentItemIndex();
+                    if (currentItemIndex != -1)
+                        {   
+                        TInt Inprogress = iListModel->DownloadsCount
+                                      ( MASKED_DL_STATE(EHttpDlCreated) |
+                                        MASKED_DL_STATE(EHttpDlPaused) |
+                                        MASKED_DL_STATE(EHttpDlInprogress) |
+                                        MASKED_DL_STATE(EHttpDlMultipleMOFailed));
+                        if ( Inprogress > 1 )
+                            {
+                            aDialog.ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, ETrue );
+                            } 
+                        else
+                            {
+                            aDialog.ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
+                            }
+                        }
+#endif                    
 	                }
 	            iIsCancelInProgress = EFalse;
             	}
@@ -2251,7 +2271,8 @@
         CDocumentHandler* docHandler = CDocumentHandler::NewLC();
         canProgHandled = docHandler->CanHandleProgressivelyL( dataType, pdPlayerUid );
         CleanupStack::PopAndDestroy( docHandler ); // docHandler              
-                
+
+#ifndef BRDO_SINGLE_CLICK_ENABLED_FF        
         //delete open file manager when download is not complete
         if( !(isCompleted))
             {
@@ -2386,9 +2407,33 @@
                 {
                 aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager );
                 }
-       	    }
+            }
+#else
+    // Count paused downloads. Note that Creates and Failed downloads 
+            // are also considered as Paused, and they can be resumed.
+            TInt pausedCount = iListModel->DownloadsCount
+                               ( MASKED_DL_STATE(EHttpDlCreated) |
+                                 MASKED_DL_STATE(EHttpDlPaused) |
+                                 MASKED_DL_STATE(EHttpDlMultipleMOFailed) );
+            CLOG_WRITE_FORMAT(" paused count: %d",pausedCount);
+            //
+            if ( !( 1 < pausedCount ) )
+                {
+                aMenuPane->DeleteMenuItem( EDownloadsListCmdResumeAll );
+                } 
+                
+            TInt downloadCount = iListModel->DownloadsCount
+                                 ( MASKED_DL_STATE(EHttpDlCreated) |
+                                   MASKED_DL_STATE(EHttpDlInprogress)|
+                                   MASKED_DL_STATE(EHttpDlPaused) );
+            CLOG_WRITE_FORMAT(" download count: %d",downloadCount);
+            
+            if ( !( 1 < downloadCount ) )
+                {
+                aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll );
+                }              
+#endif          
         }
-        
     if ( wasCompleted && !isThemeType ) 
         {
         InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload );		
@@ -2396,6 +2441,17 @@
     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::DynInitMenuPaneL");
     }
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+void CDownloadMgrUiDownloadsList::AIWPlugInMenusL(TInt aResourceId,CEikMenuPane* aMenuPane)
+    {
+    if( !iAIWServiceHandler )
+        {
+        AttachAIWInterestL();
+        }
+    RHttpDownload& currDownload = iListModel->Download( 0 );
+    InitializeAIWPlugInMenusL( aResourceId, aMenuPane, currDownload );  
+    }
+#endif
 // -----------------------------------------------------------------------------
 // CDownloadMgrUiDownloadsList::OfferKeyEventL
 // -----------------------------------------------------------------------------
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListDlg.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListDlg.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -33,7 +33,10 @@
 #include    <StringLoader.h>
 #include    <eikenv.h>
 #include    <DocumentHandler.h>
-
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+#include  "CDownloadsStylusPopupMenu.h"
+#define   pixelOffset   36
+#endif
 #include "eikon.hrh"
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -107,6 +110,9 @@
 
     iDownloadUtils = CDownloadUtils::NewL();
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF      
+    iStylusMenu = CDlStylusPopupMenu::NewL();
+#endif    
     CLOG_LEAVEFN("CDownloadsListDlg::ConstructL");
     }
 
@@ -155,7 +161,13 @@
     iListBox = NULL;
     delete iDownloadUtils;
     iDownloadUtils = NULL;
-
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
+	 if (iStylusMenu)
+	 	{
+	 		delete iStylusMenu;
+	 		iStylusMenu = NULL;
+	 	}
+#endif    
     CLOG_LEAVEFN("CDownloadsListDlg::~CDownloadsListDlg");
     }
 
@@ -195,6 +207,23 @@
         CLOG_WRITE(" aModel.Count() == 0");
         }
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
+    TInt Inprogress = iDownloadsListArray->DownloadsCount
+                      ( MASKED_DL_STATE(EHttpDlCreated) |
+                        MASKED_DL_STATE(EHttpDlPaused) |
+                        MASKED_DL_STATE(EHttpDlInprogress) |
+                        MASKED_DL_STATE(EHttpDlMultipleMOFailed));
+    
+    if (  Inprogress > 1   )
+        {
+        ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, ETrue );
+        } 
+    else
+        {
+        ButtonGroupContainer()->MakeCommandVisible( EAknSoftkeyOptions, EFalse );
+        }
+#endif       
+   
     CLOG_LEAVEFN("CDownloadsListDlg::SetModelL");
     }
 
@@ -614,6 +643,9 @@
                 break;
                 }
             case MEikListBoxObserver::EEventItemDoubleClicked:
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+            case MEikListBoxObserver::EEventItemSingleClicked:
+#endif			
                 {
                 // If EAknSoftkeyOpen is visible, then we can activate the selected download
                 if (ButtonGroupContainer()->IsCommandVisible(EAknSoftkeyOpen))
@@ -680,6 +712,36 @@
 //
 void CDownloadsListDlg::HandlePointerEventL(const TPointerEvent& aPointerEvent)
     {
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    	
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Down)
+        {
+        iPointerEvent =  aPointerEvent;
+        iStylusMenu->HandlePointerEventL(aPointerEvent, this);
+        }
+    else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+        {
+        iStylusMenu->cancelLongTapL();
+            if(iStylusMenu->islongtapRunning())
+                {
+                iStylusMenu->reSetLongTapFlag();
+                return;
+                }
+        }
+    else if ( aPointerEvent.iType == TPointerEvent::EDrag )
+        {
+        if((Abs(iPointerEvent.iPosition.iX - aPointerEvent.iPosition.iX) > pixelOffset ) ||
+        (Abs(iPointerEvent.iPosition.iY - aPointerEvent.iPosition.iY) > pixelOffset ))
+            {
+            iStylusMenu->cancelLongTapL();
+            if(iStylusMenu->islongtapRunning())
+                {
+                iStylusMenu->reSetLongTapFlag();
+                return;
+                }
+            }
+        }
+#endif    
+    
     CAknPopupList::HandlePointerEventL(aPointerEvent);
     }
 
@@ -915,4 +977,21 @@
     return KErrNone;
     }
 
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+void CDownloadsListDlg::AddAiwItemsL()
+    {
+    iMenuBar->MenuPane()->AddMenuItemsL(R_DMUL_AIW_POPUP);
+    iDlgObserver.AIWPlugInMenusL(R_DMUL_AIW_POPUP,iMenuBar->MenuPane());
+    TInt pos(0);
+    if (iMenuBar->MenuPane()->MenuItemExists(EAiwCmdContact,pos))
+        {
+        iMenuBar->MenuPane()->DeleteMenuItem(EAiwCmdContact);
+        }
+    if (iMenuBar->MenuPane()->MenuItemExists(EAiwCmdRingtone,pos))
+        {
+        iMenuBar->MenuPane()->DeleteMenuItem(EAiwCmdRingtone);
+        }
+        
+    }
+#endif
 /* End of file. */
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/loc/DownloadMgrUiLib.loc	Mon Jan 18 21:20:18 2010 +0200
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/loc/DownloadMgrUiLib.loc	Tue Feb 02 00:56:45 2010 +0200
@@ -402,4 +402,10 @@
 //
 #define qtn_browser_downloads_files_saved "Files Saved"
 
+#define qtn_browser_downloads_set_as_rt               "Set as ringing tone"
+
+#define qtn_browser_downloads_assign_to_contact       "Assign to contact"
+
+
+
 // End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserutilities/downloadmgr/downloadmgruilib/Inc/CDownloadsStylusPopupMenu.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors: Hari and Billa
+*
+* Description:  Stylus Popup Menu Containing Download UI Options
+*
+*/
+
+#ifndef CDlTYLUSPOPUPMENU_H_
+#define CDlTYLUSPOPUPMENU_H_
+
+#include <aknlongtapdetector.h>
+#include <aknstyluspopupmenu.h>
+#include <coecntrl.h>
+#include <coemain.h>
+#include <barsread.h>
+#include <EIKMOBS.H> 
+#include <aknpopup.h>
+#include <CDownloadsListDlg.h>
+class CDownloadsListDlg;
+
+_LIT8(KAudio, "audio/");
+_LIT8(KVideo, "video/");
+_LIT8(KImage, "image/");
+_LIT8(KFlash, "application/x-shockwave-flash");
+_LIT8(Ksdp, "application/sdp");
+_LIT8(Krng, "application/vnd.nokia.ringing-tone");
+_LIT8(Krn, "application/vnd.rn-realmedia");
+_LIT8(Kpn, "application/x-pn-realmedia");
+_LIT8(KSisxContentType, "x-epoc/x-sisx-app");
+
+#define KLONG_TAP_TIMER_DELAY 0.4000000 //0.4 seconds
+
+// CLASS DECLARATION
+class CDlStylusPopupMenu :  public CCoeControl, public MAknLongTapDetectorCallBack, public MEikMenuObserver
+{   
+    public:
+        static CDlStylusPopupMenu* NewL();
+        void ConstructL();
+        void HandlePointerEventL(const TPointerEvent& aPointerEvent,CDownloadsListDlg* view);
+        virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
+        void ProcessCommandL(TInt aCommandId);  
+        void SetEmphasis(CCoeControl* /*aMenuControl*/,TBool /*aEmphasis*/) {   }   
+        void cancelLongTapL();
+        TBool islongtapRunning();
+        void reSetLongTapFlag();
+        ~CDlStylusPopupMenu();
+    
+    private:    
+        CAknLongTapDetector* iLongTapDetector;
+        CAknStylusPopUpMenu* iStylusPopupMenu;  
+        TInt iCount; 
+        TBool ilongtapRunning;
+        CDownloadsListDlg			*iDlView;       
+};
+#endif /* CDlTYLUSPOPUPMENU_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/browserutilities/downloadmgr/downloadmgruilib/Src/CDownloadsStylusPopupMenu.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,155 @@
+/*
+ *  CDlStylusPopupMenu.cpp
+ *
+ *  Created on: Dec 24, 2009
+ *      Author: hari and billa
+ */
+
+#include "CDownloadsStylusPopupMenu.h"
+#include "CDownloadsListDlg.h"
+#include "DownloadMgrUiLib.rsg"
+#include "CDownloadsListArray.h"
+#include "DownloadMgrUilib.hrh"
+
+
+// -----------------------------------------------------------------------------
+// BrowserStylusPopupMenu::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+CDlStylusPopupMenu* CDlStylusPopupMenu::NewL()
+{   
+    CDlStylusPopupMenu* container =
+        new (ELeave) CDlStylusPopupMenu;
+    container->ConstructL();
+    return container;
+}
+
+void CDlStylusPopupMenu::ConstructL()
+{
+    ilongtapRunning = EFalse;
+    iLongTapDetector = CAknLongTapDetector::NewL(this);
+    TResourceReader readerFolder;
+    TResourceReader readerItem;
+}
+
+// -----------------------------------------------------------------------------
+// BrowserStylusPopupMenu::HandlePointerEventL()
+// Called by framework to handle pointer touch events.
+// -----------------------------------------------------------------------------
+//
+void CDlStylusPopupMenu::HandlePointerEventL(const TPointerEvent& aPointerEvent, CDownloadsListDlg *view)
+{    
+    ilongtapRunning = EFalse;
+    iLongTapDetector->SetLongTapDelay(KLONG_TAP_TIMER_DELAY);
+    iLongTapDetector->PointerEventL(aPointerEvent);
+    iLongTapDetector->EnableLongTapAnimation(ETrue);
+    iDlView = view;
+    CCoeControl::HandlePointerEventL(aPointerEvent);
+}
+
+void CDlStylusPopupMenu::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation )
+{    
+    ilongtapRunning = ETrue;
+    TBool isAiwcall = EFalse;
+    if (iStylusPopupMenu)
+        {
+        delete iStylusPopupMenu;
+        iStylusPopupMenu = NULL;
+        iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , aPenEventScreenLocation);
+        }
+    else 
+        {
+        iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , aPenEventScreenLocation);
+        }
+    
+    iStylusPopupMenu->SetPosition(aPenEventScreenLocation, CAknStylusPopUpMenu::EPositionTypeLeftBottom);
+    
+    TResourceReader reader;
+    iCoeEnv->CreateResourceReaderLC(reader,R_STYLUS_LONG_TAP_POPUP_DL_MENU);
+    iStylusPopupMenu->ConstructFromResourceL(reader);
+    TInt currentItemIndex = iDlView->CurrentItemIndex();
+    CDownloadsListArray* DownloadsListArray = iDlView->DownloadsListArray();
+    RHttpDownload& currDownload = DownloadsListArray->Download( currentItemIndex );
+   
+   // Get the UI data for the current download
+   TDownloadUiData& dlData = DownloadsListArray->DlUiData( iDlView->CurrentItemIndex() );
+   TInt32 state( dlData.iDownloadState );
+   HBufC8* contentType = HBufC8::NewLC(KMaxContentTypeLength);
+   TPtr8 contentTypePtr = contentType->Des(); 
+   User::LeaveIfError
+           ( currDownload.GetStringAttribute( EDlAttrContentType, contentTypePtr ) );
+   TInt typeAudio = !contentType->Find(KAudio);
+   CleanupStack::PopAndDestroy( contentType ); 
+             
+    if (state == EHttpDlInprogress)
+        {
+        isAiwcall = ETrue;
+        iStylusPopupMenu->SetItemDimmed(EAiwCmdContact,ETrue);
+        iStylusPopupMenu->SetItemDimmed(EAiwCmdRingtone,ETrue);
+        iStylusPopupMenu->SetItemDimmed(EDownloadsListCmdDelete,ETrue);
+        iStylusPopupMenu->SetItemDimmed(EDownloadsListCmdFileManager,ETrue);
+        iStylusPopupMenu->SetItemDimmed(EDownloadsListCmdResume,ETrue);
+        }
+
+   if ((state == EHttpDlCompleted) || (state ==EHttpDlMultipleMOCompleted))
+       {
+       iStylusPopupMenu->SetItemDimmed(EDownloadsListCmdCancel,ETrue);
+       iStylusPopupMenu->SetItemDimmed(EDownloadsListCmdResume,ETrue);
+       }
+    if (state == EHttpDlPaused)
+        {
+        isAiwcall = ETrue;
+        iStylusPopupMenu->SetItemDimmed(EAiwCmdContact,ETrue);
+        iStylusPopupMenu->SetItemDimmed(EAiwCmdRingtone,ETrue);
+        iStylusPopupMenu->SetItemDimmed(EDownloadsListCmdDelete,ETrue);
+        iStylusPopupMenu->SetItemDimmed(EDownloadsListCmdFileManager,ETrue);
+        }
+   
+    if(typeAudio != 1) //Not an audio type 
+        {
+        isAiwcall = ETrue;
+        iStylusPopupMenu->SetItemDimmed(EAiwCmdContact,ETrue);
+        iStylusPopupMenu->SetItemDimmed(EAiwCmdRingtone,ETrue);
+        }
+    
+    CleanupStack::PopAndDestroy();  
+    if (!isAiwcall)
+        iDlView->AddAiwItemsL();
+    iStylusPopupMenu->ShowMenu(); 
+}
+
+void CDlStylusPopupMenu::ProcessCommandL(TInt aCommand)
+{    
+    iDlView->ProcessCommandL(aCommand);
+}
+
+CDlStylusPopupMenu::~CDlStylusPopupMenu()
+{   
+    if(iLongTapDetector)
+        {
+        delete iLongTapDetector;
+        iLongTapDetector = NULL; 
+        }
+    if(iStylusPopupMenu)
+        {
+        delete iStylusPopupMenu;
+        iStylusPopupMenu = NULL;    
+        }
+}
+
+void CDlStylusPopupMenu::cancelLongTapL()
+{   
+    iLongTapDetector->CancelAnimationL();
+}
+
+TBool CDlStylusPopupMenu::islongtapRunning()
+{
+    return ilongtapRunning;
+}
+
+void CDlStylusPopupMenu::reSetLongTapFlag()
+{
+    ilongtapRunning = EFalse;
+}
+
Binary file browserutilities/webutils/conf/webutils.confml has changed
--- a/codhandler/codeng/group/CodEng.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ b/codhandler/codeng/group/CodEng.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -118,3 +118,7 @@
 
 DEBUGLIBRARY    flogger.lib
 //LIBRARY    flogger.lib
+#ifdef BRDO_OCC_ENABLED_FF
+LIBRARY    extendedconnpref.lib
+LIBRARY    netmeta.lib
+#endif
\ No newline at end of file
--- a/codhandler/codeng/src/Connection.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/codhandler/codeng/src/Connection.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -28,6 +28,10 @@
 #include <CommDbConnPref.h>
 #include <cdblen.h>
 #include <es_enum.h>
+#include <platform/mw/browser_platform_variant.hrh>
+#ifdef BRDO_OCC_ENABLED_FF
+#include <extendedconnpref.h>
+#endif
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -94,7 +98,31 @@
             // aIap == 0 -> user select.
             iConnPref.SetDialogPreference( ECommDbDialogPrefPrompt );
             }
-        iConn.Start( iConnPref, iStatus );
+        #ifdef BRDO_OCC_ENABLED_FF
+           TExtendedConnPref extPref;
+           CLOG(( EConn, 4, _L("CodHalder Setting OCC parameters") ));
+           
+           CLOG(( EConn, 4, _L("Iap: %d"), aIap ));
+           if (aIap)
+           {
+              CLOG(( EConn, 4, _L("Iap is found") ));
+              extPref.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+              extPref.SetIapId(aIap);
+           }
+           else
+           {
+              CLOG(( EConn, 4, _L("Using Internet Snap") ));
+              extPref.SetSnapPurpose(CMManager::ESnapPurposeInternet);
+		   }
+
+           extPref.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
+           TConnPrefList prefList;
+           prefList.AppendL(&extPref);
+           iConn.Start( prefList, iStatus );
+        #else
+            iConn.Start( iConnPref, iStatus );
+        #endif //BRDO_OCC_ENABLED_FF
+        
         iState = EConnecting;
         SetActive();
         CleanupStack::Pop( 2 ); // closing iConn and iSockServ
--- a/web_plat/browser_platform_api/inc/Browser_platform_variant.hrh	Mon Jan 18 21:20:18 2010 +0200
+++ b/web_plat/browser_platform_api/inc/Browser_platform_variant.hrh	Tue Feb 02 00:56:45 2010 +0200
@@ -158,21 +158,38 @@
 // Flag for Multiple Font Support(Times New Roman,Arial and Courier).This feature is available only for TB9.2   
 #define BRDO_BROWSER_MULTIPLE_FONT_SUPPORT
 
+// Flag for Multi touch enable 
+#define BRDO_MULTITOUCH_ENABLED_FF
 //To provide WidgetSIDChecker support 
 #define APP_SID_CHECK_SUPPORT_FF
 
+// One Click Connectivity support flag
+#define BRDO_OCC_ENABLED_FF
+
+//Single click flag
+#define BRDO_SINGLE_CLICK_ENABLED_FF
 /*
 * ===================
 *        S60 3.23
 * ===================
 */ 
 #if defined(__PLATFORM_VERSION_32__)
+
+//OCC support
+#undef BRDO_OCC_ENABLED_FF
+
+//Single click support
+#undef BRDO_SINGLE_CLICK_ENABLED_FF
+
 //To provide WidgetSIDChecker support 
 #undef APP_SID_CHECK_SUPPORT_FF 
 
 // Flag for Multiple Font Support(Times New Roman,Arial and Courier).This feature is available only for TB9.2
 #undef BRDO_BROWSER_MULTIPLE_FONT_SUPPORT
 
+// Flag for Multi touch enable 
+#undef BRDO_MULTITOUCH_ENABLED_FF
+
 // Defines touch screen capability
 #undef BRDO_TOUCH_ENABLED_FF
 
@@ -234,6 +251,13 @@
 */ 
 #elif defined(__PLATFORM_VERSION_50_TUBE__)
 
+//OCC support
+#undef BRDO_OCC_ENABLED_FF
+//Single click support
+#undef BRDO_SINGLE_CLICK_ENABLED_FF
+
+// Flag for Multi touch enable 
+#undef BRDO_MULTITOUCH_ENABLED_FF
 //To provide WidgetSIDChecker support 
 #undef APP_SID_CHECK_SUPPORT_FF 
 
@@ -286,6 +310,14 @@
 */ 
 #elif defined(__PLATFORM_VERSION_50__)
 
+//OCC support
+#undef BRDO_OCC_ENABLED_FF
+//Single click support
+#undef BRDO_SINGLE_CLICK_ENABLED_FF
+
+// Flag for Multi touch enable 
+#undef BRDO_MULTITOUCH_ENABLED_FF
+
 //To provide WidgetSIDChecker support 
 #undef APP_SID_CHECK_SUPPORT_FF 
 
@@ -321,6 +353,14 @@
 */ 
 #elif defined(__PLATFORM_VERSION_51__)
 
+//OCC support
+#undef BRDO_OCC_ENABLED_FF
+//Single click support
+#undef BRDO_SINGLE_CLICK_ENABLED_FF
+
+// Flag for Multi touch enable 
+#undef BRDO_MULTITOUCH_ENABLED_FF
+
 //To provide WidgetSIDChecker support 
 #undef APP_SID_CHECK_SUPPORT_FF 
 
@@ -352,6 +392,12 @@
 // Defines whether SAPI Security Manager Prompt Enhancement is available
 #undef BRDO_SEC_MGR_PROMPT_ENHANCEMENT_FF
 
+//Defines One Click Connectivity support
+#define BRDO_OCC_ENABLED_FF
+
+//Single click support
+#define BRDO_SINGLE_CLICK_ENABLED_FF
+
 #define BRDO_BROWSER_50_FF
 #define BRDO_BROWSER_51_FF
 #define BRDO_BROWSER_52_FF
--- a/web_plat/group/bld.inf	Mon Jan 18 21:20:18 2010 +0200
+++ b/web_plat/group/bld.inf	Tue Feb 02 00:56:45 2010 +0200
@@ -31,12 +31,12 @@
 #include "../multipart_parser_api/group/bld.inf"
 #endif
 #include "../recent_url_store_api/group/bld.inf"
-#include "../rt_gesturehelper_api/group/bld.inf"
 #include "../scheme_handler_plugin_api/group/bld.inf"
 #include "../scriptable_plugin_api/group/bld.inf"
 #include "../webutils_api/group/bld.inf"
 #include "../widget_registry_api/group/bld.inf"
 #include "../xml_parser_api/group/bld.inf"
+#include "../stmgesturefw_api/group/bld.inf"
 
 PRJ_PLATFORMS
 DEFAULT
--- a/web_plat/rt_gesturehelper_api/group/bld.inf	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Build information 
-*
-*/
-#include <platform_paths.hrh>
-#include "../../browser_platform_api/inc/browser_platform_variant.hrh"
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-../inc/rt_gesturehelper.h    MW_LAYER_PLATFORM_EXPORT_PATH(rt_gesturehelper.h)
-../inc/rt_gestureobserver.h  MW_LAYER_PLATFORM_EXPORT_PATH(rt_gestureobserver.h)
-
-PRJ_MMPFILES
--- a/web_plat/rt_gesturehelper_api/inc/rt_gesturehelper.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  RT Gesture helper interface
-*
-*/
-
-
-#ifndef _RT_GESTUREHELPER_H_
-#define _RT_GESTUREHELPER_H_
-
-#include <e32base.h>
-#include <rt_gestureobserver.h>
-
-class CAlfEnv;
-class CAlfDisplay;
-class TAlfEvent;
-struct TPointerEvent;
-
-namespace RT_GestureHelper
-{
-
-class CGestureHelperImpl;
-
-/** 
- * Gesture helper provides functionality to convert a stream of pointer events 
- * into a logical gesture, and to assist clients in calculation of gesture 
- * speed and distance.
- * 
- * Interfaces
- *  - CGestureHelper is a parser of pointer events. Recognises gestures from 
- *    a sequence of pointer events, and converts them to gesture commands. 
- *    For documentation of callbacks, see @ref MGestureObserver. 
- *  - MGestureObserver allows clients to get notified of gestures
- *  - MGestureEvent represents the gesture (event)
- */
-NONSHARABLE_CLASS( CGestureHelper ) : public CBase
-    {
-public:
-    /** 
-     * The helper is expected to be a member variable, hence NewLC is not provided 
-     */
-    IMPORT_C static CGestureHelper* NewL( MGestureObserver& aObserver );
-    
-    /** Destructor */
-    IMPORT_C ~CGestureHelper();
-
-    /**
-     * Specify whether the helper will send hold events. By default, holding is enabled.
-     * "Hold" means user has held stylus/finger on the same position for a longer duration.
-     * 
-     * Clients that require holding to be treated with no special meaning should disable 
-     * holding to simplify their event handling. 
-     * For example, assume the client uses swipe left/right to control navigation, and 
-     * holding is enabled. If user holds, the client gets hold left/right
-     * event, and no swipe event. If user now drags left or right while still pressing 
-     * stylus down, the client will not get a swipe event (since it already received a hold
-     * event). Upon release event, the client no reliable way of knowing whether the 
-     * user swiped left/right or cancelled the swipe. This problem is removed if the
-     * client simply disables holding. In the above scenario while holding disabled,
-     * the client would get only swipe events (and released event).
-     * (Swipe can be cancelled by dragging towards, but not beyond, the starting position.) 
-     */
-    IMPORT_C void SetHoldingEnabled( TBool aEnabled );
-    
-    /**
-     * @return whether sending hold events is currently enabled
-     * ("Hold" means user has held stylus/finger on the same position for a longer duration.)
-     */
-    IMPORT_C TBool IsHoldingEnabled() const;
-    
-    /**
-     * Enables/disables double tap support. Double tap is disabled by default.
-     * When double tap is disabled, gesture helper emits tap events immediately when
-     * user lifts stylus/finger. 
-     * When double tap is enabled, tap events are emitted after the double tap timeout passes. 
-     * The timeout is the maximum time within which the second tap will be treated 
-     * as a double tap. That is, there is a delay (sluggishness) before client receives 
-     * the tap event when double tap is enabled. 
-     * tap + timeout => tap event emitted after timeout
-     * tap + tap before timeout => double tap event emitted immediately after the second tap
-     * tap + swipe => tap + swipe events
-     * (tap + timeout + tap + timeout => two tap events)
-     */
-    IMPORT_C void SetDoubleTapEnabled( TBool aEnabled );
-
-    /**
-     * @return whether double tap is currently enabled. See SetDoubleTapEnabled
-     */
-    IMPORT_C TBool IsDoubleTapEnabled() const;
-    
-    /** 
-     * Initialise pointer capture for Alfred 
-     * This means that helper will receive drag events and pointer events that 
-     * go outside the original visual area
-     */
-    IMPORT_C void InitAlfredPointerCaptureL( CAlfEnv& aEnv, CAlfDisplay& aDisplay,
-        TInt aFreeControlGroupId );
-    
-    /** 
-     * Give a pointer event to the helper, to form a part of a gesture
-     * For AVKON-based client, this interface is the only option.
-     * Alfred-based client should use OfferEventL, as it allows gesture events to
-     * provider the visual on which the pointer event started.
-     * @param aEvent pointer event
-     * @return whether event was consumed or not
-     *         EFalse the event is not a pointer events and if pointer up/drag 
-     *				  event received without pointer down event
-     *         ETrue in all the other cases of pointer event 
-     */
-    IMPORT_C TBool HandlePointerEventL( const TPointerEvent& aEvent );
-    
-    /**
-     * Offer an Alf event. See HandlePointerEventL.
-     * @return whether event was consumed or not
-     *         EFalse the event is not a pointer events and if pointer up/drag 
-     *				  event received without pointer down event
-     *         ETrue in all the other cases of pointer event 
-     */
-    IMPORT_C TBool OfferEventL( const TAlfEvent& aEvent );
-    
-    /** 
-     * Cancel ongoing recognision. Purges all pointer events given earlier, and
-     * starts afresh. It is not necessary to call Cancel before deleting the object.
-     */
-    IMPORT_C void Cancel();
-        
-private:
-    /// interface implementation
-    CGestureHelperImpl* iImpl;
-    };
-
-} // namespace RT_GestureHelper
-
-#endif // _RT_GESTUREHELPER_H_
--- a/web_plat/rt_gesturehelper_api/inc/rt_gestureobserver.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  RT Gesture helper interface
-*
-*/
-
-#ifndef _RT_GESTUREOBSERVER_H_
-#define _RT_GESTUREOBSERVER_H_
-
-#include <e32std.h>
-
-namespace RT_GestureHelper
-{
-
-/// flag that indicates gesture code is a holding code
-/// clients should use MGestureEvent::IsHolding
-const TInt EFlagHold       = 0x10000000;
-
-enum TGestureCode
-    {
-    // states
-    EGestureStart          = 0x00000001, // gesture just started (user pressed stylus down)
-    EGestureDrag           = 0x00000002, // user moved stylus (may be holding or not holding)
-    EGestureReleased       = 0x00000003, // user lifted stylus while user was holding
-    // gestures
-    EGestureUnknown        = 0x00000005, // gesture was not recognised
-    // these codes are sent when user lifts stylus (if holding not started)
-    EGestureTap            = 0x00000006,
-    EGestureDoubleTap      = 0x00000007, // only if double tap is enabled 
-                                         // (via CGestureHelper::SetDoubleTapEnabled or
-                                         // CGestureControl::SetDoubleTapEnabled)
-    EGestureSwipeLeft      = 0x00000008,
-    EGestureSwipeRight     = 0x00000009,
-    EGestureSwipeUp        = 0x0000000A,
-    EGestureSwipeDown      = 0x0000000B,
-    
-    EGestureFlick          = 0x0000000C,
-    EGestureLongTap        = 0x0000000D,
-    EGestureDrop           = 0x0000000E,
-        
-    // these codes are sent when user initiates holding by keeping stylus in
-    // same place for a longer duration
-    EGestureHoldLeft       = EGestureSwipeLeft  | EFlagHold,
-    EGestureHoldRight      = EGestureSwipeRight | EFlagHold,
-    EGestureHoldUp         = EGestureSwipeUp    | EFlagHold,
-    EGestureHoldDown       = EGestureSwipeDown  | EFlagHold
-    };
-
-/**
- * Point of float accuracy
- */
-NONSHARABLE_STRUCT( TRealPoint )
-    {
-    inline TRealPoint();
-    inline TRealPoint( const TRealPoint& aPoint );
-    inline TRealPoint( TReal aX, TReal aY );
-    inline TBool operator==( const TRealPoint& aPoint ) const;
-
-    TReal32 iX;
-    TReal32 iY;
-    };
-
-/**
- * a gesture event
- */
-
-enum TAxis
-    {
-    EAxisBoth,
-    EAxisHorizontal,
-    EAxisVertical
-    };
-
-
-class TGestureEvent
-{
-public:    
-    inline TGestureCode Code( TAxis /*aRelevantAxis*/ ) const { return iCode; };
-    inline TBool IsHolding() const { return iIsHolding; };
-    inline TPoint StartPos() const { return iStartPos; };
-    inline TPoint CurrentPos() const { return iCurrPos; }; 
-    inline TRealPoint Speed() const { return iSpeed; };
-    inline TRealPoint SpeedPercent ( const TRect& /*aEdges*/ ) const { return iSpeedPercent; };
-    inline TPoint Distance() const { return iDistance; }; 
-    
-    inline void SetCurrentPos(TPoint aPos) { iCurrPos = aPos; };
-    inline void SetStartPos(TPoint aPos) {iStartPos = aPos; };
-    inline void SetCode(TGestureCode aCode) {iCode = aCode; };
-    inline void SetSpeed(TRealPoint aSpeed) { iSpeed = aSpeed; };
-    inline void SetDistance(TPoint aDistance) { iDistance = aDistance; };
-    inline void SetSpeedPercent(TRealPoint aSpeedPercent) { iSpeedPercent = aSpeedPercent; };
-    
-    inline void SetIsHolding(TBool aIsHolding) { iIsHolding = aIsHolding; };
-    
-private:    
-    TGestureCode   iCode;
-    TBool          iIsHolding;
-    TPoint         iStartPos;
-    TPoint         iCurrPos;
-    TRealPoint     iSpeed;
-    TRealPoint     iSpeedPercent;
-    TPoint         iDistance;
-};
-
-    
-/** 
- * Observer that will be notified when user makes gestures
- */
-class MGestureObserver
-    {
-public:
-    /**
-     * Handle the gesture event
-     * @param aEvent event describing the gesture 
-     */
-    virtual void HandleGestureL( const TGestureEvent& aEvent ) = 0;
-    };
-
-// ----------------------------------------------------------------------------
-// Default constructor for real point
-// ----------------------------------------------------------------------------
-//
-inline TRealPoint::TRealPoint()
-        : iX( 0 ), iY( 0 )
-    {    
-    }
-
-// ----------------------------------------------------------------------------
-// Copy constructor for real point
-// ----------------------------------------------------------------------------
-//
-inline TRealPoint::TRealPoint( const TRealPoint& aPoint )
-        : iX( aPoint.iX ), iY( aPoint.iY )
-    {    
-    }
-
-// ----------------------------------------------------------------------------
-// Copy constructor for real point
-// ----------------------------------------------------------------------------
-//
-inline TRealPoint::TRealPoint( TReal aX, TReal aY )
-        : iX( aX ), iY( aY )
-    {    
-    }
-
-// ----------------------------------------------------------------------------
-// Default constructor for real point
-// ----------------------------------------------------------------------------
-//
-inline TBool TRealPoint::operator==( const TRealPoint& aPoint ) const
-    {    
-    return iX == aPoint.iX && iY == aPoint.iY;
-    }
-
-    
-} // namespace RT_GestureHelper
-
-#endif // _RT_GESTUREOBSERVER_H_
--- a/web_plat/rt_gesturehelper_api/rt_gesturehelper_api.metaxml	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" ?>
-<api id="32779a8096ddc71728a395da6c5caf1d" dataversion="1.0">
-  <name>RT Gesture Helper API</name>
-  <description>Interface to the RT GestureHelper library.</description>
-  <type>c++</type>
-  <subsystem>WebKitUtils</subsystem>
-  <libs>
-  </libs>
-  <release category="domain" sinceversion="7.0"/>
-  <attributes>
-     <htmldocprovided>no</htmldocprovided>
-     <adaptation>no</adaptation>
-  </attributes>
-</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/group/bld.inf	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information 
+*
+*/
+#include <platform_paths.hrh>
+#include "../../browser_platform_api/inc/browser_platform_variant.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/rt_gesturehelper.h    MW_LAYER_PLATFORM_EXPORT_PATH(rt_gesturehelper.h)
+../inc/rt_gestureobserver.h  MW_LAYER_PLATFORM_EXPORT_PATH(rt_gestureobserver.h)
+../inc/rt_gestureif.h        MW_LAYER_PLATFORM_EXPORT_PATH(rt_gestureif.h)
+../inc/rt_gesturelistener.h  MW_LAYER_PLATFORM_EXPORT_PATH(rt_gesturelistener.h)
+../inc/rt_uievent.h          MW_LAYER_PLATFORM_EXPORT_PATH(rt_uievent.h)
+../inc/stmgestureinterface.h MW_LAYER_PLATFORM_EXPORT_PATH(stmgestureinterface.h)
+../inc/stmgesturelistener.h  MW_LAYER_PLATFORM_EXPORT_PATH(stmgesturelistener.h)
+
+PRJ_MMPFILES
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/inc/rt_gesturehelper.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RT Gesture helper interface
+*
+*/
+
+
+#ifndef _RT_GESTUREHELPER_H_
+#define _RT_GESTUREHELPER_H_
+
+#include <e32base.h>
+#include <rt_gestureobserver.h>
+
+#endif // _RT_GESTUREHELPER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/inc/rt_gestureif.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#ifndef RT_GESTUREIF_H_
+#define RT_GESTUREIF_H_
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <coemain.h>
+#include <aknutils.h>
+#include <e32property.h>
+#include <w32std.h>
+
+namespace stmGesture
+{
+
+/**
+ * UIDs for supported Gestures 
+ */
+enum TGestureUid
+{
+    EGestureUidUnknown     = 0,
+    EGestureUidTouch,
+    EGestureUidTap,
+    EGestureUidDoubleTap   = EGestureUidTap,
+    EGestureUidLongPress,
+    EGestureUidHover,
+    EGestureUidPan,
+    EGestureUidRelease,
+    EGestureUidLeftRight,
+    EGestureUidUpDown,
+    EGestureUidFlick,
+    EGestureUidEdgeScroll,
+    EGestureUidPinch,
+    EGestureUidCornerZoom,
+    //
+    EStmGestureUid_Count
+};
+
+/**
+ * Area Settings
+ */
+enum TGestureAreaSettings
+{
+    ETouchTimeArea,
+    ETouchArea,
+    EHoldArea,
+    //
+    EGestureAreaSettingsCount
+};
+
+/**
+ * Gesture Specific Settings
+ */
+enum TGestureSettings
+{
+    //ETouchTimeout,
+    EDoubleTapTimeout,
+    ESuppressTimeout,
+    EMoveSuppressTimeout,
+    EHoverSpeed,
+    EPanSpeedLow,
+    EPanSpeedHigh,
+    EFlickSpeed = EPanSpeedHigh, 
+    EPinchSpeed,
+    EZoomCornerSize,
+    EEdgeScrollRange,
+    ECapacitiveUpUsed,
+    EPanDisabledWhileHovering,
+    EHoverDisabledWhilePanning,
+    EAdjustYPos,
+    EEnableFiltering,
+    EWServMessageInterception, 
+    //
+    EGestureSettingsCount
+};
+
+struct TGestureArea
+{
+public:
+    enum TShape
+    {
+        /// Use GestureArea settings from globally defined default
+        EDefaultSettings = -1,
+        ERectangle  = 1, // == stmUiEventEngine::ERectangle,
+        ECircle     = 2, // == stmUiEventEngine::ECircle,
+        EEllipse    = 3  // == stmUiEventEngine::EEllipse
+    };
+
+    TShape iShape;
+    TInt iTimeout;
+    // At the moment iWidth is only used
+    TSize iSize;
+};
+
+/**
+ * Edge Scroll Type
+ */
+enum TEdgeScroll
+{
+    EEdgeScrollUp = 1,
+    EEdgeScrollDown,
+    EEdgeScrollLeft,
+    EEdgeScrollRight,
+    EEdgeScrollUnknown
+};
+
+/**
+ * Tap Type
+ */
+enum TTapType
+{
+    ETapTypeSingle = 1,
+    ETapTypeDouble
+};
+
+/**
+ * Zoom Type
+ */
+enum TZoomType
+{
+    EZoomUndefined  = 0,
+    EZoomIn         = 1,
+    EZoomOut        = 2
+};
+
+/**
+ * Direction Definition
+ */
+enum TGestureDirection
+{
+    ENoDirection = 0,
+    //
+    ENorth = 1,
+    ENorthEast,
+    EEast,
+    ESouthEast,
+    ESouth,
+    ESouthWest,
+    EWest,
+    ENorthWest,
+};
+
+/*!
+ * Generic gesture interface.  The gestures
+ * contain a generic part and a gesture specific part
+ * is obtained using the getDetails() method.
+ *
+ */
+class MGestureIf
+{
+public:
+    virtual TGestureUid gestureUid() const = 0; // Identifier of recognizer type that issues the gesture
+    virtual TPoint getLocation() const = 0 ;    // Location where the gesture happened (if applicable)
+    virtual int getType() const = 0 ;           // If the gesture can have different types (like tap or double tap)
+    virtual float getSpeedX() const __SOFTFP = 0 ;  // px/msec, as calculated in the UI state machine, not valid in all cases
+    virtual float getSpeedY() const __SOFTFP = 0 ;  // px/msec, as calculated in the UI state machine, not valid in all cases
+    virtual int getDetails() const = 0 ;      // Other possible details....
+	virtual TPtrC8 getGestureName() = 0 ;	    // String name for gesture, makes possible to use single callback for gestures
+    virtual TPoint getLengthAndDirection() const { return TPoint(0,0); }  // very simple vector
+    virtual TGestureDirection getDirection() const { return stmGesture::ENoDirection; }
+    virtual TPoint getPinchEndPos() const { return TPoint(0,0); }
+};
+
+} // namespace
+
+#endif /* RT_GESTUREIF_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/inc/rt_gesturelistener.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#ifndef RT_GESTURELISTENER_H_
+#define RT_GESTURELISTENER_H_
+
+#include <rt_gestureif.h>
+
+namespace stmGesture
+{
+/*!
+ * The gesture listener interface.  This interface needs to be implemented by the
+ * listener of the standard gestures implemented in the gesture framework.
+ */
+class MGestureListener
+{
+public:
+    /*!
+     * The method that will be called by the gesture framework
+     * to inform about a gesture being recognised.
+     * \param theGesture: contains the recognised gesture.
+     * The MGestureIf contains generic part and gesture specific part
+     * so the listener needs to know how to handle specific gestures.
+     */
+    virtual void gestureEnter(MGestureIf& theGesture) = 0 ;
+    /*!
+     * The method to inform the listener that the gesture has ended.
+     * This happens if another gesture is recognised or e.g. the Release UI
+     * event is handled.
+     * \note Some gestures produce only gestureEnter() callback and no gestureExit().
+     */
+    virtual void gestureExit(TGestureUid gestureUid) = 0 ;
+    /*!
+     * The listener needs to provide the target control (CCoeControl*) to the
+     * standard gestures.  Since the gesture framework processes all events in the
+     * application, the gesture recognisers check whether the events are targeted
+     * to the listener owning control.
+     * Not all gesture recognisers need to perform this check.
+     * \return the owning CCoeControl of the gesture listener.
+     */
+    virtual CCoeControl* getOwner() = 0 ;
+};
+
+}
+#endif /* RT_GESTURELISTENER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/inc/rt_gestureobserver.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RT Gesture helper interface
+*
+*/
+
+#ifndef _RT_GESTUREOBSERVER_H_
+#define _RT_GESTUREOBSERVER_H_
+
+#include <e32std.h>
+
+namespace RT_GestureHelper
+{
+
+/// flag that indicates gesture code is a holding code
+/// clients should use MGestureEvent::IsHolding
+const TInt EFlagHold       = 0x10000000;
+
+enum TGestureCode
+    {
+    // states
+    EGestureStart          = 0x00000001, // gesture just started (user pressed stylus down)
+    EGestureDrag           = 0x00000002, // user moved stylus (may be holding or not holding)
+    EGestureReleased       = 0x00000003, // user lifted stylus while user was holding
+    // gestures
+    EGestureUnknown        = 0x00000005, // gesture was not recognised
+    // these codes are sent when user lifts stylus (if holding not started)
+    EGestureTap            = 0x00000006,
+    EGestureDoubleTap      = 0x00000007, // only if double tap is enabled
+                                         // (via CGestureHelper::SetDoubleTapEnabled or
+                                         // CGestureControl::SetDoubleTapEnabled)
+    EGestureSwipeLeft      = 0x00000008,
+    EGestureSwipeRight     = 0x00000009,
+    EGestureSwipeUp        = 0x0000000A,
+    EGestureSwipeDown      = 0x0000000B,
+
+    EGestureFlick          = 0x0000000C,
+    EGestureLongTap        = 0x0000000D,
+    EGestureDrop           = 0x0000000E,
+
+    // these codes are sent when user initiates holding by keeping stylus in
+    // same place for a longer duration
+    EGestureHoldLeft       = EGestureSwipeLeft  | EFlagHold,
+    EGestureHoldRight      = EGestureSwipeRight | EFlagHold,
+    EGestureHoldUp         = EGestureSwipeUp    | EFlagHold,
+    EGestureHoldDown       = EGestureSwipeDown  | EFlagHold,
+    EGesturePinch
+    };
+
+/**
+ * Point of float accuracy
+ */
+NONSHARABLE_STRUCT( TRealPoint )
+    {
+    inline TRealPoint();
+    inline TRealPoint( const TRealPoint& aPoint );
+    inline TRealPoint( TReal aX, TReal aY );
+    inline TBool operator==( const TRealPoint& aPoint ) const;
+
+    TReal32 iX;
+    TReal32 iY;
+    };
+
+/**
+ * a gesture event
+ */
+
+enum TAxis
+    {
+    EAxisBoth,
+    EAxisHorizontal,
+    EAxisVertical
+    };
+
+
+class TGestureEvent
+{
+public:
+    inline TGestureCode Code( TAxis /*aRelevantAxis*/ ) const { return iCode; };
+    inline TBool IsHolding() const { return iIsHolding; };
+    inline TPoint StartPos() const { return iStartPos; };
+    inline TPoint CurrentPos() const { return iCurrPos; };
+    inline TRealPoint Speed() const { return iSpeed; };
+    inline TRealPoint SpeedPercent ( const TRect& /*aEdges*/ ) const { return iSpeedPercent; };
+    inline TPoint Distance() const { return iDistance; };
+
+    inline void SetCurrentPos(TPoint aPos) { iCurrPos = aPos; };
+    inline void SetStartPos(TPoint aPos) {iStartPos = aPos; };
+    inline void SetCode(TGestureCode aCode) {iCode = aCode; };
+    inline void SetSpeed(TRealPoint aSpeed) { iSpeed = aSpeed; };
+    inline void SetDistance(TPoint aDistance) { iDistance = aDistance; };
+    inline void SetSpeedPercent(TRealPoint aSpeedPercent) { iSpeedPercent = aSpeedPercent; };
+
+    inline void SetIsHolding(TBool aIsHolding) { iIsHolding = aIsHolding; };
+
+private:
+    TGestureCode   iCode;
+    TBool          iIsHolding;
+    TPoint         iStartPos;
+    TPoint         iCurrPos;
+    TRealPoint     iSpeed;
+    TRealPoint     iSpeedPercent;
+    TPoint         iDistance;
+};
+
+
+// ----------------------------------------------------------------------------
+// Default constructor for real point
+// ----------------------------------------------------------------------------
+//
+inline TRealPoint::TRealPoint()
+        : iX( 0 ), iY( 0 )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Copy constructor for real point
+// ----------------------------------------------------------------------------
+//
+inline TRealPoint::TRealPoint( const TRealPoint& aPoint )
+        : iX( aPoint.iX ), iY( aPoint.iY )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Copy constructor for real point
+// ----------------------------------------------------------------------------
+//
+inline TRealPoint::TRealPoint( TReal aX, TReal aY )
+        : iX( aX ), iY( aY )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Default constructor for real point
+// ----------------------------------------------------------------------------
+//
+inline TBool TRealPoint::operator==( const TRealPoint& aPoint ) const
+    {
+    return iX == aPoint.iX && iY == aPoint.iY;
+    }
+
+
+} // namespace RT_GestureHelper
+
+#endif // _RT_GESTUREOBSERVER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/inc/rt_uievent.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,309 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#ifndef RT_UIEVENT_H_
+#define RT_UIEVENT_H_
+
+// INCLUDES
+#include <browser_platform_variant.hrh>
+#include <coemain.h>
+#include <aknutils.h>
+#include <e32property.h>
+#include <w32std.h>
+
+#if defined(BRDO_MULTITOUCH_ENABLED_FF)
+#define ADVANCED_POINTER_EVENTS
+#endif
+
+namespace stmUiEventEngine
+{
+
+#if defined(ADVANCED_POINTER_EVENTS)
+static const TInt KMaxNumberOfPointers(2) ;  // How many pointer we have in multi-touch case
+#else
+static const TInt KMaxNumberOfPointers(1) ;  // How many pointer we have in single touch case
+#endif
+
+/*!
+ * Event code generated from the state machine
+ */
+enum TUiEventCode
+{
+    ETouch  = 0x01,
+    EHold   = 0x02,
+    EMove   = 0x03,
+    ERelease= 0x04,
+    ENull   = 0x05
+};
+
+/*!
+ * Shape of the Area
+ */
+enum TAreaShape
+{
+    ERectangle = 1,
+    ECircle,
+    EEllipse
+};
+
+// for testingg/debugging purposes - string name og the code
+const char* EventName(TUiEventCode aCode);
+
+/*!
+ * Interface class for Speed in X-Y direction
+ */
+class MUiEventSpeed
+{
+public:
+    virtual float speedX() const __SOFTFP = 0;
+    virtual float speedY() const __SOFTFP = 0;
+};
+
+/*!
+ * Utility class to wrap number for (already evaluated) speed values.
+ */
+NONSHARABLE_CLASS(TUiEventSpeed): public MUiEventSpeed
+{
+public:
+    TUiEventSpeed(float speedX, float speedY): m_speedX(speedX),m_speedY(speedY) {}
+    virtual float speedX() const __SOFTFP { return m_speedX; }
+    virtual float speedY() const __SOFTFP { return m_speedY; }
+    float m_speedX;
+    float m_speedY;
+};
+
+/*!
+ * The UI event interface, UI events are touch, hold, move and release.
+ * Note that currently the interface is not OS agnostic enough.  It is using
+ * TPoint, TTimeIntervalMicroSeconds etc. types which should be replaced
+ * with some standard types/classes.
+ */
+class MUiEvent: public MUiEventSpeed
+{
+public:
+    /*!
+     * The starting position of the gesture in _screen_ coordinates
+     */
+    virtual const TPoint& StartPos() const = 0;
+    /*!
+     * Current position in _screen_ coordinates
+     */
+    virtual const TPoint& CurrentXY() const = 0 ;
+    /*!
+     * Previous position in _screen_ coordinates
+     */
+    virtual const TPoint& PreviousXY() const = 0 ;
+    /*!
+     * Time difference between this and previous UI event
+     */
+    virtual TTimeIntervalMicroSeconds StateTransition() const = 0 ;
+    /*!
+     * true, if the UI event was generated because of timer expiration
+     */
+    virtual bool TimerExpired() const = 0;
+    /*!
+     * The UI event code
+     */
+    virtual TUiEventCode Code()const = 0 ;
+    /*!
+     * Target identifier (in practice the CCoeControl* of the window)
+     */
+    virtual void* Target() const = 0 ;
+    /*!
+     * The index of the UI event.  In single touch this is always 0
+     */
+    virtual int Index() const = 0 ;
+    /*!
+     * Next event in the gesture (with the same index)
+     */
+    virtual MUiEvent* previousEvent() const = 0 ;
+    /*!
+     * Count of events in gesture
+     */
+    virtual int countOfEvents() const = 0 ;
+    /*!
+     * Timestamp
+     */
+    virtual TInt64 timestamp() const = 0 ;
+    /*!
+     * Speed.  Speed is calculated based on the previous event.
+     */
+    virtual float speedX() const __SOFTFP = 0 ;
+    /*!
+     * Speed.  Speed is calculated based on the previous event.
+     */
+    virtual float speedY() const __SOFTFP = 0 ;
+};
+
+/**
+ * Observer that will be notified when UI events have been recognised
+ */
+class MUiEventObserver
+{
+public:
+    /**
+     * Handle the UI event
+     * \param aEvent event describing the event
+     */
+    virtual void HandleUiEventL( const MUiEvent& aEvent ) = 0;
+};
+
+/*! The state machine interface.
+ *
+ * To be OS agnostic TPointerEvent, TRect etc. should be replaced with
+ * something else.
+ */
+class MStateMachine
+{
+public:
+    /*!
+     * \return the rectangle containing the touch area.
+     * The shape of the touch area can be either rectangle, circle or ellipse.
+     * getTouchArea returns the current touch area, so it may be of zero size.
+     * During touch timer the method will return the TouchTimeArea, after that it
+     * will return the TouchArea.
+     */
+    virtual TRect getTouchArea(TInt aPointerNumber = 0) = 0 ;
+    /*!
+     * \param fingersize_mm defines the width of the rectangle or the diameter of the circle/ellipse
+     * used for the touch area during touch timer running.  If the initial touch is a "sloppy" one,
+     * there is very easily an extra move event detected during touch time.  On the other hand
+     * after touch has been detected, the touch area should not be too big, just something suitable to
+     * filter minor movements out.  The proposed solution is to define two touch areas: one to be used
+     * while touch timer is running, and another used after touch has been detected.
+     * The TouchTimeArea can be a bit larger to allow sloppy touch, then the TouchArea can be smaller to
+     * filter minor movements out.
+     */
+    virtual void setTouchTimeArea(long fingersize_mm) = 0 ;
+    /*!
+     * \param fingersize_mm defines the width of the rectangle or the diameter of the circle/ellipse
+     * used for the touch area.
+     */
+    virtual void setTouchArea(long fingersize_mm) = 0 ;
+    /*!
+     * get the touch area shape, either rectangle, circle or ellipse
+     */
+    virtual TAreaShape getTouchAreaShape() = 0 ;
+    /*!
+     * set the touch area shape, either rectangle, circle or ellipse.  This is the same for both of
+     * the touch areas.
+     */
+    virtual void setTouchAreaShape(const TAreaShape shape) = 0 ;
+    /*!
+     * get the touch timeout.  Touch timeout is the time after the first down event
+     * until the Touch UI event is generated. Touch timeout makes it possible to
+     * calculate an average of the first few points detected before generating the Touch UI event.
+     */
+    virtual unsigned int getTouchTimeout() = 0 ;
+    /*!
+     * Set the touch timeout.
+     */
+    virtual void setTouchTimeout(unsigned int) = 0 ;
+    /*!
+     * \return the rectangle containing the hold area.
+     * The shape of the hold area can be either rectangle, circle or ellipse.
+     * getholdArea returns the current hold area, so it may be of zero size.
+     */
+    virtual TRect getHoldArea(TInt aPointerNumber = 0) = 0 ;
+    /*!
+     * \param fingersize_mm defines the width of the rectangle or the diameter of the circle/ellipse
+     * used for the hold area.  Hold area defines an area so that if the touch coordinates stay
+     * inside that area for the duration of hold timeout the Hold UI event is generated.
+     */
+    virtual void setHoldArea(long fingersize_mm) = 0 ;
+    /*!
+     * get the hold area shape, either rectangle, circle or ellipse
+     */
+    virtual TAreaShape getHoldAreaShape() = 0 ;
+    /*!
+     * set the hold area shape, either rectangle, circle or ellipse
+     */
+    virtual void setHoldAreaShape(const TAreaShape shape) = 0 ;
+    /*!
+     * get the hold timeout.  The timeout defines how long the touch coordinates need to stay
+     * inside hold area before Hold UI event is generated.
+     */
+    virtual unsigned int getHoldTimeout() = 0 ;
+    /*!
+     * Set the hold timeout.
+     */
+    virtual void setHoldTimeout(unsigned int a) = 0 ;
+    /*!
+     * get the touch suppress timeout.  This timeout defines how long it will take to generate
+     * the Release UI event after UP event during the touch timeout.  This timeout is rather short
+     * but will cause the filtering of accidental UP/DOWN events during if they are close together.
+     */
+    virtual unsigned int getTouchSuppressTimeout() = 0 ;
+    /*!
+     * Set the touch suppress timeout.
+     */
+    virtual void setTouchSuppressTimeout(unsigned int a) = 0 ;
+    /*!
+     * get the move suppress timeout.  This timeout is used after Move UI event has been generated to
+     * filter accidental UP/DOWN events.  Using light touch it is possible to cause accidental UP/DOWN
+     * events with the timespan can be over 120 ms when the direction of movement changes.
+     */
+    virtual unsigned int getMoveSuppressTimeout() = 0 ;
+    /*!
+     * set the move suppress timeout.
+     */
+    virtual void setMoveSuppressTimeout(unsigned int a) = 0 ;
+    /*!
+     * add UI event observer. The generated UI events will be sent to the observers.
+     * \return false, if the max number of observers (=5) has been reached.
+     */
+    virtual bool addUiEventObserver(MUiEventObserver* observer) = 0 ;
+    /*!
+     * remove the UI event observer.
+     */
+    virtual bool removeUiEventObserver(MUiEventObserver* observer) = 0 ;
+    /*!
+     * \return true, of the message being processed did not generate UI event
+     */
+    virtual bool wasLastMessageFiltered(TInt aPointerNumber = 0) = 0 ;
+    /*!
+     * enable capacitive UP message.  If it is enabled, UP suppression is not used
+     * but the UP event causes immediate Release UI event.
+     */
+    virtual void enableCapacitiveUp(bool enable) = 0 ;
+    /*!
+     * enable or disable debug logging of the state machine
+     * \param aEnable : logging enabled
+     */
+    virtual void enableLogging(bool aEnable) = 0 ;
+    /*!
+     * add "window handles" to the list of targets which should be included
+     * in the gesture recognition.  This way it is possible to drop the messges
+     * which are not of interest from the gesture recognition point of view.
+     * This is used when only the gesture recognition is used so that the UI events are
+     * not passed to the application.
+     */
+    // virtual void addGestureTarget(void* aTarget) = 0 ;
+
+     /*!
+     * Setting the Y adjustment useful in capacitive touch
+     * Note that there are problems with the adjustment if done at this level,
+     * the most proper place would be the window server.
+     */
+    virtual void enableYadjustment(bool aEnable) = 0 ;
+
+    /// Get the number of supported touch pointers
+    virtual int getNumberOfPointers() = 0;
+};
+
+} // namespace
+#endif /* RT_UIEVENT_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/inc/stmgestureinterface.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+#ifndef __STMGESTUREINTERFACE_H__
+#define __STMGESTUREINTERFACE_H__
+
+#include <e32base.h>
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+#include <rt_uievent.h>
+#include <stmgesturelistener.h>
+
+// FORWARD DECLARATION
+namespace stmGesture
+{
+    class CGestureFramework;
+    class MGestureRecogniserIf;
+}
+
+class CStmGestureContext;
+class MStmGestureListener;
+
+typedef stmGesture::MGestureIf MStmGesture;
+typedef stmGesture::TGestureUid TStmGestureUid;
+typedef stmGesture::MGestureListener MStmGestureEngineListener;
+typedef stmGesture::MGestureRecogniserIf MStmGestureRecogniser;
+typedef stmGesture::TGestureSettings TStmGestureSettings;
+typedef stmGesture::TGestureAreaSettings TStmGestureAreaSettings;
+typedef stmGesture::TGestureArea TStmGestureArea;
+
+///==================================================================
+
+/**
+ * Interface class for defining gesture settings parameters
+ */
+class MStmGestureParameters
+    {
+public:
+    virtual TStmGestureArea* Area(TStmGestureAreaSettings aArea) = 0;
+    virtual TInt Param(TStmGestureSettings aParam) const = 0;
+    virtual TUint8 Enabled(TStmGestureUid aGesture) const = 0;
+    };
+
+///==================================================================
+
+/**
+ * Class definition for gesture settings parameters
+ */
+NONSHARABLE_CLASS( CStmGestureParameters ): public CBase, public MStmGestureParameters
+    {
+public:
+    /*!
+     * Constructors
+     */
+    IMPORT_C CStmGestureParameters();
+    IMPORT_C CStmGestureParameters(const CStmGestureParameters& aParams);
+
+public: //getter methods
+
+    /*!
+     * To get the area settings
+     */
+    TStmGestureArea* Area(TStmGestureAreaSettings aArea) { return &iAreaSettings[aArea]; }
+
+    /*!
+     * To get Gesture params
+     */
+    TInt Param(TStmGestureSettings aParam) const { return iParam[aParam];  }
+
+    /*!
+     * Gesture enabled or not
+     */
+    TUint8 Enabled(TStmGestureUid aGesture) const { return iEnabled[aGesture] != 0; }
+
+public: // setter methods
+
+    /*!
+     * To set the parameters
+     */
+    void SetParam(TStmGestureSettings aParam, TInt aValue) { iParam[aParam] = aValue; }
+
+    /*!
+     * To enable or disble the gestures
+     */
+    void SetEnabled(TStmGestureUid aGesture, TUint8 aParam) { iEnabled[aGesture] = aParam; }
+
+    /*!
+     * Gesture settings
+     */
+    TInt& operator[](TStmGestureSettings aParam) { return iParam[aParam]; }
+
+private:
+    TInt iParam[stmGesture::EGestureSettingsCount];
+    TStmGestureArea iAreaSettings[stmGesture::EGestureAreaSettingsCount];
+    TInt iModified;
+    TUint8 iEnabled[stmGesture::EStmGestureUid_Count];
+    };
+
+///==================================================================
+
+/**
+ * CStmGestureEngine Class Declaration
+ */
+NONSHARABLE_CLASS( CStmGestureEngine ): public CBase
+    {
+public:
+
+    /*!
+     * Gesture Engine Creation
+     */
+    IMPORT_C static CStmGestureEngine* NewL();
+    ~CStmGestureEngine();
+
+public:
+
+    /*!
+     * To Create a context in gesture engine
+     */
+    IMPORT_C CStmGestureContext* CreateContextL(TInt aId);
+
+    /*!
+     * To get the context
+     */
+    IMPORT_C CStmGestureContext* Context(TInt aId);
+
+    /*!
+     * Application use HandlePointerEventL API to pass the raw hardware events to the gesture library
+     */
+    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent, void* target);
+
+private:
+
+    /*!
+     * default constructor
+     */
+    CStmGestureEngine();
+
+    /*!
+     * Two-phase constructor
+     */
+    void ConstructL();
+
+private: // used by friend class CStmGestureContext
+
+    void EnableContextL(CStmGestureContext& aCtxt);
+    void DisableContextL(CStmGestureContext& aCtxt);
+
+    template<class T>
+    void InitRecognizerL( T*& aGesture, CStmGestureContext& aContext, TBool aNewCOntext);
+
+    void SetupRecognizersL(CStmGestureContext& aCtxt, TBool aNewContext);
+
+private:
+    friend class CStmGestureContext;
+    stmGesture::CGestureFramework* iGf;
+    // Registered/owned contexts
+    RPointerArray<CStmGestureContext> iContexts;
+    // Active set of contexts; latest added defines parameters
+    RPointerArray<CStmGestureContext> iCtxtStack;
+    // Global/default parameters
+    CStmGestureParameters* iConfig;
+    TBool iDtorPhase;
+    };
+
+///==================================================================
+
+//Forward declaration
+class CGestureEventSender;
+
+/**
+ * Gesture context represents a certain configuration of gesture parameters
+ * (including what gestures are enabled) and gesture listeners.
+ * Context can be created beforehand and reused later.
+ * The assumed use of a context is to have rough correspondence between
+ * UI view and enabled gestures.
+ *
+ * @note Gesture contexts are created by an instance of CStmGestureEngine.
+ */
+
+class CStmGestureContext: public CBase, public MStmGestureEngineListener
+    {
+public:
+    /*!
+     * Constructor
+     */
+    CStmGestureContext(CStmGestureEngine& aEngine);
+
+    ~CStmGestureContext();
+
+public: /// Gesture listeners
+
+    /*!
+     * Add listener to the gesture processing context.
+     * @param aListener Listener object
+     * @param aPos Position of inserted listener which determines order in which it receives gesture events (0 == first, before existing)
+     */
+    IMPORT_C void AddListenerL(MStmGestureListener* aListener, TInt aPos = 0);
+
+    /*!
+     * Remove listener from the gesture processing context.
+     * @param aListener Listener object
+     */
+    IMPORT_C TInt RemoveListener(MStmGestureListener* aListener);
+
+    /*!
+     * To get the list of listeners
+     */
+    const RPointerArray<MStmGestureListener>& Listeners() const { return iListeners; }
+
+public: /// Context activation
+    
+    /*!
+     * To set the context configuration in Gesture Engine.
+     */
+    IMPORT_C void SetContext(CCoeControl* aControl);
+   
+    /*!
+     * Initialize context configuration on the Gesture Engine.
+     */
+    IMPORT_C void ActivateL();
+    
+    /*!
+     * deactivate context configuration on the Gesture Engine.
+     */
+    IMPORT_C void Deactivate();
+
+    /*!
+     * gesture configuration
+     */
+    CStmGestureParameters& Config() { return *iConfig; }
+    
+    /*!
+     * Enable Logging
+     */
+    void SetLogging(TInt aEnabled) { iLogging = aEnabled; }
+    
+    /*!
+     * Context control
+     */
+    CCoeControl* ContextControl() { return iOwnerControl; }
+    
+    /*!
+     * is gesture context is active ?
+     */   
+    TBool IsActive() { return iActivated; }
+     
+    /*!
+     * Context id
+     */      
+    TInt Id() const { return iCtxtId; }
+    
+public: // from MStmGestureEngineListener
+
+    void gestureEnter(MStmGesture& aGesture);
+    void gestureExit(TStmGestureUid aGestureUid);
+    CCoeControl* getOwner();
+
+private:
+    friend class CStmGestureEngine;
+
+    void ConstructL();
+    void DispatchGestureEventL(TStmGestureUid aUid, MStmGesture* aGesture);
+    void SuspendRecognizer(TStmGestureUid aUid);
+    void EnableRecognizersL();
+    void EnableRecognizerL(TStmGestureUid aUid);
+
+private:
+    CStmGestureEngine& iEngine;
+    // Application-specific ID for finding context
+    TInt iCtxtId;
+    TBool iActivated;
+    CStmGestureParameters* iConfig;
+    CCoeControl* iOwnerControl;
+    //TBool iPinchUsed;
+    RPointerArray<MStmGestureListener> iListeners;
+    // for simplicity of addressing recognizers, we'll use fixed array
+    // with UID-based index (range 0..N is assumed for UIDs)
+    // @note Tap recognizer actually produces Tap and DoubleTap gesture,
+    //       so should be handled carefully -- only Tap position is set
+    MStmGestureRecogniser* iRecognizers[stmGesture::EStmGestureUid_Count];
+    TBool iLogging;
+    CGestureEventSender* iEventSender;
+    };
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/inc/stmgesturelistener.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#ifndef __STMGESTURELISTENER_H__
+#define __STMGESTURELISTENER_H__
+
+#include <e32base.h>
+#include <rt_gestureif.h>
+
+
+typedef stmGesture::MGestureIf MStmGesture;
+typedef stmGesture::TGestureUid TStmGestureUid;
+typedef stmGesture::TTapType TStmTapType;
+typedef stmGesture::TGestureDirection TStmGestureDirection;
+
+/**
+ * Point of float accuracy
+ */
+NONSHARABLE_STRUCT( TRealPoint )
+    {
+    inline TRealPoint();
+    inline TRealPoint( const TRealPoint& aPoint );
+    inline TRealPoint( TReal aX, TReal aY );
+    inline TBool operator==( const TRealPoint& aPoint ) const;
+
+    TReal32 iX;
+    TReal32 iY;
+    };
+
+/**
+ * Enum to distinguish between Gesture Entry and Exit. 
+ * Currently supported only for Pinch
+ */
+enum TStmGestureState {
+    EGestureEnter     = 0,
+    EGestureExit
+
+};
+
+/**
+ * Interface Class to the Application
+ */
+
+class TStmGestureEvent
+{
+public:    
+    inline TStmGestureUid Code() const                      { return iGestureUid; };
+    inline TPoint CurrentPos() const                        { return iCurrPos; }; 
+    inline TRealPoint Speed() const                         { return iSpeed; }; 
+    inline TStmTapType Type() const                         { return iType; }; 
+    inline int Details() const                              { return iDetails; };
+    inline TStmGestureDirection GestureDirection() const    { return iDirection; }; 
+    inline TPoint PinchEndPos() const                       { return iPinchEndPos; };
+    inline TStmGestureState GestureState() const            { return iGestureState; };
+            
+    inline void SetCode(TStmGestureUid aGestureUid)         { iGestureUid = aGestureUid; };
+    inline void SetCurrentPos(TPoint aPos)                  { iCurrPos = aPos; };
+    inline void SetSpeed(TRealPoint aSpeed)                 { iSpeed = aSpeed; }; 
+    inline void SetType(TStmTapType aType)                  { iType = aType; }; 
+    inline void SetDetails(int aDetails)                    { iDetails = aDetails; }; 
+    inline void SetGestureDirection(TStmGestureDirection aDirection)  { iDirection = aDirection; }; 
+    inline void SetPinchEndPos(TPoint aPinchEndPos)         { iPinchEndPos = aPinchEndPos; }; 
+    inline void SetGestureState(TStmGestureState aGestureState)       { iGestureState = aGestureState; }; 
+    
+private:    
+    TStmGestureUid              iGestureUid;   // Code of the gesture 
+    TPoint                      iCurrPos;      // Current position where gesture occured
+    TRealPoint                  iSpeed;        // speed X and speed Y
+    TStmTapType                 iType;         // single-tap or double-tap
+    int                         iDetails;      // details like pinch factor
+    TStmGestureDirection        iDirection;    // Gesture Direction  
+    TPoint                      iPinchEndPos;  // End of pinching position
+    TStmGestureState            iGestureState; // Gesture State. currently supports only for pinch
+    
+};
+
+class MStmGestureListener
+    {
+public:
+    /**
+     * Handle the gesture event
+     * @param aEvent event describing the gesture 
+     */
+    virtual void HandleGestureEventL(const TStmGestureEvent& aGesture) = 0;
+    };
+
+// ----------------------------------------------------------------------------
+// Default constructor for real point
+// ----------------------------------------------------------------------------
+//
+inline TRealPoint::TRealPoint()
+        : iX( 0 ), iY( 0 )
+    {    
+    }
+
+// ----------------------------------------------------------------------------
+// Copy constructor for real point
+// ----------------------------------------------------------------------------
+//
+inline TRealPoint::TRealPoint( const TRealPoint& aPoint )
+        : iX( aPoint.iX ), iY( aPoint.iY )
+    {    
+    }
+
+// ----------------------------------------------------------------------------
+// Copy constructor for real point
+// ----------------------------------------------------------------------------
+//
+inline TRealPoint::TRealPoint( TReal aX, TReal aY )
+        : iX( aX ), iY( aY )
+    {    
+    }
+
+// ----------------------------------------------------------------------------
+// Default constructor for real point
+// ----------------------------------------------------------------------------
+//
+inline TBool TRealPoint::operator==( const TRealPoint& aPoint ) const
+    {    
+    return iX == aPoint.iX && iY == aPoint.iY;
+    }
+
+
+#endif  // __ICS_GESTURELISTENER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_plat/stmgesturefw_api/stmgesturefw_api.metaxml	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="32779a8096ddc71728a395da6c5caf1d" dataversion="1.0">
+  <name>State Machine Gesture Framework API </name>
+  <description>Interface to State Machine Gesture Framework API </description>
+  <type>c++</type>
+  <subsystem>WebKitUtils</subsystem>
+  <libs>
+  </libs>
+  <release category="domain" sinceversion="7.0"/>
+  <attributes>
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- a/web_pub/download_mgr_ui_api/inc/CDownloadMgrUiDownloadsList.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/web_pub/download_mgr_ui_api/inc/CDownloadMgrUiDownloadsList.h	Tue Feb 02 00:56:45 2010 +0200
@@ -149,6 +149,12 @@
         * @return TBool 
         */
         inline TBool GetDownloadHide() { return iDownloadListHide; }
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+        /**
+        * Adding Aiw Commands to the given MenuPane
+        */
+        void AIWPlugInMenusL(TInt aResourceId,CEikMenuPane* aMenuPane);
+#endif        
 
     public: // Functions from CDownloadMgrUiBase
 
--- a/web_pub/download_mgr_ui_api/inc/DownloadsListDlgObserver.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/web_pub/download_mgr_ui_api/inc/DownloadsListDlgObserver.h	Tue Feb 02 00:56:45 2010 +0200
@@ -65,6 +65,12 @@
         * setting the downloadlist hide to the observer.
         */
         virtual void SetDownloadListHide( TBool aHide ) = 0;
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+        /**
+        * Adding Aiw Commands for the given MenuPane to the observer.
+        */
+        virtual void AIWPlugInMenusL(TInt aResourceId,CEikMenuPane* aMenuPane) = 0;
+#endif        
     };
 
 #endif /* DOWNLOADSLISTDLGOBSERVER_H */
--- a/web_pub/favourites_engine_api/tsrc/inc/FavouritesEngineTest.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/web_pub/favourites_engine_api/tsrc/inc/FavouritesEngineTest.h	Tue Feb 02 00:56:45 2010 +0200
@@ -1,25 +1,22 @@
 /*
-* ==============================================================================
-*  Name        : favouritesenginetest.h
-*  Part of     : ?Subsystem_name / FavouritesEngineTest
-*
-*  Description : FavouritesEngineTest test module.
-*  Version:   0.5
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright (C) 2002 Nokia Corporation.
-*  This material, including documentation and any related 
-*  computer programs, is protected by copyright controlled by 
-*  Nokia Corporation. All rights are reserved. Copying, 
-*  including reproducing, storing,  adapting or translating, any 
-*  or all of this material requires the prior written consent of 
-*  Nokia Corporation. This material also contains confidential 
-*  information which may not be disclosed to others without the 
-*  prior written consent of Nokia Corporation.
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
 *
-* ============================================================================
+* Description:  FavouritesEngineTest test module.
+*
 */
 
 
+
 #ifndef FAVOURITESENGINETEST_H
 #define FAVOURITESENGINETEST_H
 
--- a/web_pub/favourites_engine_api/tsrc/src/FavouritesEngineTest.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesEngineTest.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -1,25 +1,22 @@
 /*
-* ==============================================================================
-*  Name        : FavouritesEngineTest.cpp
-*  Part of     : ?Subsystem_name / FavouritesEngineTest
-*
-*  Description : FavouritesBCTest class member functions
-*  Version:   0.5
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright (C) 2006 Nokia Corporation.
-*  This material, including documentation and any related 
-*  computer programs, is protected by copyright controlled by 
-*  Nokia Corporation. All rights are reserved. Copying, 
-*  including reproducing, storing,  adapting or translating, any 
-*  or all of this material requires the prior written consent of 
-*  Nokia Corporation. This material also contains confidential 
-*  information which may not be disclosed to others without the 
-*  prior written consent of Nokia Corporation.
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
 *
-* ============================================================================
+* Description:  FavouritesBCTest class member functions
+*
 */
 
 
+
 // INCLUDE FILES
 #include <Stiftestinterface.h>
 #include "favouritesenginetest.h"
--- a/web_pub/favourites_engine_api/tsrc/src/FavouritesItemTestCases.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesItemTestCases.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -1,26 +1,23 @@
 /*
-* ============================================================================
-*  Name:      FavouritesItemTestCases.cpp
-*  Part of:   FavouritesEngineTest class member functions   
-*
-*  Description:
-*
-*  Version:   1.0
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright (C) 2008 Nokia Corporation.
-*  This material, including documentation and any related 
-*  computer programs, is protected by copyright controlled by 
-*  Nokia Corporation. All rights are reserved. Copying, 
-*  including reproducing, storing,  adapting or translating, any 
-*  or all of this material requires the prior written consent of 
-*  Nokia Corporation. This material also contains confidential 
-*  information which may not be disclosed to others without the 
-*  prior written consent of Nokia Corporation.
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
 *
-* ============================================================================
+* Description: 
+*
+*
 */
 
 
+
 // INCLUDE FILES
 #include <e32math.h>
 #include "favouritesenginetest.h"
--- a/web_pub/favourites_engine_api/tsrc/src/FavouritesWapApTestCases.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesWapApTestCases.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -1,26 +1,23 @@
 /*
-* ============================================================================
-*  Name:      FavouritesWapApTestCases.cpp
-*  Part of:   FavouritesEngineTest class member functions   
-*
-*  Description:
-*
-*  Version:   0.5
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright (C) 2002 Nokia Corporation.
-*  This material, including documentation and any related 
-*  computer programs, is protected by copyright controlled by 
-*  Nokia Corporation. All rights are reserved. Copying, 
-*  including reproducing, storing,  adapting or translating, any 
-*  or all of this material requires the prior written consent of 
-*  Nokia Corporation. This material also contains confidential 
-*  information which may not be disclosed to others without the 
-*  prior written consent of Nokia Corporation.
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
 *
-* ============================================================================
+* Description: 
+*
+*
 */
 
 
+
 // INCLUDE FILES
 #include <e32math.h>
 #include "favouritesenginetest.h"
--- a/webengine/osswebengine/MemoryManager/Src/MemoryPool.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/MemoryManager/Src/MemoryPool.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -633,7 +633,7 @@
 	}
 
 #ifdef __WINSCW__
-const TInt KMaxHeapSize = 0x2000000; // 32MB, on emulator
+const TInt KMaxHeapSize = 0x1000000; // 32MB, on emulator
 #else
 const TInt KMaxHeapSize = 0x4000000; // 64MB, on hardware
 #endif
--- a/webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -155,7 +155,7 @@
         return;
     }
     if (errorCode) {
-        client->didFail(resource, ResourceError(String(), errorCode, String(), String()));
+        client->didFail(resource, ResourceError(String(), errorCode, resource->request().url().url(), String()));
     } else {
         client->didFinishLoading(resource);
     }
--- a/webengine/osswebengine/WebKit/s60/formcontrols/WebFormFillPopup.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/formcontrols/WebFormFillPopup.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -16,6 +16,7 @@
 */
 
 // INCLUDE FILES
+#include <browser_platform_variant.hrh>
 #include <../bidi.h>
 #include <brctldialogsprovider.h>
 
@@ -271,8 +272,11 @@
 {
     if (aListBox != m_listBox)
         return;
-
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
+    if (aEventType == EEventItemDoubleClicked || aEventType == EEventEnterKeyPressed || aEventType == EEventItemSingleClicked || aEventType == EEventEmptyAreaClicked)
+#else        
     if (aEventType == EEventItemDoubleClicked || aEventType == EEventEnterKeyPressed)
+#endif        
     {
         // get the selected item from listbox
         m_listBox->View()->UpdateSelectionL(CListBoxView::ESingleSelection);
@@ -280,7 +284,8 @@
         if (m_listBox->IsFocused())
         {
             MakeVisible(EFalse);
-            m_callback->autoComplete(m_data[selected->At(0)]->Text());
+            if(selected != NULL && m_data[selected->At(0)] )
+               m_callback->autoComplete(m_data[selected->At(0)]->Text());
         }
     }
     else if (aEventType == EEventPenDownOnItem) {
--- a/webengine/osswebengine/WebKit/s60/group/browserengine/browserengine.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/group/browserengine/browserengine.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -134,7 +134,7 @@
 #endif // BRDO_TOUCH_ENABLED_FF 
 
 #ifdef BRDO_USE_GESTURE_HELPER    
-LIBRARY         rt_gesturehelper.lib
+LIBRARY		stmgesturefw.lib
 #endif // BRDO_USE_GESTURE_HELPER    
 #if defined(GCCE)
 STATICLIBRARY edllstub.lib
--- a/webengine/osswebengine/WebKit/s60/group/webkit/webkit.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/group/webkit/webkit.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -41,6 +41,8 @@
 SOURCE          BrCtlDialogsProviderUtils.cpp
 SOURCE          WebToolBarInterface.cpp
 SOURCE          WebDataLoadConsumer.cpp
+SOURCE          WebGestureInterface.cpp
+SOURCE          WebPagePinchZoomHandler.cpp
 
 SOURCE          WebPageFullScreenHandler.cpp
 SOURCE          WebPageScrollHandler.cpp
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginSkin.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginSkin.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -831,17 +831,9 @@
         
         if (m_instance && m_pluginfuncs) {
         
-            NetscapePlugInStreamLoaderClient* pluginloader = NetscapePlugInStreamLoaderClient::NewL(url, this, core(m_frame), notifydata);
+            NetscapePlugInStreamLoaderClient* pluginloader = NetscapePlugInStreamLoaderClient::NewL(url, this, core(m_frame), notifydata, notify);
             if (pluginloader) {
-                pluginloader->start();                            
-
-                if ( notify ) {
-                    HBufC* url16 = HBufC::NewLC( url.Length() );
-                    url16->Des().Copy( url );
-                    m_pluginfuncs->urlnotify( m_instance, *url16, NPRES_DONE, notifydata );        
-                    CleanupStack::PopAndDestroy(url16);
-                }
-                
+                pluginloader->start();                                          
             }                
         }                 
     }
@@ -923,17 +915,9 @@
     if (loadmode == ELoadModePlugin ) {    
                         
         if (m_instance && m_pluginfuncs) {
-            NetscapePlugInStreamLoaderClient* pluginloader = NetscapePlugInStreamLoaderClient::NewL(request, this, core(m_frame), notifydata);
+            NetscapePlugInStreamLoaderClient* pluginloader = NetscapePlugInStreamLoaderClient::NewL(request, this, core(m_frame), notifydata, notify);
             if (pluginloader) {
-                pluginloader->start();                            
-
-                if ( notify ) {
-                    HBufC* url16 = HBufC::NewLC( url.Length() );
-                    url16->Des().Copy( url );
-                    m_pluginfuncs->urlnotify( m_instance, *url16, NPRES_DONE, notifydata );        
-                    CleanupStack::PopAndDestroy(url16);
-                }
-                
+                pluginloader->start();                                           
             }                
         }                 
     }
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginStream.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginStream.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -203,7 +203,7 @@
 
 }
 
-void PluginStream::destroyStream(int reason)
+void PluginStream::destroyStream(int reason, TDesC* failedUrl)
 {
     if (m_streamDestroyed) return;
         m_streamDestroyed = true;
@@ -235,8 +235,17 @@
     }
 
 
-    if ( m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->destroystream ) {            
-        m_pluginskin->getNPPluginFucs()->destroystream( m_pluginskin->getNPP(), m_stream,  npreason);
+    if ( m_pluginskin->getNPPluginFucs() ) {
+    
+        if (m_stream && m_pluginskin->getNPPluginFucs()->destroystream){
+            m_pluginskin->getNPPluginFucs()->destroystream( m_pluginskin->getNPP(), m_stream,  npreason);
+            if (m_loaderclient->notify() && m_pluginskin->getNPPluginFucs()->urlnotify)
+                m_pluginskin->getNPPluginFucs()->urlnotify( m_pluginskin->getNPP(), m_stream->url->Des(), npreason, m_notifydata);                
+        }
+        
+        if(!m_stream && m_loaderclient->notify() && failedUrl && m_pluginskin->getNPPluginFucs()->urlnotify){
+            m_pluginskin->getNPPluginFucs()->urlnotify( m_pluginskin->getNPP(), *failedUrl, npreason, m_notifydata);
+        }
     }
     
     if (reason == KErrNone) {
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginStream.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginStream.h	Tue Feb 02 00:56:45 2010 +0200
@@ -39,7 +39,7 @@
 public:
     void createNPStreamL(TPtrC8 url, TPtrC16 mimetype, long long length);
     void writeStreamL(const char* data, int length);
-    void destroyStream(int reason);  
+    void destroyStream(int reason, TDesC* failedUrl=NULL);  
     void close();
     
 private:
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginStreamLoaderClient.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginStreamLoaderClient.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -36,28 +36,28 @@
 using namespace WebCore;
 
     
-NetscapePlugInStreamLoaderClient* NetscapePlugInStreamLoaderClient::NewL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata)
+NetscapePlugInStreamLoaderClient* NetscapePlugInStreamLoaderClient::NewL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata, TBool notify/*=EFalse*/)
 {
     NetscapePlugInStreamLoaderClient* self = new (ELeave) NetscapePlugInStreamLoaderClient();    
     CleanupStack::PushL( self );
-    self->ConstructL( url, pluginskin, frame, notifydata );
+    self->ConstructL( url, pluginskin, frame, notifydata, notify );
     CleanupStack::Pop();    
     return self;    
 }
 
 
-NetscapePlugInStreamLoaderClient* NetscapePlugInStreamLoaderClient::NewL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata)
+NetscapePlugInStreamLoaderClient* NetscapePlugInStreamLoaderClient::NewL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata, TBool notify/*=EFalse*/)
 {
     NetscapePlugInStreamLoaderClient* self = new (ELeave) NetscapePlugInStreamLoaderClient();
     CleanupStack::PushL( self );
             
-    self->ConstructL( request, pluginskin, frame, notifydata );
+    self->ConstructL( request, pluginskin, frame, notifydata, notify );
     
     CleanupStack::Pop();    
     return self;    
 }
 
-void NetscapePlugInStreamLoaderClient::ConstructL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata)  
+void NetscapePlugInStreamLoaderClient::ConstructL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata, TBool notify/*=EFalse*/)  
 {            
     m_loader = 0; 
     m_request = 0;
@@ -65,6 +65,7 @@
     m_pluginskin = pluginskin;
     m_notifydata = notifydata;
     m_frame = frame;
+    m_notify = notify;
     m_pluginstream = new (ELeave) PluginStream(pluginskin, this, notifydata);
     m_request = new (ELeave) ResourceRequest(m_frame->loader()->completeURL(url));
     
@@ -80,7 +81,7 @@
         m_loader->setShouldBufferData(false);
 }
 
-void NetscapePlugInStreamLoaderClient::ConstructL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata)  
+void NetscapePlugInStreamLoaderClient::ConstructL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata, TBool notify/*=EFalse*/)  
 {            
     
     m_loader = 0; 
@@ -89,6 +90,7 @@
     m_pluginskin = pluginskin;
     m_notifydata = notifydata;
     m_frame = frame;
+    m_notify = notify;
     m_pluginstream = new (ELeave) PluginStream(pluginskin, this, notifydata);
     m_request = new (ELeave) ResourceRequest(request.url());
 
@@ -154,8 +156,6 @@
 void NetscapePlugInStreamLoaderClient::cancelWithError(const ResourceError& error)
 {
     if (m_loader && !m_loader->isDone()){
-        if(m_pluginskin && m_pluginskin->getNPPluginFucs())
-            m_pluginskin->getNPPluginFucs()->urlnotify(m_pluginskin->m_instance, error.failingURL(), NPRES_NETWORK_ERR, m_notifydata);
         m_loader->cancel(error);
     }
 }
@@ -200,14 +200,22 @@
 void NetscapePlugInStreamLoaderClient::didFail(const ResourceError& error)
 {
     if (m_pluginstream) {
-        m_pluginstream->destroyStream(error.errorCode() ? error.errorCode() : KErrCancel);
+        int err = error.errorCode() ? error.errorCode() : KErrCancel;
+        HBufC* failedURL = HBufC::NewLC(error.failingURL().length());
+        failedURL->Des().Copy(error.failingURL());
+        m_pluginstream->destroyStream(err, failedURL);
+        CleanupStack::PopAndDestroy(failedURL);
     }
 }
 
 void NetscapePlugInStreamLoaderClient::didCancel(const ResourceError& error)
 {
     if (m_pluginstream) {
-        m_pluginstream->destroyStream(error.errorCode() ? error.errorCode() : KErrCancel);
+        int err = error.errorCode() ? error.errorCode() : KErrCancel;
+        HBufC* failedURL = HBufC::NewLC(error.failingURL().length());
+        failedURL->Des().Copy(error.failingURL());
+        m_pluginstream->destroyStream(err, failedURL);
+        CleanupStack::PopAndDestroy(failedURL);
     }
 }
 
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginStreamLoaderClient.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginStreamLoaderClient.h	Tue Feb 02 00:56:45 2010 +0200
@@ -51,8 +51,8 @@
 {
 
 public:
-    static NetscapePlugInStreamLoaderClient* NewL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata = 0);
-    static NetscapePlugInStreamLoaderClient* NewL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata=0);
+    static NetscapePlugInStreamLoaderClient* NewL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata = 0, TBool notify = EFalse);
+    static NetscapePlugInStreamLoaderClient* NewL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata=0, TBool notify = EFalse);
     virtual ~NetscapePlugInStreamLoaderClient();             
     
     void start();    
@@ -65,10 +65,11 @@
     void didFinishLoading();
     void didFail(const ResourceError& error);
     void didCancel(const ResourceError& error);
+    TBool notify() { return m_notify; }
     
 private:
-    void ConstructL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata = 0);
-    void ConstructL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata=0);
+    void ConstructL(const String& url, PluginSkin* pluginskin, Frame* frame, void* notifydata = 0, TBool notify = EFalse);
+    void ConstructL(const ResourceRequest& request, PluginSkin* pluginskin, Frame* frame, void* notifydata=0, TBool notify = EFalse);
 
     NetscapePlugInStreamLoaderClient();
 
@@ -80,6 +81,7 @@
     PluginSkin* m_pluginskin; // not owned
     void* m_notifydata; // not owned
     int m_error;
+    TBool m_notify;
     
 };
 
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -45,8 +45,11 @@
 #include "WebPageScrollHandler.h"
 #include "WebKitLogger.h"
 
+#include <rt_gestureif.h>
+
 using namespace WebCore;
 using namespace RT_GestureHelper;
+using namespace stmGesture; 
 // CONSTANTS
 const TInt KPluginGranularity = 3;
 _LIT(KPath,"c:\\system\\temp\\");
@@ -716,24 +719,74 @@
 {
     CBrCtl*   brCtl = control(m_pluginskin->frame());    
     WebView*  view = brCtl->webView();
-    TPointerEvent event(aEvent);
-    
-    if (!StaticObjectsContainer::instance()->isPluginFullscreen()) {
-        event.iPosition = aEvent.iPosition - view->PositionRelativeToScreen();
+#ifdef BRDO_MULTITOUCH_ENABLED_FF	
+    if (aEvent.IsAdvancedPointerEvent()) {
+        TAdvancedPointerEvent tadvp = *(static_cast<const TAdvancedPointerEvent *>(&aEvent));
+        if (!StaticObjectsContainer::instance()->isPluginFullscreen()) {
+            tadvp.iPosition = aEvent.iPosition - view->PositionRelativeToScreen();
+        }
+        view->pointerEventHandler()->HandlePointerEventL(tadvp);
     }
-    view->pointerEventHandler()->HandlePointerEventL(event);
+    else {
+#endif 	
+        TPointerEvent event(aEvent);
+        if (!StaticObjectsContainer::instance()->isPluginFullscreen()) {
+            event.iPosition = aEvent.iPosition - view->PositionRelativeToScreen();
+        }
+        view->pointerEventHandler()->HandlePointerEventL(event);
+#ifdef BRDO_MULTITOUCH_ENABLED_FF			
+    }
+#endif 	
 }
 
 
-TBool PluginWin::HandleGesture(const TGestureEvent& aEvent)
+TBool PluginWin::HandleGesture(const TStmGestureEvent& aEvent)
 {
     TBool ret = EFalse;
+    
+    TGestureEvent eventForPlugin; 
+    switch(aEvent.Code()) 
+        {
+        case EGestureUidUnknown :
+            eventForPlugin.SetCode(EGestureUnknown); 
+            break; 
+        case EGestureUidTouch :
+            eventForPlugin.SetCode(EGestureStart);
+            break; 
+        case EGestureUidTap : 
+            if(aEvent.Type() == ETapTypeSingle)
+                eventForPlugin.SetCode(EGestureTap); 
+            else 
+                eventForPlugin.SetCode(EGestureDoubleTap); 
+            break; 
+        case EGestureUidLongPress :
+            eventForPlugin.SetCode(EGestureLongTap); 
+            break; 
+        case EGestureUidPan :
+            eventForPlugin.SetCode(EGestureDrag);
+            break; 
+        case EGestureUidRelease :
+            eventForPlugin.SetCode(EGestureReleased); 
+            break; 
+        case EGestureUidFlick :
+            eventForPlugin.SetCode(EGestureFlick);
+            break; 
+        case EGestureUidPinch :
+            eventForPlugin.SetCode(EGesturePinch);
+            break; 
+        default : 
+            break; 
+
+        }
+    
+    
+    
     if (m_control) {
-        TGestureEvent gestEvent(aEvent);
         CBrCtl*   brCtl = control(m_pluginskin->frame());    
         WebView*  view = brCtl->webView();
         TPoint newPos = aEvent.CurrentPos();
-        TPoint startPos = aEvent.StartPos();
+        // Not sure plugins need the start position of the gesture. Not inlcuded in the new struct
+        TPoint startPos = aEvent.CurrentPos();
         TPoint viewPos = view->PositionRelativeToScreen();
         TPoint ctrlPos = m_control->PositionRelativeToScreen();
         
@@ -741,35 +794,50 @@
         // adjust the position to make it relative to top left corner of 
             newPos += viewPos; 
             startPos += viewPos;
-            gestEvent.SetCurrentPos(newPos);
-            gestEvent.SetStartPos(startPos);
         }
-    
-        if (StaticObjectsContainer::instance()->isPluginFullscreen() || 
+        eventForPlugin.SetCurrentPos(newPos);
+        eventForPlugin.SetStartPos(startPos);
+        if (StaticObjectsContainer::instance()->isPluginFullscreen() ||
 	    m_control->Rect().Contains(newPos - ctrlPos)) {
             NPEvent event;
             NPEventPointer ev;
             event.event = ENppEventPointer;
-            ev.reserved = &gestEvent;
+            ev.reserved = &eventForPlugin;
             ev.pointerEvent = NULL;
             event.param = &ev;
             ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), 
                                                          static_cast<void*>(&event));
+            
+            if (eventForPlugin.Code(EAxisBoth) == EGestureTap) {
+                eventForPlugin.SetCode(EGestureReleased); 
+                ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), 
+                                                             static_cast<void*>(&event));
+ 
+            }
         }
     }
     else if(!m_windowedPlugin && m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->event){
         TRect cliprect = m_pluginskin->getClipRect();
-        TPoint newpos = aEvent.CurrentPos();
-        if(cliprect.Contains(newpos)){
-           TGestureEvent gestEvent(aEvent);
+        TPoint newPos = aEvent.CurrentPos();
+        eventForPlugin.SetCurrentPos(newPos);
+        eventForPlugin.SetCurrentPos(newPos);
+
+        if(cliprect.Contains(newPos)){
            NPEvent event;
            NPEventPointer ev;
            event.event = ENppEventPointer;
-           ev.reserved = &gestEvent;
+           ev.reserved = &eventForPlugin;
            ev.pointerEvent = NULL;
            event.param = &ev;
            ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), 
                                                          static_cast<void*>(&event));
+           
+           if (eventForPlugin.Code(EAxisBoth) == EGestureTap) {
+               eventForPlugin.SetCode(EGestureReleased); 
+               ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), 
+                                                            static_cast<void*>(&event));
+
+           }
         }
     }    
     return ret;
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginWin.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginWin.h	Tue Feb 02 00:56:45 2010 +0200
@@ -26,6 +26,7 @@
 #include <pluginadapterinterface.h>
 #include <npapi.h>
 #include <rt_gesturehelper.h>
+#include <stmgestureinterface.h>
 
 // FORWARD DECLARATIONS
 class PluginSkin;
@@ -478,7 +479,7 @@
     void ToggleScreenMode(bool aFullScreen);
     void PlayPausePluginL ();
     void HandlePointerEventFromPluginL(const TPointerEvent& aEvent);
-    TBool HandleGesture(const RT_GestureHelper::TGestureEvent& aEvent);    
+    TBool HandleGesture(const TStmGestureEvent& aEvent);    
 	TBool Windowed() { return m_windowedPlugin;}
     protected: // New functions
 
--- a/webengine/osswebengine/WebKit/s60/webview/BrCtl.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/BrCtl.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -2467,9 +2467,3 @@
 
 
 
-void CBrCtl::HandlePointerBufferReadyL()
-{
-    m_webView->HandlePointerBufferReadyL();
-}
-
-
--- a/webengine/osswebengine/WebKit/s60/webview/BrCtl.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/BrCtl.h	Tue Feb 02 00:56:45 2010 +0200
@@ -589,7 +589,6 @@
         /**
          * From CCoeControl
          */
-        void HandlePointerBufferReadyL();
         MBrCtlSpecialLoadObserver* brCtlSpecialLoadObserver() const { return m_brCtlSpecialLoadObserver; }
         MBrCtlDownloadObserver* brCtlDownloadObserver();
         MBrCtlLinkResolver* brCtlLinkResolver() const { return m_brCtlLinkResolver; }
--- a/webengine/osswebengine/WebKit/s60/webview/PageView.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/PageView.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -18,6 +18,7 @@
 
 
 // INCLUDE FILES
+#include <browser_platform_variant.hrh>
 #include <../bidi.h>
 #include "PageView.h"
 #include  <coemain.h>
@@ -88,8 +89,15 @@
 // Destructor
 CPageView::~CPageView()
     {
-    m_webView->pageScaler()->SetVisible(EFalse);
-    m_webView->pageScaler()->SetFullScreenMode(EFalse);
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF 
+    if (m_webView && m_webView->pageScaler())
+        {
+#endif    
+        m_webView->pageScaler()->SetVisible(EFalse);
+        m_webView->pageScaler()->SetFullScreenMode(EFalse);
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF        
+        }
+#endif    
     }
 
 
--- a/webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.h	Tue Feb 02 00:56:45 2010 +0200
@@ -132,12 +132,12 @@
     void HandleMaskedDeleteText(WebCore::Frame* frame);
     bool IsWapMaskedModeInput(WebCore::Frame* frame);
     void FocusChanging();
+    void EnableCcpuL();
     
 private:
     void  findPrevSiblingTextLen(Node*, TInt&) const;
     Node* findTextNodeForCurPos(Node* aNode, TInt& aPos) const;
     void setSCTAvailability(bool aAvailable);
-    void EnableCcpuL();
        
 private:
     CState* m_state;        
--- a/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -37,7 +37,6 @@
 
 #include "WebKitLogger.h"
 using namespace WebCore;
-using namespace RT_GestureHelper;
 // constants
 const int KPageOverviewScrollPeriodic = 20 * 1000; // Update frequently for faster, smoother scrolling
 const int KMicroInterval = 300000;
@@ -605,9 +604,9 @@
 }
 
 
-void WebPageScrollHandler::handleScrollingGH(const TGestureEvent& aEvent)
+void WebPageScrollHandler::handleScrollingGH(const TStmGestureEvent& aGesture)
 {   
-    TPoint newPos = aEvent.CurrentPos();
+    TPoint newPos = aGesture.CurrentPos();
     m_currentPosition = newPos;
     if (m_webView->inPageViewMode()) {
         if (!m_pageOverviewScrollPeriodic->IsActive()){
@@ -623,9 +622,9 @@
 }
 
 
-void WebPageScrollHandler::handleTouchDownGH(const TGestureEvent& aEvent)
+void WebPageScrollHandler::handleTouchDownGH(const TStmGestureEvent& aGesture)
 {
-    TPoint newPos = aEvent.CurrentPos();
+    TPoint newPos = aGesture.CurrentPos();
     m_lastMoveEventTime = 0; 
     m_lastPosition = newPos;
     m_currentPosition = newPos;
@@ -640,10 +639,10 @@
 }
 
 
-void WebPageScrollHandler::handleTouchUpGH(const TGestureEvent& aEvent)
+void WebPageScrollHandler::handleTouchUpGH(const TStmGestureEvent& aGesture)
 {
     bool decelDoesScrollbars = false;
-    TPoint newPos = aEvent.CurrentPos();
+    TPoint newPos = aGesture.CurrentPos();
 
     if (m_webView->inPageViewMode()) {
         if (m_pageOverviewScrollPeriodic->IsActive()){ 
@@ -657,7 +656,7 @@
     else {
         m_scrollTimer->Cancel();
         m_lastPosition = TPoint(0, 0);
-        decelDoesScrollbars = startDeceleration(aEvent);
+        decelDoesScrollbars = startDeceleration(aGesture);
                     
         if (m_webView->viewIsScrolling()) {
             Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
@@ -675,10 +674,10 @@
 }
 
 
-bool WebPageScrollHandler::startDeceleration(const TGestureEvent& aEvent)
+bool WebPageScrollHandler::startDeceleration(const TStmGestureEvent& aGesture)
 {
     bool started = false;
-    TRealPoint gstSpeed = aEvent.Speed();
+    TRealPoint gstSpeed = aGesture.Speed();
     if (Abs(gstSpeed.iX / gstSpeed.iY) <= KTanOfThresholdAngle) {
        gstSpeed.iX = 0;
     }
--- a/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.h	Tue Feb 02 00:56:45 2010 +0200
@@ -24,7 +24,7 @@
 #include <e32base.h>
 #include <coedef.h>
 #include <w32std.h>
-#include <rt_gesturehelper.h>
+#include <stmgestureinterface.h>
 #include "WebScrollingDecelerator.h"
 
 
@@ -180,9 +180,9 @@
         static int pageOverviewScrollCallback( TAny* aPtr );
         //static int handleScrollTimerEventCallback( TAny* ptr);
         void scrollPageOverviewGH();
-        void handleScrollingGH(const RT_GestureHelper::TGestureEvent& aEvent);
-        void handleTouchDownGH(const RT_GestureHelper::TGestureEvent& aEvent);
-        void handleTouchUpGH(const RT_GestureHelper::TGestureEvent& aEvent);
+        void handleScrollingGH(const TStmGestureEvent& aGesture);
+        void handleTouchDownGH(const TStmGestureEvent& aGesture);
+        void handleTouchUpGH(const TStmGestureEvent& aGesture);
         void updateScrollbars(const TPoint& scrollPos, TPoint& newscrollDelta);
 
 public:
@@ -193,7 +193,7 @@
         bool calculateScrollableElement(const TPoint& aNewPosition);
         
         void scrollPageOverview(const TPointerEvent& pointerEvent);
-        bool startDeceleration(const RT_GestureHelper::TGestureEvent& aEvent);
+        bool startDeceleration(const TStmGestureEvent& aGesture);
         
      private:  
         // Pointer to owning view
--- a/webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:   
+* Description:
 *
 */
 
@@ -64,11 +64,12 @@
 #include "CSSStyleSelector.h"
 #include "CSSValueKeywords.h"
 #include "Settings.h"
+#include "WebGestureInterface.h"
+#include "WebPagePinchZoomHandler.h"
 
 #include "WebKitLogger.h"
 using namespace WebCore;
 using namespace EventNames;
-using namespace RT_GestureHelper;
 
 static const int KMinScrollAndTapInterval = 200000;				// 200 ms
 static const int KDoubleTapMinActivationInterval = 100000;     // 100 ms
@@ -97,7 +98,8 @@
       m_isHighlighted(false),
       m_highlightedNode(NULL),
       m_buttonDownTimer( this, &WebPointerEventHandler::buttonDownTimerCB ),
-      m_ignoreTap(false)
+      m_ignoreTap(false),
+      m_gestureInterface(NULL)
 {
 }
 
@@ -106,7 +108,7 @@
 //-----------------------------------------------------------------------------
 WebPointerEventHandler::~WebPointerEventHandler()
 {
-    delete m_gestureHelper;
+   delete m_gestureInterface;
     delete m_waiter;
 }
 
@@ -115,130 +117,115 @@
 //-----------------------------------------------------------------------------
 void WebPointerEventHandler::ConstructL()
 {
-#ifdef BRDO_USE_GESTURE_HELPER  
-  m_gestureHelper = CGestureHelper::NewL( *this );
-  m_gestureHelper->SetDoubleTapEnabled(true);
-  m_gestureHelper->SetHoldingEnabled(false);
+#ifdef BRDO_USE_GESTURE_HELPER
+  m_gestureInterface = WebGestureInterface::NewL(m_webview);
 #else
-  m_gestureHelper = NULL;
-#endif  
+  m_gestureInterface = NULL;
+#endif
   m_waiter = new(ELeave) CActiveSchedulerWait();
 }
-/**
- * EGestureStart is sent on touch down
- * EGestureReleased is sent on touch up
- * EGestureTap = touch down + touch up - events sent: EGestureStart, EGestureTap
- *                EGestureReleased
- * EGestureDrag = touch down + "move" - events sent: EGestureStart, EGestureDrag
- * EGestureDoubleTap = 2 * (touch down + touch up) - events sent EGestureStart, 
- *                     EGestureDoubleTap, EGestureReleased
- * EGestureLongTap = touch down + "long touch" - events sent: EGestureStart, 
- *                   EGestureLongTap
- * EGestureSwipe<Up/Down/Left/Right> - drag + touch up, where movements is
- *                   close to particular direction - event sent: EGestureSwipe, 
- *                   EGestureReleased
- * EGestureFlick - "fast" drag + touch up - events sent: EGestureFlick, 
- *                  EGestureReleased
- * EGestureDrop -  drag + touch up, !(EGestureSwipe || EGestureFlick) - events
- *                 sent: EGestureDrop, EGestureReleased
- */
-void WebPointerEventHandler::HandleGestureL( const TGestureEvent& aEvent )
+
+
+// ======================================================================
+// WebPointerEventHandler::HandleGestureEventL
+// ======================================================================
+void  WebPointerEventHandler::HandleGestureEventL(const TStmGestureEvent& aGesture)
 {
-    TGestureCode gtype = aEvent.Code(EAxisBoth);
-    
+    TStmGestureUid uid = aGesture.Code();
+
+    if (m_webview->pinchZoomHandler()->isPinchActive() && uid != stmGesture::EGestureUidPinch)
+        return;
+
     TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
-    
+
     PluginSkin* plugin = m_webview->mainFrame()->focusedPlugin();
     if (plugin && plugin->pluginWin()) {
-      if (plugin->pluginWin()->HandleGesture(aEvent)) {
+        if (plugin->pluginWin()->HandleGesture(aGesture)) {
          if(!plugin->isActive())
             plugin->activate();
-          return;
-      }
+            return;
+        }
     }
-    updateCursor(aEvent.CurrentPos());
+
+    updateCursor(aGesture.CurrentPos());
     if (IS_TABBED_NAVIGATION) {
-        m_webview->tabbedNavigation()->updateCursorPosition(aEvent.CurrentPos());
+        m_webview->tabbedNavigation()->updateCursorPosition(aGesture.CurrentPos());
     }
-    switch (gtype) {
-      // sent on touch down
-      case EGestureStart:  
-      {
-          if (m_webview->viewIsScrolling()) {
-              m_ignoreTap = true;
-              m_webview->pageScrollHandler()->handleTouchDownGH(aEvent);
-          }
-          else {
-              handleTouchDownL(aEvent);   
-          }
-          break;
-      }
-      
-      // sent on tap
-      case EGestureTap:
-      {
-          if (!m_ignoreTap) {
-              handleTapL(aEvent);
-          }
-          break;    
-      }
-      
-      // sent on double tap
-      case EGestureDoubleTap:
-      {
-          handleDoubleTap(aEvent);
-          break;    
-      }
-      
-      // sent on long tap
-      case EGestureLongTap:
-      {
-          break;    
-      }
+
+
+    switch(uid) {
+        case stmGesture::EGestureUidTouch:
+        {
+            if (m_webview->viewIsScrolling()) {
+                m_ignoreTap = true;
+                m_webview->pageScrollHandler()->handleTouchDownGH(aGesture);
+            }
+            else {
+                handleTouchDownL(aGesture);
+            }
+            break;
+        }
+
+
+        case stmGesture::EGestureUidTap:
+        {
+            if (aGesture.Type() == stmGesture::ETapTypeSingle) {
+                if (!m_ignoreTap) {
+                    handleTapL(aGesture);
+                }
+            }
+            else {
+                handleDoubleTap(aGesture);
+            }
+
+                break;
+        }
 
-      // sent on touch up after drag
-      case EGestureDrop:
-      case EGestureFlick:
-      case EGestureSwipeLeft:
-      case EGestureSwipeRight:
-      case EGestureSwipeUp:
-      case EGestureSwipeDown:
-      {
-          m_ignoreTap = false;
-          if (!IS_NAVIGATION_NONE) {
-              handleTouchUp(aEvent);
-          }
-          else {
-              Frame* frm = m_webview->page()->focusController()->focusedOrMainFrame();
-              m_webview->sendMouseEventToEngine(TPointerEvent::EButton1Up, m_highlightPos, frm);
-          }
-          break;    
-      }
-      // sent on move
-      case EGestureDrag:
-      {
-          handleMove(aEvent);
-          break;    
-      }
-      
-      // sent on touch up after tap double tap and long tap
-      case EGestureReleased:
-      {
-          m_ignoreTap = false;
-          handleTouchUp(aEvent);      
-          break;    
-      }
+        case stmGesture::EGestureUidRelease:
+        {
+            m_ignoreTap = false;
+            handleTouchUp(aGesture);
+            break;
+        }
+
+        case stmGesture::EGestureUidPan:
+        {
+            handleMove(aGesture);
+            break;
+        }
+        case stmGesture::EGestureUidFlick:
+        {
+            m_ignoreTap = false;
+            if (!IS_NAVIGATION_NONE) {
+                handleTouchUp(aGesture);
+            }
+            else {
+                Frame* frm = m_webview->page()->focusController()->focusedOrMainFrame();
+                m_webview->sendMouseEventToEngine(TPointerEvent::EButton1Up, m_highlightPos, frm);
+            }
+            break;
+        }
+
+        case stmGesture::EGestureUidPinch:
+        {
+            handlePinchZoomL(aGesture);
+            break;
+        }
+        default:
+            break;
+
     }
+    return;
 }
 
 
 // ======================================================================
 // WebPointerEventHandler::handleTap
 // ======================================================================
-void WebPointerEventHandler::handleTapL(const TGestureEvent& aEvent)
+void WebPointerEventHandler::handleTapL(const TStmGestureEvent& aGesture)
 {
     m_buttonDownTimer.stop();
-    m_lastTapEvent = m_currentEvent; 
+    m_lastTapEvent = m_currentEvent;
     if(!m_webview->inPageViewMode()){
     	doTapL();
     }
@@ -246,12 +233,12 @@
 // ======================================================================
 //  WebPointerEventHandler::handleDoubleTap
 //======================================================================
-void WebPointerEventHandler::handleDoubleTap(const TGestureEvent& aEvent)
+void WebPointerEventHandler::handleDoubleTap(const TStmGestureEvent& aGesture)
 {
     if ( !m_webview->viewIsScrolling() &&
          (m_webview->brCtl()->capabilities() & TBrCtlDefs::ECapabilityFitToScreen)) {
         if (m_isHighlighted){
-            dehighlight();                
+            dehighlight();
         }
         m_webview->setZoomLevelAdaptively();
     }
@@ -263,20 +250,20 @@
 // ======================================================================
 // WebPointerEventHandler::handleTouchDownL
 //======================================================================
-void WebPointerEventHandler::handleTouchDownL(const TGestureEvent& aEvent)
+void WebPointerEventHandler::handleTouchDownL(const TStmGestureEvent& aGesture)
 {
     TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
     PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
     PluginSkin* pluginToActivate = pluginHandler->pluginToActivate();
     m_buttonDownEvent = m_currentEvent;
-    m_highlightPos = aEvent.CurrentPos();    
-    
+    m_highlightPos = aGesture.CurrentPos();
+
     if ( !m_buttonDownTimer.isActive() && !m_webview->inPageViewMode()){
-        m_buttonDownTimer.startOneShot(0.1f);        
+        m_buttonDownTimer.startOneShot(0.1f);
     }
 
     if (!IS_NAVIGATION_NONE) {
-        m_webview->pageScrollHandler()->handleTouchDownGH(aEvent);
+        m_webview->pageScrollHandler()->handleTouchDownGH(aGesture);
     }
 
     if ( TBrCtlDefs::EElementActivatedObjectBox == elType) {
@@ -290,43 +277,43 @@
             }
         }
     }
-    
+
     /*
-     * After introducing "link selection" pointer down action is done in 
-     * buttondown timer callback. When "down" gesture event is arrived we start 
-     * timer end exit, so gesture helper is ready to deliver next gesture event. 
-     * Meanwhile the processing of the first gesture event hasn't been finished yet. 
-     * The gesture helper doesn't "know" about our plans to handle the event inside 
-     * timer callback and only way for us to "tell" about this is to stop RunL() 
-     * of CGestureEventSender (HandleGestureL() is inside it) and finish buttondown 
-     * timer callback first.  
-     */    
+     * After introducing "link selection" pointer down action is done in
+     * buttondown timer callback. When "down" gesture event is arrived we start
+     * timer end exit, so gesture helper is ready to deliver next gesture event.
+     * Meanwhile the processing of the first gesture event hasn't been finished yet.
+     * The gesture helper doesn't "know" about our plans to handle the event inside
+     * timer callback and only way for us to "tell" about this is to stop RunL()
+     * of CGestureEventSender (HandleGestureL() is inside it) and finish buttondown
+     * timer callback first.
+     */
     if ( m_buttonDownTimer.isActive()){
-        m_waiter->Start();	
+        m_waiter->Start();
     }
 }
 
 // ======================================================================
-// WebPointerEventHandler::handleTouchUp 
+// WebPointerEventHandler::handleTouchUp
 // ======================================================================
-void WebPointerEventHandler::handleTouchUp(const TGestureEvent& aEvent)
+void WebPointerEventHandler::handleTouchUp(const TStmGestureEvent& aGesture)
 {
     m_highlightPos = TPoint(-1,-1);
     m_highlightedNode = NULL;
     PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
     pluginHandler->setPluginToActivate(NULL);
     if (!IS_NAVIGATION_NONE) {
-        m_webview->pageScrollHandler()->handleTouchUpGH(aEvent);
+        m_webview->pageScrollHandler()->handleTouchUpGH(aGesture);
     }
 }
 
 // ======================================================================
 // WebPointerEventHandler::handleMoveL
 // ======================================================================
-void WebPointerEventHandler::handleMove(const TGestureEvent& aEvent)
+void WebPointerEventHandler::handleMove(const TStmGestureEvent& aGesture)
 {
     TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
-    TPoint curPos = aEvent.CurrentPos();
+    TPoint curPos =  aGesture.CurrentPos();
     PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
     pluginHandler->setPluginToActivate(NULL);
     m_buttonDownTimer.stop();
@@ -336,8 +323,8 @@
     }
     else {
     HandleHighlightChange(curPos);
-    
-    m_webview->pageScrollHandler()->handleScrollingGH(aEvent);
+
+    m_webview->pageScrollHandler()->handleScrollingGH(aGesture);
     }
 }
 
@@ -348,11 +335,11 @@
 void WebPointerEventHandler::HandlePointerEventL(const TPointerEvent& aPointerEvent)
 {
     m_currentEvent = aPointerEvent;
-    
-    if (m_webview->isSynchRequestPending()) { 
+
+    if (m_webview->isSynchRequestPending()) {
        return;
     }
-    
+
     // Handle graphical history - should never happen, as HistoryView handles this event by itself
     if ( m_webview->brCtl()->historyHandler()->historyController()->historyView()) {
         return;
@@ -363,19 +350,10 @@
         m_webview->formFillPopup()->HandlePointerEventL(aPointerEvent);
         return;
     }
-    
-    if (!m_webview->inPageViewMode()) {
-        if (aPointerEvent.iType == TPointerEvent::EButton1Down) {
-            m_webview->GetContainerWindow().EnablePointerMoveBuffer();
-        }
-        else if (aPointerEvent.iType == TPointerEvent::EButton1Up) {
-            m_webview->GetContainerWindow().DisablePointerMoveBuffer();
-        }
-    }
 
 #ifdef BRDO_USE_GESTURE_HELPER
-    m_gestureHelper->HandlePointerEventL(aPointerEvent);
-#endif    
+      m_gestureInterface->HandlePointerEventL(aPointerEvent);
+#endif
 }
 
 //-----------------------------------------------------------------------------
@@ -417,20 +395,20 @@
     TBrCtlDefs::TBrCtlElementType elType = TBrCtlDefs::EElementNone;
     Frame* coreFrame = core(m_webview->mainFrame());
     WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
-    
+
     TPointerEvent event;
     TPoint pos = cursor->position();
     WebFrame* wfrm = cursor->getFrameAtPoint(pos);
     Frame* frm = core(wfrm);
     TPoint pt(wfrm->frameView()->viewCoordsInFrameCoords(pos));
     TPoint nodePoint;
-    
+
     Element* eventNode = frm->document()->elementFromPoint(pt.iX, pt.iY);
-    
+
     if (m_isHighlighted){
-               dehighlight();                
+               dehighlight();
            }
-    
+
     m_highlightedNode = NULL;
 
     Node* retNode = 0;
@@ -438,10 +416,12 @@
 
     if (elType == TBrCtlDefs::EElementNone) {
         Node* n = wfrm->getClosestAnchorElement(cursor->position(), pos);
-        if (n) {          
+        if (n) {
             wfrm = cursor->getFrameAtPoint(pos);
             frm = core(wfrm);
-            eventNode = frm->document()->elementFromPoint(pos.iX, pos.iY);
+            //eventNode = frm->document()->elementFromPoint(pos.iX, pos.iY);
+            TPoint newPos(wfrm->frameView()->viewCoordsInFrameCoords(pos));
+            eventNode = frm->document()->elementFromPoint(newPos.iX, newPos.iY);
             frm->bridge()->getTypeFromElement(eventNode, elType, elRect, retNode);
             TPoint nodePoint = n->getRect().Rect().Center();
             m_offset = (pt.iX- nodePoint.iX)*(pt.iX- nodePoint.iX) +
@@ -486,7 +466,7 @@
 {
     TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
     Frame* coreFrame = core(m_webview->mainFrame());
-    
+
 #ifdef BRDO_TOUCH_ENABLED_FF
     if (m_isHighlighted)
     {
@@ -497,25 +477,25 @@
            }
     }
 #endif // BRDO_TOUCH_ENABLED_FF
-     
+
     if (!IS_NAVIGATION_NONE) {
          m_webview->sendMouseEventToEngine(TPointerEvent::EMove, m_highlightPos, coreFrame);
      }
-     
+
      /*
-      * We assume that if element visibility has been changed  
-      * between "up" and "down" that means that some node event 
-      * listener (onMouseOver etc) handling happened and we don't 
+      * We assume that if element visibility has been changed
+      * between "up" and "down" that means that some node event
+      * listener (onMouseOver etc) handling happened and we don't
       * want to send a click (mouse press + mouse release) event.
       * The exception is editable element, since we want VKB anyway
       */
      if (!IS_NAVIGATION_NONE &&
-         elType != TBrCtlDefs::EElementActivatedInputBox && 
-         elType != TBrCtlDefs::EElementTextAreaBox &&     
+         elType != TBrCtlDefs::EElementActivatedInputBox &&
+         elType != TBrCtlDefs::EElementTextAreaBox &&
          m_webview->page()->chrome()->client()->elementVisibilityChangedByMouse()) {
          return;
      }
-     
+
      m_lastTapEvent.iPosition = m_buttonDownEvent.iPosition;
      m_lastTapEvent.iType = TPointerEvent::EButton1Up;
      m_lastTapEvent.iModifiers = 0;
@@ -558,10 +538,10 @@
     Frame* frm = m_webview->page()->focusController()->focusedOrMainFrame();
     m_webview->sendMouseEventToEngine(TPointerEvent::EMove, m_highlightPos, frm);
 
-    
+
     m_highlightedNode = NULL;
-       
-    m_webview->syncRepaint();   
+
+    m_webview->syncRepaint();
 }
 
 
@@ -605,17 +585,17 @@
 void WebPointerEventHandler::buttonDownTimerCB(Timer<WebPointerEventHandler>* t)
 {
     m_buttonDownTimer.stop();
-    
+
     Frame* coreFrame = core(m_webview->mainFrame());
     TPointerEvent event;
-    
+
     TBrCtlDefs::TBrCtlElementType elType = highlitableElement();
-    
+
     if (!isHighlitableElement(elType)) {
         elType = TBrCtlDefs::EElementNone;
     }
     m_isHighlighted = (m_highlightedNode != NULL) && (elType != TBrCtlDefs::EElementNone) ;
-    
+
     /*
      * Tabbed navigation might already set the focused node.
      * If it's the same as m_highlightedNode FocuseController::setFocusedNode()
@@ -624,24 +604,24 @@
      * set it through FocuseController::setFocusedNode()
      */
     if (IS_TABBED_NAVIGATION &&
-        elType == TBrCtlDefs::EElementInputBox || 
+        elType == TBrCtlDefs::EElementInputBox ||
         elType == TBrCtlDefs::EElementTextAreaBox) {
         coreFrame->document()->setFocusedNode(NULL);
     }
-         
+
     if (!IS_NAVIGATION_NONE) {
         m_webview->page()->chrome()->client()->setElementVisibilityChanged(false);
-        //to initiate hover 
+        //to initiate hover
         if (m_isHighlighted) {
             setFocusRing();
         }
-        
+
     }
     else {
         m_webview->sendMouseEventToEngine(TPointerEvent::EButton1Down, m_highlightPos, coreFrame);
     }
-    
-    if (m_waiter->IsStarted()) {    
+
+    if (m_waiter->IsStarted()) {
         m_waiter->AsyncStop();
     }
 }
@@ -660,7 +640,7 @@
         if (m_webview->showCursor()) {
             cursor->resetTransparency();
             m_webview->setShowCursor(false);
-            cursor->cursorUpdate(false); 
+            cursor->cursorUpdate(false);
         }
     }
 }
@@ -675,7 +655,7 @@
     RenderStyle* style = new (e->document()->renderArena()) RenderStyle(*rs);
     Color col(0xffaaaaff);
 
-    style->ref();   
+    style->ref();
     style->setOutlineColor(col);
     style->setOutlineStyle(DOTTED, true);
     style->setOutlineWidth(4);
@@ -684,3 +664,15 @@
     style->deref(e->document()->renderArena());
     e->setChanged();
 }
+
+//-----------------------------------------------------------------------------
+// WebPointerEventHandler::handlePinchZoom
+//----------------------------------------------------------------------------
+void  WebPointerEventHandler::handlePinchZoomL(const TStmGestureEvent& aGesture)
+{
+ //dehighlight anything which is highlighted already
+    if (m_isHighlighted){
+        dehighlight();
+    }
+    m_webview->pinchZoomHandler()->handlePinchGestureEventL(aGesture);
+}
--- a/webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.h	Tue Feb 02 00:56:45 2010 +0200
@@ -20,8 +20,9 @@
 
 #include <e32base.h>
 #include <w32std.h>
+#include <stmgestureinterface.h>
 #include "Timer.h"
-#include <rt_gesturehelper.h>
+
 
 namespace WebCore
 {
@@ -31,8 +32,9 @@
 
 class WebView;
 class CActiveSchedulerWait;
+class WebGestureInterface;
 
-class WebPointerEventHandler : public CBase, public RT_GestureHelper::MGestureObserver
+class WebPointerEventHandler : public CBase
 {
 public:
     static WebPointerEventHandler* NewL(WebView* view);     
@@ -42,9 +44,7 @@
 public:
     void HandlePointerEventL(const TPointerEvent& aPointerEvent);
     void HandleHighlightChange(const TPoint &aPoint);
-
-    virtual void HandleGestureL( const RT_GestureHelper::TGestureEvent& aEvent );
-    
+    void HandleGestureEventL(const TStmGestureEvent& aGesture);
     
 private:    
     bool checkForEventListener(WebCore::Node* node);
@@ -54,14 +54,15 @@
     bool isHighlitableElement(TBrCtlDefs::TBrCtlElementType& elType);
     TBrCtlDefs::TBrCtlElementType highlitableElement();
     void buttonDownTimerCB(WebCore::Timer<WebPointerEventHandler>* t);
-    void handleTouchDownL(const RT_GestureHelper::TGestureEvent& aEvent);
-    void handleTouchUp(const RT_GestureHelper::TGestureEvent& aEvent);
-    void handleTapL(const RT_GestureHelper::TGestureEvent& aEvent);
-    void handleDoubleTap(const RT_GestureHelper::TGestureEvent& aEvent);
-    void handleMove(const RT_GestureHelper::TGestureEvent& aEvent);
+    void handleTouchDownL(const TStmGestureEvent& aGesture);
+    void handleTouchUp(const TStmGestureEvent& aGesture);
+    void handleTapL(const TStmGestureEvent& aGesture);
+    void handleDoubleTap(const TStmGestureEvent& aGesture);
+    void handleMove(const TStmGestureEvent& aGesture);
     void doTapL();
     void updateCursor(const TPoint& pos);
     void setFocusRing();
+    void handlePinchZoomL(const TStmGestureEvent& aGesture);
 private:
     WebPointerEventHandler(WebView* view);            
     WebView* m_webview;
@@ -78,10 +79,10 @@
     TPointerEvent m_currentEvent;
     WebCore::Timer<WebPointerEventHandler> m_buttonDownTimer; 
     
-    RT_GestureHelper::CGestureHelper* m_gestureHelper;
     TPointerEvent m_lastPointerEvent;
     bool   m_ignoreTap; 
     CActiveSchedulerWait*    m_waiter; 
+    WebGestureInterface*  m_gestureInterface; 
     
 };
 
--- a/webengine/osswebengine/WebKit/s60/webview/WebScrollingDeceleratorGH.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebScrollingDeceleratorGH.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -28,7 +28,6 @@
 
 #include "WebKitLogger.h"
 
-using namespace RT_GestureHelper;
 // constants
 const int KRecordSize = 4;
 
@@ -38,7 +37,9 @@
 
 const int KScrollIntervalTimeout = 60000; // scroll timer interval in microseconds
 
-const float KDecceleration = -700.0;
+const float KDeccelerationLow = -350.0;
+const float KDeccelerationHigh = -600.0;
+const float KSpeedHigh = 2000.0;
 
 int decelTimerCB(TAny* ptr);
 
@@ -78,6 +79,7 @@
 void WebScrollingDeceleratorGH::ConstructL()
 {
     m_decelTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+    m_deceleration = KDeccelerationHigh;
 }
 
 // -----------------------------------------------------------------------------
@@ -91,7 +93,7 @@
 
 int WebScrollingDeceleratorGH::getDecceleration()
 {
-   return  KDecceleration;  
+   return  m_deceleration;  
 }
 
 
@@ -114,8 +116,22 @@
 {
     m_decelelatorSwitch = true;
     m_scrollbarDrawer = scrollbarDrawer;
-    m_initSpeed.iX = (-1) * speed.iX;
-    m_initSpeed.iY = (-1) * speed.iY;
+    float speedX = speed.iX;
+    float speedY = speed.iY;
+    float absSpeedX = abs(speedX);
+    float absSpeedY = abs(speedY);
+    
+    if (absSpeedX > KSpeedHigh) {
+        speedX = KSpeedHigh * speedX/absSpeedX ;
+        m_deceleration = KDeccelerationLow;
+    }
+    if (absSpeedY > KSpeedHigh) {
+        speedY = KSpeedHigh * speedY/absSpeedY;
+        m_deceleration = KDeccelerationLow;
+    }
+    
+    m_initSpeed.iX = (-1) * speedX;
+    m_initSpeed.iY = (-1) * speedY;
     
     m_numscrollsteps = 0;
     if (m_decelTimer->IsActive()) {
@@ -145,14 +161,16 @@
     TReal32 accelX = 0.0;
     TReal32 accelY = 0.0;
     
+    TReal32 deceleration = getDecceleration();
+    
     if (m_initSpeed.iX) {
-        accelX = (m_initSpeed.iX > 0) ?  KDecceleration : (-1) * KDecceleration;
+        accelX = (m_initSpeed.iX > 0) ?  deceleration : (-1) * deceleration;
         vx = m_initSpeed.iX + accelX * t;
         dx = m_initSpeed.iX * t + 0.5 * accelX * (t * t);
     }
         
     if (m_initSpeed.iY) {
-        accelY = (m_initSpeed.iY > 0) ?  KDecceleration : (-1) * KDecceleration;
+        accelY = (m_initSpeed.iY > 0) ?  deceleration : (-1) * deceleration;
         vy = m_initSpeed.iY + accelY * t;
         dy = m_initSpeed.iY * t + 0.5 * accelY * (t * t);
     }
--- a/webengine/osswebengine/WebKit/s60/webview/WebScrollingDeceleratorGH.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebScrollingDeceleratorGH.h	Tue Feb 02 00:56:45 2010 +0200
@@ -23,7 +23,7 @@
 #include <e32base.h>
 #include <coedef.h>
 #include <w32std.h>
-#include <rt_gestureobserver.h>
+#include <stmgesturelistener.h>
 
 // MACROS
 
@@ -60,7 +60,7 @@
 
     public: // Main functions
         
-        void startDecel(RT_GestureHelper::TRealPoint& speed, WebScrollbarDrawer* scrollbarDrawer);
+        void startDecel(TRealPoint& speed, WebScrollbarDrawer* scrollbarDrawer);
         
         void cancelDecel();
         
@@ -85,7 +85,7 @@
         //normalized current position to minimize rounding error
         TPoint m_normalizedCurrentPosition;
         
-        RT_GestureHelper::TRealPoint m_initSpeed;
+        TRealPoint m_initSpeed;
         
         CPeriodic*  m_decelTimer;
         
@@ -94,6 +94,8 @@
         TPoint m_startPos;
         
         WebScrollbarDrawer* m_scrollbarDrawer;
+        
+        TReal32 m_deceleration;
     };
 
 
--- a/webengine/osswebengine/WebKit/s60/webview/WebTextFormatMask.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebTextFormatMask.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -192,9 +192,15 @@
         m_currentMask = m_currentMask->nextMask();
     }
 
-    // did we use up all the masks?
-    if(m_currentMask && m_currentMask->multitude() != kInfinite)
-        return false;
+       // this check doesn't seem to be proper as the check is done for 
+       // the partial text.Because the checkText() is called for every character input by user,
+       // there are remaining masks after complete text length has been checked, 
+       // that is valid case and it should not return false. 
+       // If text length is bigger than mask length then that case is handled within for loop 
+       //before this condition check. So it is redundant in current implementation
+       // did we use up all the masks?
+       /* if(m_currentMask && m_currentMask->multitude() != kInfinite)
+        return false;*/
 
     return (eb.m_start == -1);
 }
--- a/webengine/osswebengine/WebKit/s60/webview/WebView.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebView.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -60,7 +60,7 @@
 #include "PluginWin.h"
 #include "PluginPlayer.h"
 #include "WebKitLogger.h"
-
+#include "WebPagePinchZoomHandler.h"
 
 #include "Page.h"
 #include "Settings.h"
@@ -201,6 +201,8 @@
 , m_prevEditMode(false)
 , m_firedEvent(0)
 , m_waitTimer(0)
+, m_pinchZoomHandler(NULL)
+, m_isPinchZoom(false)
 {
 }
 
@@ -227,12 +229,16 @@
     delete m_fastScrollTimer;
 
     delete [] m_ptrbuffer;
+	delete m_pinchZoomHandler;
     delete m_repainttimer;
     delete m_webfeptexteditor;
     delete m_webcorecontext;
     delete m_bitmapdevice;
     delete m_page;
     delete m_pageScaler;
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF    
+    m_pageScaler = NULL;
+#endif    
     delete m_pageView;
     delete m_webFormFill;
     delete m_toolbar;
@@ -337,7 +343,10 @@
     if (m_brctl->capabilities() & TBrCtlDefs::ECapabilityAutoFormFill) {
         m_webFormFill = new WebFormFill(this);
     }
-
+    
+    //Creates the Pinch Zoom Handler
+    m_pinchZoomHandler = WebPagePinchZoomHandler::NewL(this);
+    
     // Create the PointerEventHandler
     m_ptrbuffer = new TPoint[256];
     m_webpointerEventHandler = WebPointerEventHandler::NewL(this);
@@ -360,7 +369,10 @@
     MakeViewVisible(ETrue);
     m_isPluginsVisible=ETrue;
     CCoeControl::SetFocus(ETrue);
-
+#ifdef BRDO_MULTITOUCH_ENABLED_FF
+    //To enable advance pointer info for multi-touch
+    Window().EnableAdvancedPointers();
+#endif 
     cache()->setCapacities(0, 0, defaultCacheCapacity);
     
     m_waiter = new(ELeave) CActiveSchedulerWait();
@@ -404,13 +416,27 @@
         gc.DrawBitmap( m_destRectForZooming, StaticObjectsContainer::instance()->webSurface()->offscreenBitmap(), m_srcRectForZooming );
 
         if ( m_startZoomLevel > m_currentZoomLevel) {
-
+#ifdef BRDO_MULTITOUCH_ENABLED_FF
+            TInt destRectWidth = m_destRectForZooming.Width();
+            TInt destRectHeight = m_destRectForZooming.Height();
+            TRect rectLeft(TPoint(rect.iTl),
+                            TPoint(rect.iTl.iX + m_destRectForZooming.iTl.iX, rect.iBr.iY));
+            
+            TRect rectRight(TPoint(rect.iTl.iX + destRectWidth + m_destRectForZooming.iTl.iX, rect.iTl.iY),
+                            TPoint(rect.iBr));
+            
+            TRect rectTop(TPoint(rect.iTl.iX + m_destRectForZooming.iTl.iX, rect.iTl.iY),
+                              TPoint(rect.iTl.iX + m_destRectForZooming.iTl.iX + destRectWidth, rect.iTl.iY + m_destRectForZooming.iTl.iY));
+
+            TRect rectBottom(TPoint(rect.iTl.iX + m_destRectForZooming.iTl.iX, rect.iTl.iY + m_destRectForZooming.iTl.iY + destRectHeight),
+                              TPoint(rect.iTl.iX + destRectWidth + m_destRectForZooming.iTl.iX, rect.iBr.iY));
+#else 
             TRect rectLeft( TPoint( rect.iTl.iX + m_destRectForZooming.Width() - 2, rect.iTl.iY ),
                             TPoint( rect.iBr ));
 
             TRect rectBottom( TPoint( rect.iTl.iX, rect.iTl.iY + m_destRectForZooming.Height() - 2 ),
                               TPoint( rect.iBr.iX + m_destRectForZooming.Width(), rect.iBr.iY ));
-
+#endif 
 
             const TRgb colorTest(KZoomBgRectColor,KZoomBgRectColor,KZoomBgRectColor);
             gc.SetPenColor(colorTest);
@@ -418,6 +444,10 @@
             gc.SetBrushColor(colorTest);
             gc.DrawRect( rectLeft );
             gc.DrawRect( rectBottom );
+#ifdef BRDO_MULTITOUCH_ENABLED_FF
+            gc.DrawRect( rectRight );
+            gc.DrawRect( rectTop );
+#endif 
 
         }
 
@@ -525,6 +555,7 @@
       clearOffScreenBitmap();
       m_tabbedNavigation->initializeForPage();
       syncRepaint( mainFrame()->frameView()->visibleRect() );
+      TRAP_IGNORE( m_webfeptexteditor->EnableCcpuL() ); 
     }
 
 }
@@ -1073,6 +1104,9 @@
           m_focusedElementType == TBrCtlDefs::EElementBrokenImage ) &&
           keyevent.iRepeats && !m_brctl->wmlMode() ) {
          launchToolBarL();
+        if(m_toolbar) {
+			 sendMouseEventToEngineIfNeeded(TPointerEvent::EButton1Up, cursor->position(), frame);
+        }
      }
     
      return true;
@@ -2015,6 +2049,7 @@
     m_findKeyword = NULL;
     WebFrame* selectedFrame = mainFrame()->findFrameWithSelection();
     selectedFrame->clearSelection();
+    setFocusNone();
 }
 
 bool WebView::isSmallPage()
@@ -2031,26 +2066,6 @@
     }
 }
 
-
-//-------------------------------------------------------------------------------
-// WebView::HandlePointerBufferReadyL
-// Handles pointer move events
-//-------------------------------------------------------------------------------
-void WebView::HandlePointerBufferReadyL()
-{
-    memset(m_ptrbuffer,0,256*sizeof(TPoint));
-    TPtr8 ptr((TUint8 *)m_ptrbuffer,256*sizeof(TPoint));
-
-    TInt numPnts = Window().RetrievePointerMoveBuffer(ptr);
-    int i = 0;
-    for (; i < numPnts; i++) {
-        TPointerEvent pe;
-        pe.iType = TPointerEvent::EDrag;
-        pe.iPosition = m_ptrbuffer[i];
-        m_webpointerEventHandler->HandlePointerEventL(pe);
-    }
-}
-
 //-------------------------------------------------------------------------------
 // WebView::HandlePointerEventL
 // Handles pointer events
@@ -2404,6 +2419,25 @@
     mainFrame()->scalingFactorChanged(z);
     view->checkScrollbarVisibility();
 
+    if (m_isPinchZoom) {
+        if (newZoomLevel > m_startZoomLevel) {
+            TPoint cpos( mainFrame()->frameView()->contentPos());
+            cpos.iX = cpos.iX + m_pinchDocDelta.iX +.5;
+            cpos.iY = cpos.iY + m_pinchDocDelta.iY +.5;
+            mainFrame()->frameView()->setContentPos(cpos);
+        }
+        if (m_startZoomLevel > newZoomLevel) {
+            TPoint cpos( mainFrame()->frameView()->contentPos());
+            cpos.iX = cpos.iX - m_pinchDocDelta.iX +.5;
+            cpos.iY = cpos.iY - m_pinchDocDelta.iY +.5;
+           
+            if (cpos.iX < 0) cpos.iX = 0;
+            if (cpos.iY < 0) cpos.iY = 0;
+            mainFrame()->frameView()->setContentPos(cpos);
+        }
+        m_isPinchZoom = false;
+    }
+   
     TRect rect = view->rect();
 
     TInt tlx = (rect.iTl.iX * currZoomLevel) / m_currentZoomLevel;
@@ -2943,5 +2977,96 @@
     }
 }
 
+//-------------------------------------------------------------------------------
+// WebView::setPinchBitmapZoomLevel
+//-------------------------------------------------------------------------------
+void WebView::setPinchBitmapZoomLevel(int zoomLevel)
+{
+    m_zoomLevelChangedByUser = true;
+    m_dirtyZoomMode = true;
+    m_isPluginsVisible = false;
+    mainFrame()->makeVisiblePlugins(false);
+    m_isPinchZoom = true;
+
+    if (zoomLevel > m_startZoomLevel) {
+        setPinchBitmapZoomIn(zoomLevel);
+    }
+    else {
+        setPinchBitmapZoomOut(zoomLevel);
+    }
+    m_currentZoomLevel = zoomLevel;
+    DrawNow();
+}
+
+//-------------------------------------------------------------------------------
+// WebView::setPinchBitmapZoomIn
+//-------------------------------------------------------------------------------
+void WebView::setPinchBitmapZoomIn(int zoomLevel)
+{
+    TPoint pinchCenter = m_pinchZoomHandler->pinchCenter();
+    
+    // cut m_srcRectForZooming from m_offscreenrect and enlarge it to fit the view rect
+    TRealPoint centerAfterZoom; 
+    //find out the new position of Pinch Center after applying zoom
+    centerAfterZoom.iX = (float)pinchCenter.iX * zoomLevel/m_startZoomLevel;
+    centerAfterZoom.iY = (float)pinchCenter.iY * zoomLevel/m_startZoomLevel;
+    TRealPoint centerDelta;
+    //get the shift in the Pinch Center
+    centerDelta.iX = centerAfterZoom.iX - pinchCenter.iX;
+    centerDelta.iY = centerAfterZoom.iY - pinchCenter.iY;
+    TPoint shiftInView;
+    //find out how much shift needs to be applied to the current zoom, w.r.t. the new view
+    shiftInView.iX = centerDelta.iX * m_startZoomLevel / zoomLevel;
+    shiftInView.iY = centerDelta.iY * m_startZoomLevel / zoomLevel;
+    //width and height of the rectangle that should be used for bitmap stretching 
+    float newWidth  = (float)m_offscreenrect.Width()  * m_startZoomLevel / zoomLevel;
+    float newHeight = (float)m_offscreenrect.Height() * m_startZoomLevel /zoomLevel;
+    //defining the source rectangle which needs to be bitmap stretched
+    m_srcRectForZooming.iTl.iX = shiftInView.iX;
+    m_srcRectForZooming.iTl.iY = shiftInView.iY;
+    m_srcRectForZooming.iBr.iX = newWidth  + shiftInView.iX; 
+    m_srcRectForZooming.iBr.iY = newHeight + shiftInView.iY;
+    //destRectForZooming is the Coecontrol Rect itself
+    m_destRectForZooming = Rect();
+    //get the shift in the document so that during the next engine re-draw, the origin needs to be updated based on that
+    m_pinchDocDelta.iX = (float)shiftInView.iX * 100 / m_startZoomLevel;   
+    m_pinchDocDelta.iY = (float)shiftInView.iY * 100 / m_startZoomLevel;
+}
+
+
+//-------------------------------------------------------------------------------
+// WebView::setPinchBitmapZoomOut
+//-------------------------------------------------------------------------------
+void WebView::setPinchBitmapZoomOut(int zoomLevel)
+{
+    TPoint pinchCenter = m_pinchZoomHandler->pinchCenter();
+
+    // take the whole rect and calculate new rect to fit it the rest of view rect paint gray colour
+    TRealPoint centerAfterZoom; 
+    //find out the new position of Pinch Center after applying zoom
+    centerAfterZoom.iX = (float)pinchCenter.iX * m_startZoomLevel / zoomLevel;
+    centerAfterZoom.iY = (float)pinchCenter.iY * m_startZoomLevel / zoomLevel;
+    TRealPoint centerDelta;
+    //get the shift in the Pinch Center
+    centerDelta.iX = centerAfterZoom.iX - pinchCenter.iX;
+    centerDelta.iY = centerAfterZoom.iY - pinchCenter.iY;
+    TPoint shiftInView;
+    //find out how much shift needs to be applied to the current zoom, w.r.t. the new view
+    shiftInView.iX = centerDelta.iX * zoomLevel / m_startZoomLevel;
+    shiftInView.iY = centerDelta.iY * zoomLevel / m_startZoomLevel;
+    //width and height of the rectangle
+    float newWidth  = (float)m_offscreenrect.Width()  * zoomLevel / m_startZoomLevel;
+    float newHeight = (float)m_offscreenrect.Height() * zoomLevel / m_startZoomLevel;
+    //defining the co-ordinates of the destination rectangle.
+    m_destRectForZooming.iTl.iX = shiftInView.iX;
+    m_destRectForZooming.iTl.iY = shiftInView.iY;
+    m_destRectForZooming.iBr.iX = newWidth  + shiftInView.iX;
+    m_destRectForZooming.iBr.iY = newHeight + shiftInView.iY;
+    //srcRectForZooming is the Coecontrol Rect itself
+    m_srcRectForZooming = Rect();
+    //get the shift in the document so that during the next engine re-draw, the origin needs to be updated based on that
+    m_pinchDocDelta.iX = (float)shiftInView.iX * 100 / zoomLevel;   
+    m_pinchDocDelta.iY = (float)shiftInView.iY * 100 / zoomLevel;
+}
 
 // END OF FILE
--- a/webengine/osswebengine/WebKit/s60/webview/WebView.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/osswebengine/WebKit/s60/webview/WebView.h	Tue Feb 02 00:56:45 2010 +0200
@@ -27,6 +27,7 @@
 #include "PageScaler.h"
 #include "Timer.h"
 #include <MemoryManager.h>
+#include <stmgesturelistener.h>
 
 namespace WebCore
 {
@@ -66,6 +67,7 @@
 class WebPageFullScreenHandler;
 class WebFrameView;
 class WebFrameBridge;
+class WebPagePinchZoomHandler;
 
 
 const TUint KMouseEventFired = 0x00000001;
@@ -294,13 +296,6 @@
         void closeToolBarL();
 
         /**
-        * HandlePointerBufferReadyL
-        * From CCoeControl
-        *
-        */
-        void HandlePointerBufferReadyL();
-
-        /**
         * HandlePointerEventL
         * From CCoeControl
         *
@@ -349,6 +344,26 @@
         * Collects offscreen bitmap 
         */ 
         void  collectOffscreenbitmapL(CFbsBitmap& snapshot); 
+        
+        /**
+        * To get the pinch zoom handler
+        */
+        WebPagePinchZoomHandler* pinchZoomHandler() { return m_pinchZoomHandler; }
+        
+        /**
+        * To set the Bitmap zooming for Pinch
+        */
+        void setPinchBitmapZoomLevel(int zoomLevel);
+        
+        /**
+        * To set the Bitmap zooming In for Pinch
+        */
+        void setPinchBitmapZoomIn(int zoomLevel);
+        
+        /**
+        * To set the Bitmap zooming Out for Pinch
+        */
+        void setPinchBitmapZoomOut(int zoomLevel);
 
     public: // from MPageScalerCallback
         /**
@@ -581,6 +596,11 @@
         
         CActiveSchedulerWait*    m_waiter; 
         WebCore::Timer<WebView>* m_waitTimer;
+        
+		//Pinch Zoom Handler
+        WebPagePinchZoomHandler* m_pinchZoomHandler;
+        TBool                    m_isPinchZoom;
+        TRealPoint               m_pinchDocDelta;
     };
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/webkit/s60/webview/WebGestureInterface.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// INCLUDE FILES
+#include <Browser_platform_variant.hrh>
+#include "config.h"
+#include "../../bidi.h"
+#include <coemain.h>
+#include "WebGestureInterface.h"
+#include "WebView.h"
+#include "WebPointerEventHandler.h"
+
+const TInt TOUCH_AREA_TIMEOUT = 200;
+const TInt TOUCH_TIME_AREA_TIMEOUT = 0;
+const TInt HOLD_AREA_TIMEOUT = 2000;
+const TInt DOUBLE_TAP_TIMEOUT = 400;
+const TInt SUPPRESS_TIMEOUT = 0;
+const TInt MOVE_SUPPRESS_TIMEOUT = 0;
+
+const TInt TOUCH_TIME_AREA_WIDTH = 4;
+const TInt TOUCH_AREA_WIDTH = 4;
+const TInt HOLD_AREA_WIDTH = 4;
+
+const TInt PAN_SPEED_LOW = 0;
+const TInt PAN_SPEED_HIGH = 400;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CgesturetestAppView::NewL()
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+WebGestureInterface* WebGestureInterface::NewL(WebView* view)
+{
+    WebGestureInterface* self = WebGestureInterface::NewLC(view);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CgesturetestAppView::NewLC()
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+WebGestureInterface* WebGestureInterface::NewLC(WebView* view)
+{
+    WebGestureInterface* self = new (ELeave) WebGestureInterface(view);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// WebGestureInterface::WebGestureInterface
+// C++ default constructor
+//
+// -----------------------------------------------------------------------------
+//
+WebGestureInterface::WebGestureInterface(WebView* view)
+: m_webview(view)
+{
+}
+
+// -----------------------------------------------------------------------------
+// WebGestureInterface::~WebGestureInterface
+// -----------------------------------------------------------------------------
+WebGestureInterface::~WebGestureInterface()
+{
+    iGestureContext->Deactivate();
+    iGestureContext->RemoveListener(this);
+    delete iGestureEngine;
+}
+// -----------------------------------------------------------------------------
+// WebGestureInterface::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void WebGestureInterface::ConstructL()
+{
+    iGestureEngine = CStmGestureEngine::NewL();
+    iGestureContext = iGestureEngine->CreateContextL(TInt(this));
+    iGestureContext->SetContext(m_webview);
+    iGestureContext->AddListenerL(this);
+
+    CStmGestureParameters& gestureParams = iGestureContext->Config();
+    //Enable the Gestures needed
+    gestureParams.SetEnabled(stmGesture::EGestureUidTouch, ETrue);
+    gestureParams.SetEnabled(stmGesture::EGestureUidTap, ETrue);
+    gestureParams.SetEnabled(stmGesture::EGestureUidRelease, ETrue);
+    gestureParams.SetEnabled(stmGesture::EGestureUidPan, ETrue);
+    gestureParams.SetEnabled(stmGesture::EGestureUidFlick, ETrue);
+    gestureParams.SetEnabled(stmGesture::EGestureUidLongPress, ETrue);
+#ifdef BRDO_MULTITOUCH_ENABLED_FF
+    gestureParams.SetEnabled(stmGesture::EGestureUidPinch, ETrue);
+#else
+    gestureParams.SetEnabled(stmGesture::EGestureUidPinch, EFalse);
+#endif
+
+    //Set other parameters
+
+    TStmGestureArea& touchTimeArea = *gestureParams.Area(stmGesture::ETouchTimeArea);
+    TStmGestureArea& touchArea = *gestureParams.Area(stmGesture::ETouchArea);
+    TStmGestureArea& holdArea  = *gestureParams.Area(stmGesture::EHoldArea);
+
+    touchTimeArea.iShape = TStmGestureArea::ERectangle;
+    touchTimeArea.iTimeout =  TOUCH_TIME_AREA_TIMEOUT;
+    touchTimeArea.iSize.iWidth = TOUCH_TIME_AREA_WIDTH;
+
+    touchArea.iShape = TStmGestureArea::ERectangle;
+    touchArea.iTimeout =  TOUCH_AREA_TIMEOUT;
+    touchArea.iSize.iWidth = TOUCH_AREA_WIDTH;
+
+    holdArea.iShape = TStmGestureArea::ERectangle;
+    holdArea.iTimeout =  HOLD_AREA_TIMEOUT;
+    holdArea.iSize.iWidth = HOLD_AREA_WIDTH;
+
+    gestureParams[stmGesture::EDoubleTapTimeout   ] = DOUBLE_TAP_TIMEOUT;
+    gestureParams[stmGesture::ESuppressTimeout    ] = SUPPRESS_TIMEOUT;
+    gestureParams[stmGesture::EMoveSuppressTimeout] = MOVE_SUPPRESS_TIMEOUT;
+    gestureParams[stmGesture::EPanSpeedLow        ] = PAN_SPEED_LOW;
+    gestureParams[stmGesture::EPanSpeedHigh       ] = PAN_SPEED_HIGH;
+
+    gestureParams[stmGesture::EEnableFiltering    ] = ETrue;
+#ifdef BRDO_MULTITOUCH_ENABLED_FF
+    gestureParams[stmGesture::ECapacitiveUpUsed   ] = ETrue;
+    gestureParams[stmGesture::EAdjustYPos         ] = ETrue;
+#else
+    gestureParams[stmGesture::ECapacitiveUpUsed   ] = EFalse;
+    gestureParams[stmGesture::EAdjustYPos         ] = EFalse;
+#endif
+    iGestureContext->ActivateL();
+
+}
+
+// -----------------------------------------------------------------------------
+// HandlePointerEventL
+// -----------------------------------------------------------------------------
+void WebGestureInterface::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+{
+    iGestureEngine->HandlePointerEventL(aPointerEvent, m_webview);
+}
+
+// -----------------------------------------------------------------------------
+// HandleGestureEventL
+// -----------------------------------------------------------------------------
+void  WebGestureInterface::HandleGestureEventL(const TStmGestureEvent& aGesture)
+{
+     m_webview->pointerEventHandler()->HandleGestureEventL(aGesture);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/webkit/s60/webview/WebGestureInterface.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Implements gesture interface functionality
+*
+*/
+
+#ifndef WEBGESTUREINTERFACE_H
+#define WEBGESTUREINTERFACE_H
+
+//  INCLUDES
+#include <stmgestureinterface.h>
+
+// MACROS
+
+// FORWARD DECLARATIONS
+class WebView;
+
+// CLASS DECLARATION
+class WebGestureInterface : public CBase, public MStmGestureListener
+    {
+public:
+    // New methods
+
+    /**
+     * NewL.
+     * Two-phased constructor.
+     * Create a WebGestureInterface object
+     * @return a pointer to the created instance of WebGestureInterface.
+     */
+    static WebGestureInterface* NewL(WebView* view);
+
+    static WebGestureInterface* NewLC(WebView* view);
+
+    /**
+     * ~CgestureInterface
+     * Virtual Destructor.
+     */
+    ~WebGestureInterface();
+
+public:   //member functions
+
+    void HandlePointerEventL(const TPointerEvent& aPointerEvent);
+    
+public:  //from MStmGestureListener    
+    
+    void HandleGestureEventL(const TStmGestureEvent& aGesture);
+
+private:
+    // Constructors
+
+    void ConstructL();
+
+    /**
+     * WebGestureInterface.
+     * C++ default constructor.
+     */
+    WebGestureInterface(WebView* view);
+    
+private:   
+    CStmGestureEngine  *iGestureEngine;   // <<owned>>
+    CStmGestureContext *iGestureContext;  // <<not owned>>
+    WebView* m_webview;                   // <<not owned>>
+    };
+
+#endif //  WEBGESTUREINTERFACE_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/webkit/s60/webview/WebPagePinchZoomHandler.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+// INCLUDE FILES
+#include <../bidi.h>
+#include "WebPagePinchZoomHandler.h"
+#include "WebView.h"
+
+
+const int KBitmapUpdateTimeout  = 100*1000;
+const int KPinchExitWaitTimeout = 300*1000;
+
+const int KPinchZoomStepSizeSmall  = 3;
+const int KPinchZoomStepSizeMedium = 4;
+const int KPinchZoomStepSizeLarge  = 5;
+const int KMinPinchFactor = 1;
+
+int pinchBitmapUpdateTimerCb( void* ptr );
+int pinchExitWaitTimerCb( void* ptr );
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// WebPagePinchZoomHandler::NewL
+// The two-phase Symbian constructor
+// -----------------------------------------------------------------------------
+//
+WebPagePinchZoomHandler* WebPagePinchZoomHandler::NewL(WebView* webView)
+{
+    WebPagePinchZoomHandler* self = new (ELeave) WebPagePinchZoomHandler(webView);
+    CleanupStack::PushL(self);
+    self->constructL();
+    CleanupStack::Pop(); //self
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// WebPagePinchZoomHandler::WebPointerEventHandler
+// C++ default constructor
+//
+// -----------------------------------------------------------------------------
+//
+WebPagePinchZoomHandler::WebPagePinchZoomHandler(WebView* webView)
+: m_webView(webView)
+, m_zoomOutBaseLevel(0)
+, m_pinchCenterSet(false)
+, m_zoomStepSize(0)
+, m_pinchActive(false)
+, m_pinchCenter(0,0)
+{
+}
+
+// -----------------------------------------------------------------------------
+// WebPagePinchZoomHandler::constructL
+// The constructor that can contain code that might leave.
+// -----------------------------------------------------------------------------
+//
+void WebPagePinchZoomHandler::constructL()
+{
+    m_bitmapUpdateTimer = CPeriodic::NewL(CActive::EPriorityHigh);
+    m_pinchExitWaitTimer = CPeriodic::NewL(CActive::EPriorityHigh);
+}
+
+// -----------------------------------------------------------------------------
+// WebPagePinchZoomHandler::~WebPagePinchZoomHandler
+// -----------------------------------------------------------------------------
+WebPagePinchZoomHandler::~WebPagePinchZoomHandler()
+{
+    if (m_bitmapUpdateTimer->IsActive())
+        m_bitmapUpdateTimer->Cancel();
+    delete m_bitmapUpdateTimer;
+    
+    if (m_pinchExitWaitTimer->IsActive()) 
+        m_pinchExitWaitTimer->Cancel();
+    delete m_pinchExitWaitTimer;
+
+}
+
+// -----------------------------------------------------------------------------
+// getPinchZoomStepSize
+// -----------------------------------------------------------------------------
+TInt WebPagePinchZoomHandler::getPinchZoomStepSize()
+{
+    TInt zoomStepSize = 0;
+
+    TInt absPinchFactor = Abs (m_pinchFactor);
+    if (absPinchFactor == 0)
+        return zoomStepSize;
+    
+    if ( absPinchFactor >= KMinPinchFactor  &&  absPinchFactor <= 10 ) {
+        zoomStepSize = KPinchZoomStepSizeSmall;
+    }    
+    else if ( absPinchFactor > 10 && absPinchFactor <= 20 ) {
+        zoomStepSize = KPinchZoomStepSizeMedium;
+    }  
+    else if ( absPinchFactor > 20 ) {
+        zoomStepSize = KPinchZoomStepSizeLarge;
+    }
+
+    return (m_pinchFactor/absPinchFactor) * zoomStepSize; 
+}
+
+// -----------------------------------------------------------------------------
+// handlePinchGestureEventL
+// -----------------------------------------------------------------------------
+void WebPagePinchZoomHandler::handlePinchGestureEventL(const TStmGestureEvent& aGesture)
+{
+    if(aGesture.GestureState() == EGestureEnter) {
+        m_pinchActive = true;
+        handlePinchGestureL(aGesture);
+    }
+    else {
+        m_pinchActive = false;
+        handlePinchGestureExitL(aGesture);
+    }
+
+}
+
+// -----------------------------------------------------------------------------
+// handlePinchGestureL
+// -----------------------------------------------------------------------------
+void WebPagePinchZoomHandler::handlePinchGestureL(const TStmGestureEvent& aGesture)
+{
+
+    m_pinchFactor = aGesture.Details();
+    TInt zoomValue = 0;
+    TInt currentZoom = m_webView->zoomLevel();
+    TInt zoomStepSize = getPinchZoomStepSize();
+
+    if (zoomStepSize == 0)
+        return;
+
+    zoomValue = currentZoom + zoomStepSize;
+    if (m_zoomStepSize > 0 && zoomStepSize < 0)  m_zoomOutBaseLevel = currentZoom / 2;
+    
+    m_zoomStepSize = zoomStepSize;
+
+    if(zoomValue >= m_webView->minZoomLevel() && zoomValue <= m_webView->maxZoomLevel()) {
+        if (!m_pinchCenterSet) {
+            TPoint pinchCenter = aGesture.PinchEndPos() + aGesture.CurrentPos(); 
+            m_pinchCenter.iX = pinchCenter.iX / 2;
+            m_pinchCenter.iY = pinchCenter.iY / 2;
+            m_pinchCenterSet = true;
+            if (zoomStepSize < 0)   m_zoomOutBaseLevel = currentZoom / 2;  
+        }
+        if (!(zoomStepSize < 0 && zoomValue < m_zoomOutBaseLevel))
+            setZoomLevel(zoomValue);
+
+    }
+}
+
+// -----------------------------------------------------------------------------
+// handlePinchGestureExitL
+// -----------------------------------------------------------------------------
+void WebPagePinchZoomHandler::handlePinchGestureExitL(const TStmGestureEvent& aGesture)
+{
+    m_zoomOutBaseLevel  = 0;
+    m_zoomStepSize = 0;
+    m_pinchCenterSet = false;
+    if (!m_bitmapUpdateTimer->IsActive()) 
+        m_bitmapUpdateTimer->Start( KBitmapUpdateTimeout,KBitmapUpdateTimeout,TCallBack(&pinchBitmapUpdateTimerCb,this));
+    
+    if (!m_pinchExitWaitTimer->IsActive()) 
+        m_pinchExitWaitTimer->Start( KPinchExitWaitTimeout,0,TCallBack(&pinchExitWaitTimerCb,this));
+    
+}
+
+// -----------------------------------------------------------------------------
+// setZoomLevel
+// -----------------------------------------------------------------------------
+void WebPagePinchZoomHandler::setZoomLevel(int zoomLevel)
+{
+    m_webView->setPinchBitmapZoomLevel(zoomLevel);
+}
+
+// -----------------------------------------------------------------------------
+// isPinchActive
+// -----------------------------------------------------------------------------
+TBool WebPagePinchZoomHandler::isPinchActive()
+{
+  bool pinchActive = false;
+  if (m_pinchActive == true || m_pinchExitWaitTimer->IsActive())
+      pinchActive = true;
+  
+  return pinchActive;
+
+}
+
+// -----------------------------------------------------------------------------
+// updateBitmap
+// -----------------------------------------------------------------------------
+void WebPagePinchZoomHandler::updateBitmap(void)
+{
+    m_bitmapUpdateTimer->Cancel();
+    m_webView->restoreZoomLevel(m_webView->scalingFactor());
+}
+
+// -----------------------------------------------------------------------------
+// handlepinchExitWaitTimer
+// -----------------------------------------------------------------------------
+void WebPagePinchZoomHandler::handlepinchExitWaitTimer(void)
+{
+    m_pinchExitWaitTimer->Cancel();
+}
+
+// -----------------------------------------------------------------------------
+// pinchBitmapUpdateTimerCb
+// -----------------------------------------------------------------------------
+int pinchBitmapUpdateTimerCb(void* ptr)
+{
+    ((WebPagePinchZoomHandler*)ptr)->updateBitmap();
+    return 0;
+}
+
+// -----------------------------------------------------------------------------
+// pinchExitWaitTimerCb
+// -----------------------------------------------------------------------------
+int pinchExitWaitTimerCb(void* ptr)
+{
+    ((WebPagePinchZoomHandler*)ptr)->handlepinchExitWaitTimer();
+    return 0;
+}
+
+//  End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/webkit/s60/webview/WebPagePinchZoomHandler.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Implements pinch functionality
+*
+*/
+
+
+
+#ifndef WEBPAGEPINCHZOOMHANDLER_H
+#define WEBPAGEPINCHZOOMHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <coedef.h>
+#include <w32std.h>
+#include <stmgestureinterface.h>
+
+// MACROS
+
+// FORWARD DECLARATIONS
+class WebView;
+
+
+// CLASS DECLARATION
+class WebPagePinchZoomHandler: public CBase {
+public:  // Constructor and destructor
+
+    /**
+     * Two-phased constructor.
+     **/
+    static WebPagePinchZoomHandler* NewL(WebView* webView);
+
+    /**
+     * Destructor.
+     **/
+    virtual ~WebPagePinchZoomHandler();
+
+private:  // Constructors
+
+    /**
+     * C++ default constructor.
+     **/
+    WebPagePinchZoomHandler(WebView* webView);
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     **/
+    void constructL();
+  
+public: // New functions
+    
+    /**
+     * Handler for Pinch event
+     **/
+    void handlePinchGestureEventL(const TStmGestureEvent& aGesture);
+    
+    /**
+     * Handler for PinchEnter event
+     **/
+    void handlePinchGestureL(const TStmGestureEvent& aGesture);
+    
+    /**
+     * Handler for PinchExit event
+     **/
+    void handlePinchGestureExitL(const TStmGestureEvent& aGesture);
+
+    /**
+     * to set the zoom level for bitmap zooming
+     **/
+    void setZoomLevel(TInt zoomLevel);
+
+    /**
+     * to update the bitmap
+     **/
+    void updateBitmap();
+    
+    /**
+     * to get the pinch step size corresponding to a pinch gesture
+     **/
+    TInt getPinchZoomStepSize();
+    
+    /**
+     * to query whether pinch is active: 
+     * pinch is active once GestureEnter for pinch is received. And it is active until the pinch expiry timer gets expired 
+     **/
+    TBool isPinchActive();
+    
+    /**
+     * handler for pinch exit timer expiry
+     **/
+    void handlepinchExitWaitTimer();
+    
+    /**
+     * To get the pinch center
+     **/
+    TPoint pinchCenter() {return m_pinchCenter;};
+
+private:   
+
+    WebView*         m_webView;            // <<not owned>>
+    CPeriodic*       m_bitmapUpdateTimer;  // <<owned>> 
+    CPeriodic*       m_pinchExitWaitTimer; // <<owned>> 
+    TInt             m_pinchFactor;
+    int              m_zoomOutBaseLevel;
+    bool             m_pinchCenterSet;
+    TInt             m_zoomStepSize;
+    bool             m_pinchActive;
+    TPoint           m_pinchCenter;
+
+};
+
+#endif      //WEBPAGEPINCHZOOMHANDLER_H
+
+// End of File
--- a/webengine/webkitutils/group/bld.inf	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/webkitutils/group/bld.inf	Tue Feb 02 00:56:45 2010 +0200
@@ -19,7 +19,7 @@
 #include "../../../web_plat/browser_platform_api/inc/browser_platform_variant.hrh"
 
 #ifdef BRDO_USE_GESTURE_HELPER
-#include "../rt_gesturehelper/group/bld.inf"
+#include "../stmgesturefw/group/bld.inf"
 #endif 
 
 PRJ_PLATFORMS
--- a/webengine/webkitutils/rt_gesturehelper/bwins/rt_gesturehelperu.def	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-EXPORTS
-	??1CGestureHelper@RT_GestureHelper@@UAE@XZ @ 1 NONAME ; RT_GestureHelper::CGestureHelper::~CGestureHelper(void)
-	?Cancel@CGestureHelper@RT_GestureHelper@@QAEXXZ @ 2 NONAME ; void RT_GestureHelper::CGestureHelper::Cancel(void)
-	?HandlePointerEventL@CGestureHelper@RT_GestureHelper@@QAEHABUTPointerEvent@@@Z @ 3 NONAME ; int RT_GestureHelper::CGestureHelper::HandlePointerEventL(struct TPointerEvent const &)
-	?IsDoubleTapEnabled@CGestureHelper@RT_GestureHelper@@QBEHXZ @ 4 NONAME ; int RT_GestureHelper::CGestureHelper::IsDoubleTapEnabled(void) const
-	?IsHoldingEnabled@CGestureHelper@RT_GestureHelper@@QBEHXZ @ 5 NONAME ; int RT_GestureHelper::CGestureHelper::IsHoldingEnabled(void) const
-	?NewL@CGestureHelper@RT_GestureHelper@@SAPAV12@AAVMGestureObserver@2@@Z @ 6 NONAME ; class RT_GestureHelper::CGestureHelper * RT_GestureHelper::CGestureHelper::NewL(class RT_GestureHelper::MGestureObserver &)
-	?SetDoubleTapEnabled@CGestureHelper@RT_GestureHelper@@QAEXH@Z @ 7 NONAME ; void RT_GestureHelper::CGestureHelper::SetDoubleTapEnabled(int)
-	?SetHoldingEnabled@CGestureHelper@RT_GestureHelper@@QAEXH@Z @ 8 NONAME ; void RT_GestureHelper::CGestureHelper::SetHoldingEnabled(int)
-
--- a/webengine/webkitutils/rt_gesturehelper/eabi/rt_gesturehelperu.def	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-EXPORTS
-	_ZN16RT_GestureHelper14CGestureHelper17SetHoldingEnabledEi @ 1 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper19HandlePointerEventLERK13TPointerEvent @ 2 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper19SetDoubleTapEnabledEi @ 3 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper4NewLERNS_16MGestureObserverE @ 4 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper6CancelEv @ 5 NONAME
-	_ZN16RT_GestureHelper14CGestureHelperD0Ev @ 6 NONAME
-	_ZN16RT_GestureHelper14CGestureHelperD1Ev @ 7 NONAME
-	_ZN16RT_GestureHelper14CGestureHelperD2Ev @ 8 NONAME
-	_ZNK16RT_GestureHelper14CGestureHelper16IsHoldingEnabledEv @ 9 NONAME
-	_ZNK16RT_GestureHelper14CGestureHelper18IsDoubleTapEnabledEv @ 10 NONAME
-
--- a/webengine/webkitutils/rt_gesturehelper/group/bld.inf	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:    Build information 
-*
-*/
-
-
-
-#include <platform_paths.hrh>
-#include "../../../../web_plat/browser_platform_api/inc/browser_platform_variant.hrh"
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-../rom/rt_gesturehelper.iby  CORE_MW_LAYER_IBY_EXPORT_PATH(rt_gesturehelper.iby)
-
-PRJ_MMPFILES
-
-#ifndef __S60_32__
-rt_gesturehelper.mmp
-#endif
-
-PRJ_TESTMMPFILES
-#ifndef __S60_32__
-//#include "../test/group/bld.inf"
-#endif
--- a/webengine/webkitutils/rt_gesturehelper/group/rt_gesturehelper.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:    Project definition file 
-*
-*/
-
-
-
-#include <platform_paths.hrh>
-
-TARGET        rt_gesturehelper.dll
-TARGETTYPE    dll
-UID           0x1000008D 0x200212EA
-
-CAPABILITY    CAP_CLIENT_DLL
-VENDORID      VID_DEFAULT
-
-USERINCLUDE     ../inc
-MW_LAYER_SYSTEMINCLUDE
-
-SOURCEPATH    ../src
-
-SOURCE        gesture.cpp
-SOURCE        gesturehelper.cpp
-SOURCE        gesturehelperimpl.cpp
-SOURCE        gesturerecogniser.cpp
-SOURCE        pointarray.cpp
-SOURCE        utils.cpp 
-SOURCE        gestureeventfilter.cpp
-SOURCE        gesturehelpereventsender.cpp
-
-LIBRARY       avkon.lib
-LIBRARY       cone.lib
-LIBRARY       euser.lib
-LIBRARY       gdi.lib
-LIBRARY       flogger.lib
--- a/webengine/webkitutils/rt_gesturehelper/rom/rt_gesturehelper.iby	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  RT Gesture helper iby file
-*
-*/
-
-
-#ifndef _RT_GESTUREHELPER_IBY_
-#define _RT_GESTUREHELPER_IBY_
-
-#ifdef __S60_32__
-#include <browser_platform_variant.hrh>
-#else
-#include <platform/mw/browser_platform_variant.hrh>
-#endif
-
-#ifdef BRDO_USE_GESTURE_HELPER
-
-#include <data_caging_paths_for_iby.hrh>
-
-file=ABI_DIR\BUILD_DIR\rt_gesturehelper.dll SHARED_LIB_DIR\rt_gesturehelper.dll
-
-#endif // BRDO_USE_GESTURE_HELPER
-
-#endif // _RT_GESTUREHELPER_IBY_
--- a/webengine/webkitutils/rt_gesturehelper/src/gesture.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,726 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture class
-*
-*/
-
-
-#include "gesture.h"
-
-#include <e32math.h>
-#include <coemain.h>
-
-#include "gesturedefs.h"
-#include "utils.h"
-
-using namespace RT_GestureHelper;
-
-/** 
- * Point array for which only x axis is relevant
- */
-class TXAxisPointArray : public TPointArray
-    {
-public:
-    TXAxisPointArray( const RArray< TPointEntry >& aPoints )
-            : TPointArray( aPoints ) {}
-        
-    // from TPointArray
-    TPoint operator[]( TInt aIndex ) const 
-        {
-        return TPoint( Raw( aIndex ).iX, 0 );
-        }
-    };
-
-/** 
- * Point array for which only y axis is relevant
- */
-class TYAxisPointArray : public TPointArray
-    {
-public:
-    TYAxisPointArray( const RArray< TPointEntry >& aPoints )
-            : TPointArray( aPoints ) {}
-    
-    // from TPointArray
-    TPoint operator[]( TInt aIndex ) const 
-        {
-        return TPoint( 0, Raw( aIndex ).iY );
-        }
-    };
-
-namespace 
-    {
-    /** @return the current time */
-    TTime CurrentTime()
-        {
-        TTime time;
-        time.HomeTime();
-        return time;
-        }
-
-    /**
-     * @param aRelevantAxis See @ref MGestureEvent::Code
-     * @return gesture code by analysing the sequence of points
-     */
-    TGestureCode CodeFromPoints( const RArray< TPointEntry >& aPoints, 
-                                 TAxis aRelevantAxis ) 
-        {
-        // select the correct filter based on aRelevantAxis
-        // these filter_ objects are array decorators that will eliminate either 
-        // x, y or neither coordinate of each point
-        TXAxisPointArray filterY( aPoints );
-        TYAxisPointArray filterX( aPoints );
-        TPointArray filterNone( aPoints );
-        TPointArray& filter = 
-            aRelevantAxis == EAxisHorizontal ? static_cast< TPointArray& >( filterY ) : 
-            aRelevantAxis == EAxisVertical   ? static_cast< TPointArray& >( filterX ) :
-            /* otherwise EAxisBoth */                         filterNone;
-                            
-        // currently the gesture recogniser does not have any state, so it is fast
-        // to instantiate. The call is not static however, to allow the recogniser
-        // to be replaced by a more complicated implementation that has state.
-        // then it may make sense to make the recogniser a member variable.
-        return TGestureRecogniser().GestureCode( filter );
-        }
-    } // unnamed namespace
-
-// ----------------------------------------------------------------------------
-// destructor
-// ----------------------------------------------------------------------------
-//
-CGesture::~CGesture()
-    {
-    iPoints.Close();
-    }
-
-// ----------------------------------------------------------------------------
-// AsStartEventL
-// ----------------------------------------------------------------------------
-//
-CGesture* CGesture::AsStartEventLC() const
-    {
-    __ASSERT_DEBUG( 0 < iPoints.Count(), Panic( EGesturePanicIllegalLogic ) );
-    CGesture* gesture = new ( ELeave ) CGesture;
-    CleanupStack::PushL( gesture );
-    User::LeaveIfError( gesture->AddPoint( iPoints[0].iPos, CCoeEnv::Static()->LastEvent().Time()));
-    return gesture;
-    }
-
-// ----------------------------------------------------------------------------
-// Reset
-// ----------------------------------------------------------------------------
-//
-void CGesture::Reset()
-    {
-    iPoints.Reset();
-    iHoldingState = ENotHolding;
-    iState = ENotComplete;
-    iHoldingPointIndex = 0;
-    iIsDoubleTap = EFalse;
-    iIsLongTap = EFalse;
-    }
-    
-// ----------------------------------------------------------------------------
-// Reset
-// ----------------------------------------------------------------------------
-//
-TBool CGesture::IsEmpty() const
-    {
-    return iPoints.Count() == 0;
-    }
-
-// ----------------------------------------------------------------------------
-// Add a point to the sequence of points that together make up the gesture
-// ----------------------------------------------------------------------------
-//
-TInt CGesture::AddPoint( const TPoint& aPoint, const TTime& aEventTime )
-    {
-    if ( !IsLatestPoint( aPoint ) )
-        {
-        return iPoints.Append( TPointEntry( aPoint, aEventTime ) );
-        }
-    return KErrNone;
-    }
-
-// ----------------------------------------------------------------------------
-// SetVisual
-// ----------------------------------------------------------------------------
-//
-
-
-// ----------------------------------------------------------------------------
-// IsNearHoldingPoint
-// ----------------------------------------------------------------------------
-//
-TBool CGesture::IsNearHoldingPoint( const TPoint& aPoint ) const
-    {
-    return ToleranceRect( iPoints[ iHoldingPointIndex ].iPos ).Contains( aPoint );
-    }
-
-// ----------------------------------------------------------------------------
-// IsLatestPoint
-// ----------------------------------------------------------------------------
-//
-TBool CGesture::IsLatestPoint( const TPoint& aPoint ) const
-    {
-    if ( iPoints.Count() > 0 )
-        {
-        return aPoint == CurrentPos();
-        }
-    return EFalse;
-    }
-
-// ----------------------------------------------------------------------------
-// StartHolding
-// ----------------------------------------------------------------------------
-//
-void CGesture::StartHolding()
-    {
-    iHoldingState = EHoldStarting;
-    
-    // remove all points that were introduced after holding started
-    for ( TInt i = iPoints.Count() - 1; i > iHoldingPointIndex; i-- )
-        {
-        iPoints.Remove( i );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// SetHoldingPoint
-// ----------------------------------------------------------------------------
-//
-void CGesture::SetHoldingPoint()
-    {
-    iHoldingPointIndex = iPoints.Count() - 1;
-    }
-
-// ----------------------------------------------------------------------------
-// ContinueHolding
-// ----------------------------------------------------------------------------
-//
-void CGesture::ContinueHolding()
-    {
-    iHoldingState = EHolding;
-    }
-
-// ----------------------------------------------------------------------------
-// SetReleased
-// ----------------------------------------------------------------------------
-//
-void CGesture::SetReleased()
-    {
-    // IsMovementStopped expects SetComplete to be called before SetRelea
-    __ASSERT_DEBUG( EComplete == iState, Panic( EGesturePanicIllegalLogic ) );
-    iState = EReleased;
-    }
-
-/**
- * @return elapsed time between aStartTime and aEndTime
- */
-inline TTimeIntervalMicroSeconds32 Elapsed( const TTime& aStartTime, 
-                                            const TTime& aEndTime )
-    {
-    return aEndTime.MicroSecondsFrom( aStartTime ).Int64();
-    }
-
-// ----------------------------------------------------------------------------
-// SetComplete
-// ----------------------------------------------------------------------------
-//
-void CGesture::SetComplete()
-    {
-    __ASSERT_DEBUG( iPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) );
-    iState = EComplete;
-    iCompletionTime = CurrentTime();
-    }
-
-// ----------------------------------------------------------------------------
-// SetComplete
-// ----------------------------------------------------------------------------
-//
-void CGesture::SetCancelled()
-    {
-    iState = ECancelled;
-    }
-
-void CGesture::SetDoubleTap() 
-    { 
-    iIsDoubleTap = ETrue; 
-    }
-
-void CGesture::SetLongTap(TBool aLongTap) 
-    { 
-    iIsLongTap = aLongTap; 
-    }
-
-// ----------------------------------------------------------------------------
-// IsTap
-// ----------------------------------------------------------------------------
-//
-TBool CGesture::IsTap() const
-    {
-    return CodeFromPoints( iPoints, EAxisBoth ) == EGestureTap;
-    }
-
-/**
- * Translates a non-holding code into a holding code
- * @param aCode original gesture code
- * @return a gesture code with hold flag applied
- */
-inline TGestureCode Hold( TGestureCode aCode )
-    {
-    if ( aCode != EGestureStart && 
-         aCode != EGestureDrag && 
-         aCode != EGestureReleased && 
-         aCode != EGestureUnknown )
-        {
-        return static_cast< TGestureCode >( aCode | EFlagHold );
-        }
-    return aCode;
-    }
-    
-// ----------------------------------------------------------------------------
-// Code
-// ----------------------------------------------------------------------------
-//
-TGestureCode CGesture::Code( TAxis aRelevantAxis ) /* const */
-    {
-    TGestureCode code;
-    
-    switch ( iState )
-        {
-        case ENotComplete:
-            {
-            // "start" event if only first point received
-            // need to check that not holding, in case user pressed stylus
-            // down, and activated holding without moving the stylus
-            if ( iPoints.Count() == 1 && !IsHolding() )
-                {
-                code = EGestureStart;
-                }
-            // "drag" event if holding not started or holding started earlier
-            else if ( iHoldingState != EHoldStarting )
-                {
-                code = EGestureDrag; 
-                }
-            // holding was just started
-            else 
-                {
-                code = Hold( CodeFromPoints( iPoints, aRelevantAxis ) );
-                }
-            iPrevGestureCode = code;
-            break;
-            }
-        case EComplete:
-            {
-            if ( iIsDoubleTap )
-                {
-                code = EGestureDoubleTap;
-                }
-            else if ( iIsLongTap )
-                {
-                code = EGestureLongTap;
-                }
-            
-            else if (iPrevGestureCode == EGestureDrag)
-                {
-                //code = IsFlick() ? EGestureFlick : EGestureDrop;
-                if (IsFlick()) 
-                    {
-                    code = EGestureFlick ;
-                    }
-                  else
-                    {
-                    // Check if it is a swipe.  In this case a swipe is a gesture where 
-                    // - the direction is close to the axes (up, down, left, right)
-                    // - speed is slower than flick 
-                    code = CodeFromPoints( iPoints, aRelevantAxis );
-                    if (code == EGestureUnknown)    
-                      {
-                      code = EGestureDrop ; // It was not a swipe, so then it is the drop gesture 
-                      }
-                    }
-                }
-            else
-                {
-                code = CodeFromPoints( iPoints, aRelevantAxis );
-                }
-            iPrevGestureCode = code;
-            break;
-            }
-            
-        case EReleased:
-            {
-            code = EGestureReleased;
-            break;
-            }
-            
-        case ECancelled: // fallthrough
-        default: 
-            code = EGestureUnknown;
-        }
-    return code;
-    }
-
-
-TBool CGesture::IsFlick() const
-    {
-    bool flick = EFalse;
-    TRealPoint speed = Speed();
-    TReal32 xSpeed = speed.iX;
-    TReal32 ySpeed = speed.iY;
-            
-    flick = (Abs(xSpeed) > KFlickSpeed || 
-             Abs(ySpeed) > KFlickSpeed);
-        
-    return flick;
-    }
-
-// ----------------------------------------------------------------------------
-// IsHolding
-// ----------------------------------------------------------------------------
-//
-TBool CGesture::IsHolding() const
-    {
-    return iHoldingState >= EHoldStarting;
-    }
-
-// ----------------------------------------------------------------------------
-// StartPos
-// ----------------------------------------------------------------------------
-//
-TPoint CGesture::StartPos() const
-    {
-    // at least one point will be in the array during callback (pointer down pos)
-    return iPoints[ 0 ].iPos;
-    }
-
-// ----------------------------------------------------------------------------
-// CurrentPos
-// ----------------------------------------------------------------------------
-//
-TPoint CGesture::CurrentPos() const
-    {
-    // at least on point will be in the array during callback (pointer down pos)
-    return iPoints.Count() > 0 ? iPoints[ iPoints.Count() - 1 ].iPos : TPoint(-1, -1);
-    }
-
-// ----------------------------------------------------------------------------
-// IsMovementStopped
-// ----------------------------------------------------------------------------
-//
-inline TBool CGesture::IsMovementStopped() const
-    {
-    // iCompletionTime is only only valid if client has called SetComplete 
-    if ( iState >= EComplete )
-        {
-        TInt el = Elapsed( NthLastEntry( 1 ).iTime, iCompletionTime ).Int(); 
-        return el > KSpeedStopTime;
-        }
-    return EFalse;
-    }
-
-namespace 
-    {
-    const TInt KFloatingPointAccuracy = 0.000001;
-    
-    /** @return percentage (0.0-1.0) how far aPos is from aEdge1 towards aEdge2 */
-    inline TReal32 Proportion( TReal32 aPos, TReal32 aEdge1, TReal32 aEdge2 )
-        {
-        if ( Abs( aEdge2 - aEdge1 ) > KFloatingPointAccuracy )
-            {
-            return ( aPos - aEdge1 ) / ( aEdge2 - aEdge1 );
-            }
-        return 0; // avoid division by zero 
-        }
-    
-    /** Edges (pixels) at which speed should be -100% or 100% */
-    NONSHARABLE_STRUCT( TEdges )
-        {
-        TReal32 iMin;
-        TReal32 iMax;
-        };
-        
-    /** 
-     * scale which allows different (coordinate -> percentage) mapping
-     * between -100% to 0% and 0 and 100%
-     */
-    NONSHARABLE_STRUCT( TScale )
-        {
-        TScale( TInt aZero, const TEdges& aEdges )
-                : iMin( aEdges.iMin ), iZero( aZero ), iMax( aEdges.iMax )
-            {
-            }
-        
-        /** @return aPos as a percentage between -100% and 100% in aScale */
-        TReal32 Percent( TReal32 aPos ) const;
-
-        /// coordinate where speed is -100%
-        TReal32 iMin;
-        /// coordinate where speed is 0%
-        TReal32 iZero;
-        /// coordinate where speed is 100%
-        TReal32 iMax;
-        };
-        
-    /** @convert aPos into a percentage between -100% and 100% in aScale */
-    TReal32 TScale::Percent( TReal32 aPos ) const
-        {
-        TReal32 percent;
-        if ( aPos < iZero )
-            {
-            // return negative percentages on the lower side of zero point
-            percent = -1 * Proportion( aPos, iZero, iMin );
-            }
-        else 
-            {
-            percent = Proportion( aPos, iZero, iMax );
-            }
-        // constrain between -100% and 100%
-        return Min( Max( percent, -1.0F ), 1.0F );
-        }
-    
-    /** Scale in x and y dimensions */
-    NONSHARABLE_STRUCT( TScale2D )
-        {
-        TRealPoint Percent( const TPoint& aPos ) const
-            {
-            return TRealPoint( iX.Percent( aPos.iX ),
-                               iY.Percent( aPos.iY ) );
-            }
-                
-        TScale iX;
-        TScale iY;
-        };
-            
-    enum TDirection { ESmaller, ELarger };
-    
-    /** @return the direction of pos compared to the previous pos */
-    inline TDirection Direction( TInt aPos, TInt aPreviousPos )
-        {
-        return aPos < aPreviousPos ? ESmaller : ELarger;    
-        }
-
-    /** Direction in x and y dimensions */
-    NONSHARABLE_STRUCT( TDirection2D )
-        {
-        TDirection iX;
-        TDirection iY;
-        };
-
-    /** Return the direction (up/down) of signal at aIndex */
-    inline TDirection2D Direction( TInt aIndex, const RArray< TPointEntry >& aPoints )
-        {
-        const TPoint& pos = aPoints[ aIndex ].iPos;
-        const TPoint& prevPos = aPoints[ aIndex - 1 ].iPos;
-        TDirection2D dir = { Direction( pos.iX, prevPos.iX ),
-                             Direction( pos.iY, prevPos.iY ) };
-        return dir;
-        }   
-    /** 
-     * @return a position in the aLow and aHigh, so that it aProportion of
-     *         of length is above the pos 
-     */
-    TReal32 ProportionalLength( TReal32 aLow, TReal32 aHigh, TReal32 aProportion )
-        {
-        return ( aHigh - aLow ) * aProportion / ( 1 + aProportion );
-        }
-    
-    /** 
-     * @return aVariableEdge scaled to new position, when the other edge changes
-     *         from aOldEdge to aNewEdge, so that aOrigin maintains the *same relative
-     *         position* between aVariableEdge and the other edge 
-     */
-    inline TReal32 ScaledEdge( TReal32 aOrigin, TReal32 aVariableEdge, 
-            TReal32 aOldEdge, TReal aNewEdge )
-        {
-        TReal32 proportion = Proportion( aOrigin, aVariableEdge, aOldEdge );
-        return ( proportion * aNewEdge - aOrigin ) / ( proportion - 1 );
-        }
-    
-    TScale Rescale( TReal32 aPos, TDirection aDir, TDirection aPrevDir, 
-            const TScale& aPrevScale, const TEdges& aEdges )
-        {
-        TScale scale( aPrevScale );
-        if ( aPrevDir != aDir )
-            {
-            // the code duplication is accepted here, since it is difficult to factor out
-            // while maintaining the understandability of this anyway complex algorithm
-            if ( aDir == ESmaller )
-                {
-                scale.iMin = aEdges.iMin;
-                if ( aPrevScale.iZero < aPos )
-                    {
-                    TReal32 proportionAboveZero = Proportion( aPos, aPrevScale.iZero, aPrevScale.iMax );
-                    scale.iZero = aPos - ProportionalLength( aEdges.iMin, aPos, proportionAboveZero );
-                    }
-                else 
-                    {
-                    // adjust zero pos so that proportion between aPos, Min, and Zero pos 
-                    // stay the same (Min will move to 0, aPos stays the same)
-                    scale.iZero = ScaledEdge( aPos, aPrevScale.iZero, 
-                        aPrevScale.iMin, aEdges.iMin );
-                    }
-                // adjust the upper edge to take into account the movement of zero pos
-                scale.iMax = ScaledEdge( aPos, aPrevScale.iMax, 
-                    aPrevScale.iZero, scale.iZero );
-                }
-            else // ELarger
-                {
-                scale.iMax = aEdges.iMax;
-                if ( aPos < aPrevScale.iZero )
-                    {
-                    TReal32 proportionBelowZero = Proportion( aPos, aPrevScale.iZero, aPrevScale.iMin );
-                    scale.iZero = aPos + ProportionalLength( aPos, aEdges.iMax, proportionBelowZero );
-                    }
-                else
-                    {
-                    // adjust zero pos so that proportion between aPos, Max, and Zero pos 
-                    // stay the same (Max will move edge, aPos stays the same)
-                    scale.iZero = ScaledEdge( aPos, aPrevScale.iZero, 
-                        aPrevScale.iMax, aEdges.iMax );
-                    }
-                // adjust the lower edge to take into account the movement of zero pos
-                scale.iMin = ScaledEdge( aPos, aPrevScale.iMin, 
-                    aPrevScale.iZero, scale.iZero );
-                }
-            }
-        return scale;
-        }
-     
-    /** Edges in x and y dimensions */
-    NONSHARABLE_STRUCT( TEdges2D )
-        {
-        TEdges iX;
-        TEdges iY;
-        };
-    
-    /** 
-     * @param aEdges edges of the area in which gesture points are accepted
-     * @return the scale of latest point in the list of points 
-     */
-    TScale2D Scale( const RArray< TPointEntry >& aPoints, const TEdges2D& aEdges )
-        {
-        TScale2D scale = { TScale( aPoints[0].iPos.iX, aEdges.iX ),
-                           TScale( aPoints[0].iPos.iY, aEdges.iY ) };
-        TInt count = aPoints.Count();
-        if ( count > 1 )
-            {
-            // iterate the whole point list to arrive to the current scale
-            TDirection2D dir( Direction( 1, aPoints ) );
-            for ( TInt i = 1; i < count; i++ )
-                {
-                // get direction at i
-                TDirection2D newDir( Direction( i, aPoints ) );
-                // get new scale at i
-                scale.iX = Rescale( aPoints[i - 1].iPos.iX, newDir.iX, dir.iX, scale.iX, aEdges.iX );
-                scale.iY = Rescale( aPoints[i - 1].iPos.iY, newDir.iY, dir.iY, scale.iY, aEdges.iY );
-                dir = newDir;
-                }
-            }
-        return scale;
-        }
-    } // unnamed namespace
-
-TRealPoint CGesture::SpeedPercent( const TRect& aEdges ) const
-    {
-    // x and y coordinates are easier to handle separately, extract from TRect:
-    // ((iMinX, iMinY), (iMaxX, iMaxY)) -> ((iMinX, iMaxX), (iMinY, iMaxY))
-    TEdges2D edges = { { aEdges.iTl.iX, aEdges.iBr.iX },
-                       { aEdges.iTl.iY, aEdges.iBr.iY } };
-    // work out the current scale (coordinate -> percentage mapping) from 
-    // the history of points (i.e., points of current gesture). Then
-    // calculate the percentage of the current position.
-    return Scale( iPoints, edges ).Percent( CurrentPos() );
-    }
-    
-// ----------------------------------------------------------------------------
-// Speed
-// ----------------------------------------------------------------------------
-//
-TRealPoint CGesture::Speed() const
-    {
-    const TReal32 KMicroSecondsInSecond = 1000000;
-    
-    // Speed is only evaluated at the end of the swipe
-    // if user stops at the end of the swipe before lifting stylus,
-    // speed is zero. If time is zero, return 0 speed (infinite does 
-    // not make sense either). Will need to consider also earlier points 
-    // and their times or start time, if this zero-speed behavior is a problem
-    TRealPoint speed;
-    TReal32 time = static_cast<TReal32>( TimeFromPreviousPoint().Int() ) 
-        / KMicroSecondsInSecond;
-    if ( !IsMovementStopped() && time > 0 )
-        {
-        TPoint distance = CurrentPos() - PreviousPos();
-        speed.iX = static_cast<TReal32>( distance.iX ) / time;
-        speed.iY = static_cast<TReal32>( distance.iY ) / time;
-        }
-    return speed;
-    }
-
-// ----------------------------------------------------------------------------
-// Distance
-// ----------------------------------------------------------------------------
-//
-TPoint CGesture::Distance() const
-    {
-    return CurrentPos() - StartPos();
-    }
-
-// ----------------------------------------------------------------------------
-// Visual
-// ----------------------------------------------------------------------------
-//
-
-// ----------------------------------------------------------------------------
-// TimeFromPreviousPoint
-// ----------------------------------------------------------------------------
-//
-inline TTimeIntervalMicroSeconds32 CGesture::TimeFromPreviousPoint() const
-    {
-    const TInt KLatestEntryOffset = 1;
-    return Elapsed( PreviousEntry().iTime, NthLastEntry( KLatestEntryOffset ).iTime );
-    }
-
-// ----------------------------------------------------------------------------
-// return nth point from the end of the points array
-// ----------------------------------------------------------------------------
-//
-inline const TPointEntry& CGesture::NthLastEntry( TInt aOffset ) const
-    {
-    return iPoints[ Max( iPoints.Count() - aOffset, 0 ) ];
-    }
-
-// ----------------------------------------------------------------------------
-// PreviousEntry
-// ----------------------------------------------------------------------------
-//
-inline const TPointEntry& CGesture::PreviousEntry() const
-    {
-    return NthLastEntry( KPreviousPointOffset );
-    }
-
-// ----------------------------------------------------------------------------
-// PreviousPos
-// ----------------------------------------------------------------------------
-//
-inline TPoint CGesture::PreviousPos() const
-    {
-    return PreviousEntry().iPos;
-    }
-
-inline TTime CGesture::TimeOfLastEntry() const
-    {
-    return NthLastEntry( 1 ).iTime;
-    }
--- a/webengine/webkitutils/rt_gesturehelper/src/gesture.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture class
-*
-*/
-
-#ifndef _GESTURE_H_
-#define _GESTURE_H_
-
-#include <e32base.h>
-
-#include <rt_gestureobserver.h>
-#include "gesturerecogniser.h"
-#include "pointarray.h"
-
-namespace RT_GestureHelper
-{
-
-enum TEventState
-    {     
-    ENoEvent = 0,
-    ETouchDown,            
-    ETouchUp,      
-    EMove,
-    ELongTouchDown
-    };
-
-/**  
- * TGesture represents the gesture that the user has made.
- * Implements MGestureEvent interface to allow clients to 
- * inspect the gesture
- */
-NONSHARABLE_CLASS( CGesture ) : public CBase
-    {
-public:  
-    /** destructor */
-    ~CGesture();
-    
-    /** 
-     * @return a new gesture that will have only the first point
-     * of this gesture. Can be used to create gesture's a "start" event
-     * after some other points have been received. 
-     */ 
-    CGesture* AsStartEventLC() const;
-    
-    /** 
-     * Sets the gesture as empty. resets timers to receive points
-     * immediately
-     */
-    void Reset();
-    
-    /** @return ETrue if the gesture has no points */
-    TBool IsEmpty() const;
-    
-    /**
-     * Add a point to the sequence of points that forms the gesture
-     * Call Reset() just before adding the first point
-     * @param aPoint the point to add
-     * @return error code
-     */
-    TInt AddPoint( const TPoint& aPoint, const TTime& eventtime);
-    
-    /** Set the visual of this gesture. Should be called when gesture starts */
-    
-    /** @return ETrue if the point is very near the holding point */
-    TBool IsNearHoldingPoint( const TPoint& aPoint ) const;
-    /** Set the latest point as the holding point */
-    void SetHoldingPoint();
-    /** @return ETrue if aPoint is the same as point added last */
-    TBool IsLatestPoint( const TPoint& aPoint ) const;
-    
-    /** 
-     * After call, Code(...) will return appropriate holding gesture code.
-     */
-    void StartHolding();
-    /** 
-     * After call, Code(...) will return a "hold released" gesture code when
-     * the gesture is completed. Meanwhile, code will be drag.
-     */
-    void ContinueHolding();
-    /** Set as stylus released */
-    void SetReleased();
-    /** Set the gesture as complete. Gesture is completed at pointer up */
-    void SetComplete();
-    /** After call, Code(...) will return a "cancelled" gesture code */
-    void SetCancelled();
-    
-    /** force returning a code as double tap when gesture is complete */
-    void SetDoubleTap();
-    
-    /** 
-     * @return Whether the current gesture is a tap (and hence not a swipe)
-     *         Does not consider holding or other state information (such as
-     *         whether the gesture was just started or is dragging).  
-     *         Results are based purely on the current stream of points.
-     */ 
-    TBool IsTap() const;
-    
-    void SetLongTap(TBool aLongTap);
-    
-// From MGestureEvent
-    TTime TimeOfLastEntry() const;
-    inline TGestureCode PreviousGestureCode() { return iPrevGestureCode; };
-    TGestureCode Code( TAxis aRelevantAxis );
-    TBool IsHolding() const;
-    TPoint StartPos() const;
-    TPoint CurrentPos() const; 
-    TRealPoint Speed() const;
-    TRealPoint SpeedPercent( const TRect& aEdges ) const;
-    TPoint Distance() const; 
-    
-    
-    
-    
-private:
-    /** @return elapsed time between the latest and previous points */
-    inline TTimeIntervalMicroSeconds32 TimeFromPreviousPoint() const; 
-    
-    /** @return elapsed time between the latest and first points */
-    inline TTimeIntervalMicroSeconds32 TimeFromStart() const; 
-    
-    /** @return ETrue if user has stopped moving the stylus before lifting it */
-    inline TBool IsMovementStopped() const;
-    
-    /** @return aOffset'th last entry in the list of points */
-    inline const TPointEntry& NthLastEntry( TInt aOffset ) const;
-    
-    /** @return previous point (may not be exactly the point before last) */
-    inline const TPointEntry& PreviousEntry() const;
-    
-    /** @return position of point received just before the latest point */
-    inline TPoint PreviousPos() const;
-    
-    
-    
-    TBool IsFlick() const;
-private:
-    /// sequence of points that make up the gesture. own.
-    RArray< TPointEntry > iPoints;
-    /// index in iPoints of the point in which user started holding
-    TInt iHoldingPointIndex;
-
-    /// the different states that indicate whether user has made a holding gesture 
-    enum THoldingState
-        {
-        ENotHolding = 0, // before holding activated (i.e., holding not activated)
-        EHoldStarting,   // holding activated just now (lasts just one callback round)
-        EHolding         // holding activated earlier 
-        };
-  
-    /// state that indicates is user has held the pointer down in one position 
-    /// for long time to indicate a holding gesture    
-    THoldingState iHoldingState;
-    
-    /// Whether the gesture completion code will be forcefully overridden to be double tap,
-    /// regardless of what the points are
-    TBool iIsDoubleTap;
-    
-    enum TCompletionState 
-        {
-        // Note: implementation assumes this order of enums
-        ENotComplete = 0,
-        ECancelled,
-        EComplete,
-        EReleased
-        };
-    /// gesture only becomes complete when user lifts the pointer
-    TCompletionState iState;
-
-    /// time when the stylus was lifted.
-    TTime iCompletionTime;
-    
-    /// visual relevant to this gesture. null if not known.
-    
-    TGestureCode iPrevGestureCode;
-    
-    TBool iIsLongTap;
-    TBool iIsStopFlick;
-    };
-
-} // namespace GestureHelper
-
-#endif // _GESTURE_H_
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturedefs.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper constant definitions
-*
-*/
-
-
-#ifndef _GESTUREDEFS_H_
-#define _GESTUREDEFS_H
-
-#include <e32std.h> ///  @todo check this is correct
-
-namespace RT_GestureHelper
-{
-
-/// time to hold the stylus in the same position to activate holding
-const TInt KHoldDuration = 500000; // microseconds 
-
-/// time to tap again for the second tap to be a double tap
-const TInt KMaxDoubleTapDuration = 400000; // microseconds 
-
-/// time in which speed becomes zero if user stops stylus movement before
-/// lifting the pointer
-const TInt KSpeedStopTime = 150000; // microseconds
-
-/// tolerance in degrees to either side of an angle, for direction to be the 
-/// same as reference angle
-const TReal KAngleTolerance = 25;
-
-/// Nth pointer event before the latest point
-const TInt KPreviousPointOffset = 3;
-
-/// Tolerance for ignoring small movements, percent of longer screen edge
-const TInt KGestureTolerancePercent = 2; // of 100
-
-const TInt KFingerSize_mm = 8;
-
-const TInt KTwipsInInch = 1440;
-
-const TReal KTwipsInMm = 56.7;
-
-const TInt  KMaxTapDuration = 300000; //microseconds
-
-const TInt  KFlickSpeed = 500;
-
-const TInt KDoubleTapMaxActivationInterval = 500000;     // 500 ms
-
-const TInt KDoubleTapMinActivationInterval = 40000;   // 40 ms
-
-const TInt KDoubleTapIdleInterval = 700000;           // 700 ms, to prevent triple-tap effects
-
-const TInt KLongTapDuration = 2000000; //2 sec
-
-const TInt KMinTimeBetweenDrags = 20000; // 20 ms
-/** 
- * Panic codes 
- */
-enum TGesturePanic
-    {
-    EGesturePanicIllegalLogic
-    };  
-
-/** Panics the thread */
-inline void Panic( TGesturePanic aReason )
-    {
-     _LIT( KComponentName, "GestureHelper" );
-    User::Panic( KComponentName, aReason );
-    }
-
-} // namespace GestureHelper
-
-#endif // _GESTUREDEFS_H
--- a/webengine/webkitutils/rt_gesturehelper/src/gestureevent.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper implementation
-*
-*/
-
-#ifndef GESTUREEVENT_H_
-#define GESTUREEVENT_H_
-
-#include <e32base.h>
-#include <rt_gestureobserver.h>
-#include "pointarray.h"
-
-namespace RT_GestureHelper
-{
-NONSHARABLE_CLASS( CGestureEvent ) : public CBase, public MGestureEvent
-    {
-public:    
-    // From MGestureEvent
-    TGestureCode Code( TAxis /*aRelevantAxis*/ ) { return iCode; };
-    TBool IsHolding() const { return iIsHolding; };
-    TPoint StartPos() const { return iStartPos; };
-    TPoint CurrentPos() const { return iCurrPos; }; 
-    TRealPoint Speed() const { return iSpeed; };
-    TRealPoint SpeedPercent( const TRect& /*aEdges*/ ) const { return iSpeedPercent; };
-    TPoint Distance() const { return iDistance; }; 
-    CAlfVisual* Visual() const { return iVisual; };
-
-    
-    TGestureCode   iCode;
-    TBool          iIsHolding;
-    TPoint         iStartPos;
-    TPoint         iCurrPos;
-    TRealPoint     iSpeed;
-    TRealPoint     iSpeedPercent;
-    TPoint         iDistance;
-    CAlfVisual*    iVisual;
-    };
-}
-
-
-#endif /* GESTUREEVENT_H_ */
--- a/webengine/webkitutils/rt_gesturehelper/src/gestureeventfilter.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-/*
- * gestureeventfilter.cpp
- *
- *  Created on: Jan 22, 2009
- *      Author: tyutyuni
- */
-
-#include "gesturedefs.h"
-#include "gestureeventfilter.h"
-
-
-using namespace RT_GestureHelper;
-
-CGestureEventFilter::CGestureEventFilter(TInt aTapSize):iTapSize(aTapSize)
-    {
-    
-    }
-
-CGestureEventFilter::~CGestureEventFilter()
-    {
-    
-    }
-
-
-TBool CGestureEventFilter::FilterDrag(const TPointerEvent& aPointerEvent, TInt& aReason)
-    {
-    TTime now;
-    now.HomeTime();
-    return FilterDrag(aPointerEvent, now, aReason);
-    }
-
-TBool CGestureEventFilter::FilterDrag(const TPointerEvent& aPointerEvent, TTime& eventTime, TInt& aReason)
-    {
-    TBool filtered = EFalse;
-    
-    aReason = EFilteredNoReason;
-    
-    switch (aPointerEvent.iType)
-        {
-        case TPointerEvent::EButton1Down:
-            {
-            iIsTouchDown = ETrue;
-            iTouchDownTime = iLastEventTime;
-            iTouchDownPos = aPointerEvent.iPosition;
-            break;
-            }
-        case TPointerEvent::EDrag:
-            {
-            if (iIsTouchDown)
-                {
-                TPoint delta = aPointerEvent.iPosition - iTouchDownPos;
-                filtered = (Abs(delta.iX) <= iTapSize && Abs(delta.iY) <= iTapSize);
-                aReason = (filtered) ? EFilteredBySize : EFilteredNoReason;
-                }
-                
-            if (!filtered)
-                {
-                filtered = (eventTime.MicroSecondsFrom(iLastEventTime) < KMinTimeBetweenDrags);
-                aReason = (filtered) ? EFilteredByTime : EFilteredNoReason;
-                }
-            
-            if (!filtered)
-                {
-                iLastEventTime = eventTime;
-                }
-            iIsTouchDown = filtered;
-            
-            break;
-            }
-        case TPointerEvent::EButton1Up:
-            {
-            iIsTouchDown = EFalse;
-            break;
-            }
-        }
-    
-    
-    return filtered;
-    }
--- a/webengine/webkitutils/rt_gesturehelper/src/gestureeventfilter.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-/*
- * gestureeventfilter.h
- *
- *  Created on: Jan 22, 2009
- *      Author: tyutyuni
- */
-
-#include <e32base.h>
-#include <e32std.h>
-#include <w32std.h>
-
-
-#ifndef GESTUREEVENTFILTER_H_
-#define GESTUREEVENTFILTER_H_
-
-
-
-
-namespace RT_GestureHelper
-{
-
-enum TFilterReason
-    {
-    EFilteredNoReason,
-    EFilteredBySize,
-    EFilteredByTime
-    };
-
-NONSHARABLE_CLASS(CGestureEventFilter) : public CBase
-    {
-    public:
-        CGestureEventFilter(TInt aTapSize);
-        ~CGestureEventFilter();
-        TBool FilterDrag(const TPointerEvent& aPointerEvent, TTime& eventTime, TInt& aReason);
-        TBool FilterDrag(const TPointerEvent& aPointerEvent, TInt& aReason);
-    private:
-        TTime  iTouchDownTime;
-        TPoint iTouchDownPos;
-        TBool  iIsTouchDown;
-        TTime  iLastEventTime;
-        TInt   iTapSize;
-    };
-
-}
-#endif /* GESTUREEVENTFILTER_H_ */
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelper.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper interface
-*
-*/
-
-// class include
-#include <rt_gesturehelper.h>
-
-// local includes
-#include "gesturehelperimpl.h"
-
-using namespace RT_GestureHelper;
-
-// ----------------------------------------------------------------------------
-// Two-phase constructor
-// ----------------------------------------------------------------------------
-//
-EXPORT_C CGestureHelper* CGestureHelper::NewL( MGestureObserver& aObserver )
-    {
-    CGestureHelper* self = new ( ELeave ) CGestureHelper;
-    CleanupStack::PushL( self );
-    self->iImpl = CGestureHelperImpl::NewL( aObserver );    
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// Destructor
-// ----------------------------------------------------------------------------
-//
-EXPORT_C CGestureHelper::~CGestureHelper()
-    {
-    delete iImpl;
-    }
-
-// ----------------------------------------------------------------------------
-// SetHoldingEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CGestureHelper::SetHoldingEnabled( TBool aEnabled )
-    {
-    iImpl->SetHoldingEnabled( aEnabled );
-    }
-
-// ----------------------------------------------------------------------------
-// IsHoldingEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CGestureHelper::IsHoldingEnabled() const
-    {
-    return iImpl->IsHoldingEnabled();
-    }
-
-// ----------------------------------------------------------------------------
-// SetDoubleTapEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CGestureHelper::SetDoubleTapEnabled( TBool aEnabled )
-    {
-    iImpl->SetDoubleTapEnabled( aEnabled );
-    }
-
-// ----------------------------------------------------------------------------
-// IsDoubleTapEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CGestureHelper::IsDoubleTapEnabled() const
-    {
-    return iImpl->IsDoubleTapEnabled();
-    }
-    
-
-
-
-// ----------------------------------------------------------------------------
-// HandlePointerEventL
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CGestureHelper::HandlePointerEventL( const TPointerEvent& aEvent )
-    {
-    return iImpl->HandlePointerEventL( aEvent );
-    }
-
-
-
-
-
-// ----------------------------------------------------------------------------
-// Cancel
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CGestureHelper::Cancel()
-    {
-    iImpl->Reset();
-    }
-
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper implementation
-*
-*/
-
-#include "gesturehelpereventsender.h"
-#include "gesture.h"
-
-using namespace RT_GestureHelper;
-
-const TInt KEventsQueueGranularity = 4;
-
-CGestureEventSender* CGestureEventSender::NewL( MGestureObserver& aObserver )
-    {
-    CGestureEventSender* self = new (ELeave) CGestureEventSender(aObserver);
-    
-    return self;
-    }
-
-CGestureEventSender::CGestureEventSender( MGestureObserver& aObserver ) : 
-                                          CActive(EPriorityUserInput - 1),
-                                          iObserver(aObserver), iEvents(KEventsQueueGranularity)
-    { 
-    CActiveScheduler::Add(this);
-    }
-
-CGestureEventSender::~CGestureEventSender()
-    {
-    if (IsActive()) 
-        {
-        Cancel();
-        }
-
-    iEvents.Close();
-    }
-
-TInt CGestureEventSender::AddEvent(const TGestureEvent& aGestureEvent)
-    {
-    iEvents.Append(aGestureEvent);
-    if (iState != EBusy)
-        {
-        iState = EEventsReady;
-        }
-    
-    if (!IsActive()) 
-        {
-        Complete();
-        }
-    return iEvents.Count();
-    }
-
-void CGestureEventSender::Complete()
-    {
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete(status, KErrNone);
-    SetActive();
-    }
-
-void CGestureEventSender::RunL()
-    {
-    switch (iState)
-        {
-        case EEventsReady:
-            {
-            if (iEvents.Count() > 0)
-                {
-                TInt count = iEvents.Count();
-                for (int i = 0;  i < count; i++)
-                    {
-                    TGestureEvent& gst = iEvents[i];
-                    EmitEventL(gst);
-                    }
-                }
-            iEvents.Reset();
-            iState = ENoEvents;
-            Complete();
-            break;
-            }
-        }
-    }
-
-void CGestureEventSender::EmitEventL( const TGestureEvent& aGesture )
-    {
-    iState = EBusy;
-    iObserver.HandleGestureL(aGesture);
-    iState = EEventsReady;
-    }
-
-TInt CGestureEventSender::RunError(TInt aError)
-    {
-    iEvents.Reset();
-    return aError;
-    }
-
-void CGestureEventSender::DoCancel()
-    {
-    iEvents.Reset();
-    iState = ENoEvents;
-    }
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper implementation
-*
-*/
-
-#ifndef GESTUREHELPEREVENTSENDER_H_
-#define GESTUREHELPEREVENTSENDER_H_
-
-#include <e32base.h>
-#include <coemain.h>
-#include <rt_gesturehelper.h>
-
-namespace RT_GestureHelper
-{
-class MGestureObserver;
-class CGestureEvent;
-
-NONSHARABLE_CLASS(CGestureEventSender) : public CActive
-    {
-public:
-    enum TEventSenderState
-        {
-        ENoEvents,
-        EEventsReady,
-        EBusy
-        };
-    static CGestureEventSender* NewL( MGestureObserver& aObserver );
-    ~CGestureEventSender();
-    TInt AddEvent(const TGestureEvent& aGestureEvent);
-protected:    
-    void RunL();
-    void DoCancel();
-    TInt RunError(TInt aError);
-private:
-    CGestureEventSender(MGestureObserver& aObserver);
-    void Complete();
-    void EmitEventL( const TGestureEvent& aGestureEvent );
-    
-    RArray< TGestureEvent >  iEvents;
-    MGestureObserver& iObserver;
-    TEventSenderState iState;
-    };
-}
-#endif /* GESTUREHELPEREVENTSENDER_H_ */
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,631 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper implementation
-*
-*/
-
-
-#include "gesturehelperimpl.h"
-
-#include <e32base.h>
-#include <w32std.h>
-
-#include "gesture.h"
-#include "gesturedefs.h"
-#include "utils.h"
-#include "gestureeventfilter.h"
-#include "gesturehelpereventsender.h"
-#include "flogger.h"
-
-using namespace RT_GestureHelper;
-
-namespace RT_GestureHelper
-{
-
-/// type of function in gesture helper to be called by the timer
-/// when timer triggers
-typedef void (CGestureHelperImpl::*CallbackFunctionL)();
-
-NONSHARABLE_CLASS( CCallbackTimer ) : public CTimer
-    {
-public:
-    /** Two-phase constructor */
-    static CCallbackTimer* NewL( CGestureHelperImpl& aHelper, 
-            CallbackFunctionL aCallbackFunctionL, TInt aDelay, TBool aIsEnabled )
-        {
-        CCallbackTimer* self = new ( ELeave ) CCallbackTimer( aHelper, 
-            aCallbackFunctionL, aDelay, aIsEnabled );
-        CleanupStack::PushL( self );
-        self->ConstructL(); // construct base class
-        CActiveScheduler::Add( self );
-        CleanupStack::Pop( self );
-        return self;
-        }
-        
-    /** Destructor */
-    ~CCallbackTimer()
-        {
-        Cancel();
-        }
-        
-    /** Set whether sending holding events is currently enabled */
-    void SetEnabled( TBool aEnabled )
-        {
-        iIsEnabled = aEnabled;
-        // cancel in case hold timer is already running
-        Cancel();
-        }
-        
-    /** @return whether sending holding events is currently enabled */
-    TBool IsEnabled() const
-        {
-        return iIsEnabled;
-        }
-        
-    /** Start the timer. Calls CGestureHelperImpl::StartHoldingL upon completion */
-    void Start()
-        {
-        // if sending hold events is disabled, do not ever start the hold timer, and 
-        // hence hold events will never be triggered
-        if ( iIsEnabled ) 
-            {
-            Cancel();
-            After( iDelay );
-            }
-        }    
-    void SetDelay(TInt aDelay) { iDelay = aDelay; }
-    TInt GetDelay() { return iDelay; }
-    
-private:    
-    /** Constructor */
-    CCallbackTimer( CGestureHelperImpl& aHelper,
-        CallbackFunctionL aCallbackFunctionL, TInt aDelay, TBool aIsEnabled )
-            : CTimer( EPriorityUserInput - 1 ), // give higher priority to new pointer events with - 1
-                iHelper( aHelper ), iCallbackFunctionL( aCallbackFunctionL ), 
-                    iDelay( aDelay ), iIsEnabled( aIsEnabled ) 
-        {
-        }
-        
-    void RunL() // From CActive
-        {
-        (iHelper.*iCallbackFunctionL)();
-        }
-
-private:
-    /// helper object that will be called back when timer is triggered
-    CGestureHelperImpl& iHelper;
-    /// Function in the iHelper object call 
-    CallbackFunctionL iCallbackFunctionL;
-    /// How long a time to wait befor calling back after Start()
-    TInt iDelay;
-    /// whether sending holding events is currently enabled
-    TBool iIsEnabled;
-    };
-
-} // namespace GestureHelper
-
-/** 
- * @return position from event. Use this instead of using aEvent direction to
- *         avoid accidentally using TPointerEvent::iPosition
- */
-inline TPoint Position( const TPointerEvent& aEvent )
-    {
-    // use parent position, since the capturer is using full screen area,
-    // and because the (Alfred) drag events are not local to visual even when
-    // coming from the client
-    
-    return aEvent.iPosition;
-    }
-
-// ----------------------------------------------------------------------------
-// Two-phase constructor
-// ----------------------------------------------------------------------------
-//
-CGestureHelperImpl* CGestureHelperImpl::NewL( MGestureObserver& aObserver )
-    {
-    CGestureHelperImpl* self = new ( ELeave ) CGestureHelperImpl( aObserver );
-    CleanupStack::PushL( self );
-    self->iEventSender = CGestureEventSender::NewL( aObserver );
-    self->iDoubleTapTimer = CCallbackTimer::NewL( *self, EmitFirstTapEvent, 
-            KMaxTapDuration, EFalse ); // double tap is disabled by default
-    self->iHoldingTimer = CCallbackTimer::NewL( *self, StartHoldingL, 
-        KHoldDuration, EFalse ); // holding is enabled by default
-    
-    self->iLongTouchTimer = CCallbackTimer::NewL( *self, HandleLongTouch, 
-            KLongTapDuration, ETrue ); // holding is enabled by default
-    
-    self->iGesture = new ( ELeave ) CGesture();
-    self->iUnusedGesture = new ( ELeave ) CGesture();
-    TInt tapLimit = Mm2Pixels(KFingerSize_mm) / 2;
-    self->iEventFilter = new (ELeave) CGestureEventFilter(tapLimit);
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// Constructor
-// ----------------------------------------------------------------------------
-//
-CGestureHelperImpl::CGestureHelperImpl( MGestureObserver& aObserver )
-        : iObserver( aObserver )
-    {
-    }
-
-// ----------------------------------------------------------------------------
-// Destructor
-// ----------------------------------------------------------------------------
-//
-CGestureHelperImpl::~CGestureHelperImpl()
-    {
-    delete iDoubleTapTimer;
-    delete iHoldingTimer;
-    delete iGesture;
-    delete iPreviousTapGesture;
-    delete iUnusedGesture;
-    delete iLongTouchTimer;
-    delete iEventFilter;
-    delete iEventSender;
-    }
-    
-
-// ----------------------------------------------------------------------------
-// SetHoldingEnabled
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::SetHoldingEnabled( TBool aEnabled )
-    {
-    iHoldingTimer->SetEnabled( aEnabled );
-    }
-
-// ----------------------------------------------------------------------------
-// IsHoldingEnabled
-// ----------------------------------------------------------------------------
-//
-TBool CGestureHelperImpl::IsHoldingEnabled() const
-    {
-    return iHoldingTimer->IsEnabled();
-    }
-
-// ----------------------------------------------------------------------------
-// SetHoldingEnabled
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::SetDoubleTapEnabled( TBool aEnabled )
-    {
-    iDoubleTapTimer->SetEnabled( aEnabled );
-    }
-
-// ----------------------------------------------------------------------------
-// IsHoldingEnabled
-// ----------------------------------------------------------------------------
-//
-TBool CGestureHelperImpl::IsDoubleTapEnabled() const
-    {
-    return iDoubleTapTimer->IsEnabled();
-    }
-    
-
-
-// ----------------------------------------------------------------------------
-// Reset state
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::Reset()
-    {
-    iHoldingTimer->Cancel();
-    iLongTouchTimer->Cancel();
-    iGesture->Reset();
-    }
-
-/** 
- * Helper function that calls Reset on the pointer to CGestureHelperImpl
- */
-static void ResetHelper( TAny* aHelper )
-    {
-    static_cast< CGestureHelperImpl* >( aHelper )->Reset();
-    }
-
-// ----------------------------------------------------------------------------
-// Handle a pointer event
-// ----------------------------------------------------------------------------
-//
-TBool CGestureHelperImpl::HandlePointerEventL( const TPointerEvent& aEvent )
-    {     
-    TInt filterReason;
-    SetLastEventTime();
-    if (!iEventFilter->FilterDrag(aEvent, iLastEventTime, filterReason))
-        {
-        return noneAlf_HandlePointerEventL( aEvent );
-        }
-    else
-        {
-        /*
-        TBuf<10> num;
-        num.Num( filterReason );
-        TBuf<128> str;
-        str.AppendFormat(_L("Filter reason: %d"), filterReason);
-        RFileLogger::Write( _L("gh"), _L("gh.txt"), EFileLoggingModeAppend, str);
-        */
-        return EFalse;
-        }
-    }
-
-
-TBool CGestureHelperImpl::noneAlf_HandlePointerEventL( const TPointerEvent& aEvent)
-    {
-    switch ( aEvent.iType )
-        {
-        case TPointerEvent::EButton1Down:
-            {
-            HandleTouchDownL(aEvent);
-            break;
-            }
-        case TPointerEvent::EDrag:
-            {
-            HandleMoveL(aEvent);
-            break;
-            }
-        case TPointerEvent::EButton1Up:
-            {
-            if (KErrNone == AddPoint( aEvent ))
-                {
-                HandleTouchUp(aEvent);
-                }
-            else
-                {
-                EmitCancelEvent();
-                }
-            Reset();
-            break;
-            }
-        default:
-            break;
-        }
-    return ETrue;
-    }
-
-TBool CGestureHelperImpl::IsMovementGesture(TGestureCode aCode)
-    {
-    return (aCode == EGestureDrag || aCode == EGestureFlick || aCode == EGestureSwipeUp ||
-            aCode == EGestureSwipeDown || aCode == EGestureSwipeRight || aCode == EGestureSwipeLeft);
-    }
-
-void CGestureHelperImpl::HandleLongTouch()
-    {
-    iDoubleTapTimer->Cancel();
-    iGesture->SetLongTap(ETrue);
-    iGesture->SetComplete();
-    TPoint startPos = iGesture->StartPos();
-    EmitEvent(*iGesture);
-    iGesture->Reset();
-    iGesture->AddPoint( startPos, GetLastEventTime() );
-    }
-
-void CGestureHelperImpl::HandleTouchDownL(const TPointerEvent& aEvent)
-    {
-    TGestureCode prevCode = iGesture->PreviousGestureCode();
-    if (prevCode == EGestureStart) return;
-    if (prevCode == EGestureDrag) 
-        {
-        iGesture->Reset();
-        }
-    AddPointL( aEvent );
-    
-    if (!iLongTouchTimer->IsActive())
-        {
-    iLongTouchTimer->Start();
-        }
-    if (!iDoubleTapTimer->IsActive())
-        {
-            EmitEvent( *iGesture );
-        }
-    }
-
-void CGestureHelperImpl::HandleMoveL(const TPointerEvent& aEvent)
-    {
-    if (iGesture->IsLatestPoint( Position(aEvent))) return; // I'm not sure we need this
-    //Cancel double tap time - it's neither tap nor double tap 
-    iDoubleTapTimer->Cancel();
-    iLongTouchTimer->Cancel();
-    
-    TBool isFirstPoint = IsIdle();
-    
-    AddPointL( aEvent );
-    
-    if (iPreviousTapGesture)
-        {
-        RecycleGesture(iPreviousTapGesture);
-        }
-    
-    if (!isFirstPoint)
-        {
-        EmitEvent( *iGesture );
-        }
-    }
-
-void CGestureHelperImpl::HandleTouchUp(const TPointerEvent& /*aEvent*/)
-    {
-    TGestureCode prevCode = iGesture->PreviousGestureCode();
-    iLongTouchTimer->Cancel();
-    iDoubleTapTimer->Cancel();
-    TInt64 fromLastTouchUp = iLastEventTime.MicroSecondsFrom(iLastTouchUpTime).Int64();
-    TInt64 fromLastDoubleTap = iLastEventTime.MicroSecondsFrom(iLastDoubleTapTime).Int64();
-    /*
-    TBuf<1024> str;
-    str.AppendFormat(_L("fromLastTouchUp: %d, "), fromLastTouchUp);
-    str.AppendFormat(_L("fromLastDoubleTap: %d, "), fromLastTouchUp);
-    str.AppendFormat(_L("iPreviousTapGesture: %d, "), iPreviousTapGesture);
-    RFileLogger::Write( _L("gh"), _L("gh.txt"), EFileLoggingModeAppend, str);
-    */
-    if ( prevCode == EGestureLongTap )
-        {
-        EmitReleasedEvent();
-        }
-    else if (IsMovementGesture(prevCode) || 
-             !iDoubleTapTimer->IsEnabled() /* || !iGesture->IsTap()*/ ) 
-        {
-        iGesture->SetComplete();
-        EmitEvent(*iGesture);
-        }
-    
-    else 
-        {
-        if ( iPreviousTapGesture && 
-         (fromLastTouchUp > KDoubleTapMinActivationInterval) &&       
-         (fromLastTouchUp < KDoubleTapMaxActivationInterval) &&
-         (fromLastDoubleTap > KDoubleTapIdleInterval))
-            {
-            // it's a double tap
-            iLastTouchUpTime = iLastEventTime;
-            iLastDoubleTapTime = iLastEventTime;
-            EmitDoubleTapEvent();
-            }
-        else
-            {
-            // it's a first tap
-            iLastTouchUpTime = iLastEventTime;
-            if (iPreviousTapGesture)
-                {
-                   RecycleGesture(iPreviousTapGesture);
-                }
-                        
-            iPreviousTapGesture = iGesture;
-            iGesture = NewGesture();
-            iDoubleTapTimer->Start(); 
-            }
-        }
-    }
-
-
-
-void CGestureHelperImpl::EmitDoubleTapEvent()
-    {
-    iPreviousTapGesture->SetDoubleTap();
-    EmitFirstTapEvent();
-    }
-
-
-void CGestureHelperImpl::EmitReleasedEvent()
-    {
-    iGesture->SetComplete();
-    iGesture->SetReleased();
-    EmitEvent(*iGesture);
-    }
-
-
-// ----------------------------------------------------------------------------
-// Is the helper idle?
-// inline ok in cpp file for a private member function
-// ----------------------------------------------------------------------------
-//
-inline TBool CGestureHelperImpl::IsIdle() const
-    {
-    return iGesture->IsEmpty();
-    }
-
-// ----------------------------------------------------------------------------
-// Add a point to the sequence of points that together make up the gesture
-// inline ok in cpp file for a private member function
-// ----------------------------------------------------------------------------
-//
-inline void CGestureHelperImpl::AddPointL( const TPointerEvent& aEvent )
-    {
-    User::LeaveIfError( AddPoint( aEvent ) );
-    }
-
-// ----------------------------------------------------------------------------
-// Add a point to the sequence of points that together make up the gesture
-// inline ok in cpp file for a private member function
-// ----------------------------------------------------------------------------
-//
-inline TInt CGestureHelperImpl::AddPoint( const TPointerEvent& aEvent )
-    {
-    TPoint pos = Position ( aEvent );
-    return iGesture->AddPoint( pos, GetLastEventTime() );
-    }
-
-// ----------------------------------------------------------------------------
-// StartHoldingTimer
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::StartHoldingTimer( const TPointerEvent& aNewEvent )
-    {
-    if ( !( iGesture->IsHolding() ||
-            iGesture->IsNearHoldingPoint( Position( aNewEvent ) ) ) )
-        {
-        // restart hold timer, since pointer has moved
-        iHoldingTimer->Start();
-        // Remember the point in which holding was started
-        iGesture->SetHoldingPoint();
-        }
-    }
-
-/** 
- * Helper function that calls ContinueHolding on the pointer to TGesture
- */
-static void ContinueHolding( TAny* aGesture )
-    {
-    static_cast< CGesture* >( aGesture )->ContinueHolding();
-    }
-
-// ----------------------------------------------------------------------------
-// Add a point to the sequence of points that together make up the gesture
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::StartHoldingL()
-    {
-    // hold & tap event is specifically filtered out. Use case: in list fast 
-    // scrolling activation (e.g. enhanced coverflow), tap & hold should not
-    // start fast scroll. In addition, after long tap on start position,
-    // drag and drag & hold swiping should emit normal swipe and swipe&hold
-    // events. Therefore, tap & hold is not supported.
-    __ASSERT_DEBUG( !iGesture->IsTap() && !iPreviousTapGesture, Panic( EGesturePanicIllegalLogic ) );
-    
-    // holding has just started, and gesture code should be provided to client.
-    // set gesture state so that it produces a gesture code (other than drag)
-    iGesture->StartHolding();
-    
-    // create an item in the cleanup stack that will set the gesture state
-    // to holding-was-started-earlier state. NotifyL may leave, but the
-    // holding-was-started-earlier state must still be successfully set,
-    // otherwise, the holding gesture code will be sent twice
-    CleanupStack::PushL( TCleanupItem( &ContinueHolding, iGesture ) );
-    
-    EmitEvent( *iGesture );
-    
-    // set holding state to "post holding"
-    CleanupStack::PopAndDestroy( iGesture );
-    }
-
-// ----------------------------------------------------------------------------
-// RecyclePreviousTapGesture
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::RecyclePreviousTapGesture( TAny* aSelf )
-    {
-    CGestureHelperImpl& self = *reinterpret_cast<CGestureHelperImpl*>( aSelf );
-    self.RecycleGesture( self.iPreviousTapGesture );
-    }
-
-// ----------------------------------------------------------------------------
-// Emit the remainder of the previous tap event (tap + released)
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::EmitFirstTapEvent()
-    {
-    // when this function is called, a tap has turned out to _not_ be a double tap
-    __ASSERT_DEBUG( IsDoubleTapEnabled(), Panic( EGesturePanicIllegalLogic ) );
-    __ASSERT_DEBUG( iPreviousTapGesture, Panic( EGesturePanicIllegalLogic ) );
-    
-    iDoubleTapTimer->Cancel();
-    CompleteAndEmit( *iPreviousTapGesture );
-    RecycleGesture(iPreviousTapGesture);
-     
-    }
-
-// ----------------------------------------------------------------------------
-// EmitStartEventL
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::EmitStartEventL( const CGesture& aGesture )    
-    {
-    CGesture* startGesture = aGesture.AsStartEventLC();
-    EmitEvent( *startGesture );
-    CleanupStack::PopAndDestroy( startGesture );    
-    }
-    
-// ----------------------------------------------------------------------------
-// EmitCompletionEventsL
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::CompleteAndEmit( CGesture& aGesture )
-    {
-    aGesture.SetComplete();
-    // send gesture code if holding has not been started. If holding has 
-    // been started, client has already received a "hold swipe left" e.g. event, in which
-    // case don't another "swipe left" event
-    if ( !aGesture.IsHolding() )
-        {
-        // if client leaves, the state is automatically reset.
-        // In this case the client will not get the released event
-        EmitEvent( aGesture ); 
-        }
-    
-    // send an event that stylus was lifted
-    aGesture.SetReleased();
-    EmitEvent( aGesture ); 
-    }
-    
-// ----------------------------------------------------------------------------
-// EmitCancelEventL
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::EmitCancelEvent()
-    {
-    iDoubleTapTimer->Cancel();
-
-    
-    CGesture& gestureToCancel = iPreviousTapGesture ? *iPreviousTapGesture : *iGesture;
-    gestureToCancel.SetCancelled();
-    EmitEvent( gestureToCancel );
-    RecycleGesture(iPreviousTapGesture);
-    
-    }
-
-// ----------------------------------------------------------------------------
-// Notify observer
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::EmitEvent( const CGesture& aGesture )
-    {
-    // deallocation of the event is happening in CGestureEventSender::RunL() 
-    TGestureEvent event;
-    event.SetCode(const_cast<CGesture&>(aGesture).Code(EAxisBoth));
-    event.SetCurrentPos(aGesture.CurrentPos());
-    event.SetDistance(aGesture.Distance());
-    event.SetStartPos(aGesture.StartPos());
-    event.SetIsHolding(aGesture.IsHolding());
-    event.SetSpeed(aGesture.Speed());
-    iEventSender->AddEvent(event);
-    }
-
-// ----------------------------------------------------------------------------
-// Return a fresh gesture from the gesture pool (pool of one gesture)
-// ----------------------------------------------------------------------------
-//
-CGesture* CGestureHelperImpl::NewGesture()
-    {
-    __ASSERT_DEBUG( iUnusedGesture, Panic( EGesturePanicIllegalLogic ) ); // pool should no be empty
-    
-    iUnusedGesture->Reset();
-    CGesture* freshGesture = iUnusedGesture;
-    iUnusedGesture = NULL;
-    return freshGesture;
-    }
-
-// ----------------------------------------------------------------------------
-// Return a fresh gesture from the gesture pool (pool of one gesture)
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::RecycleGesture( CGesture*& aGesturePointer )
-    {
-    // only one object fits into the pool, and that should currently be enough
-    // one pointer must be null, one non-null
-    __ASSERT_DEBUG( !iUnusedGesture != !aGesturePointer, Panic( EGesturePanicIllegalLogic ) );
-    if ( aGesturePointer )
-        {
-        iUnusedGesture = aGesturePointer;
-        aGesturePointer = NULL;
-        }
-    }
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper implementation
-*
-*/
-
-
-#ifndef _GESTUREHELPERIMPL_H_
-#define _GESTUREHELPERIMPL_H_
-
-#include <e32base.h>
-#include <coemain.h>
-#include <rt_gesturehelper.h>
-
-
-struct TPointerEvent;
-
-namespace RT_GestureHelper
-{
-
-class CCallbackTimer;
-class CGesture;
-class CPointerCapturer;
-class MGestureObserver;
-class CGestureEventFilter;
-class CGestureEventSender;
-
-/**
- * Implementation of CGestureHelper interface
- */
-NONSHARABLE_CLASS( CGestureHelperImpl ) : public CBase
-    {
-public:
-    /** 2-phase constructor */
-    static CGestureHelperImpl* NewL( MGestureObserver& aObserver );
-    
-    /** Destructor */
-    ~CGestureHelperImpl();    
-    
-    
-    /** See @ref CGestureHelper::SetHoldingEnabled */
-    void SetHoldingEnabled( TBool aEnabled );
-    /** See @ref CGestureHelper::IsHoldingEnabled */
-    TBool IsHoldingEnabled() const;
-    /** See @ref CGestureHelper::SetDoubleTapEnabled */
-    void SetDoubleTapEnabled( TBool aEnabled );
-    /** See @ref CGestureHelper::IsDoubleTapEnabled */
-    TBool IsDoubleTapEnabled() const;
-    /** See @ref CGestureHelper::HandlePointerEventL */
-    TBool HandlePointerEventL( const TPointerEvent& aEvent );
-    
-    /** Reset helper state */
-    void Reset();
-   
-    void SetLastEventTime() {iLastEventTime.HomeTime(); } /*CCoeEnv::Static()->LastEvent().Time();*/ 
-    
-    
-    TTime GetLastEventTime() const { return iLastEventTime; }
-private:
-    /** Constructor */
-    CGestureHelperImpl( MGestureObserver& aObserver );
-
-    
-    
-    TBool noneAlf_HandlePointerEventL( const TPointerEvent& aEvent);
-
-    /** @return ETrue if the helper has not started processing a gesture */
-    inline TBool IsIdle() const;
-    /** Add a point to the sequence of points that make up the gesture */
-    inline void AddPointL( const TPointerEvent& aEvent );    
-    /** Add a point to the sequence of points that make up the gesture */
-    inline TInt AddPoint( const TPointerEvent& aEvent );    
-    /** Activates holding and notifies observer that holding has been started */
-    void StartHoldingL();
-    /* Set previous tag gesture to null (and recycle the gesture object) */
-    static void RecyclePreviousTapGesture( TAny* aSelf );
-    /** Emits a tap event since second tap of a double tap was not received within timeout */
-    void EmitFirstTapEvent();
-    /** Emit the start gesture event that aGesture would have produced */
-    void EmitStartEventL( const CGesture& aGesture );
-    /** 
-     * Send code event if not holding. Also sets the event to released and emits again.
-     * Modifies aGesture! 
-     */
-    void CompleteAndEmit( CGesture& aGesture );
-    /** 
-     * Send cancel event about the latest gesture client was notified about 
-     * Sets the latest gesture to Cancelled.
-     */
-    void EmitCancelEvent();
-    
-    /**
-     * Send Released event
-     */
-    void EmitReleasedEvent();
-    
-    /** Notify observer of the gesture */
-    void EmitEvent( const CGesture& aGesture );
-    /** 
-     * (re)start holding timer at the current point.
-     * Does not restart holding if the point (in aEvent) is near enough to where holding 
-     * was started earlier. (Allows small movement but still starting holding.
-     */
-    void StartHoldingTimer( const TPointerEvent& aNewEvent );
-
-    /** 
-     * @return a gesture object from the gesture pool 
-     * Getting gestures from the gesture pool avoids the need to create gestures
-     * after construction. There is max only one gesture object in the pool, 
-     * but no more is needed 
-     */
-    CGesture* NewGesture();
-    /** Move the gesture into the gesture pool, and set aGesturePointer to null */
-    void RecycleGesture( CGesture*& aGesturePointer );
-    
-    
-    void HandleTouchUp(const TPointerEvent& aEvent);
-    void HandleTouchDownL(const TPointerEvent& aEvent);
-    void HandleMoveL(const TPointerEvent& aEvent);
-    void HandleLongTouch();
-    void EmitDoubleTapEvent();
-    TBool IsMovementGesture(TGestureCode aCode);
-    
-private:
-    /// Gesture is the logical representation of a sequence of points arriving
-    /// at certain times
-    /// This is the current gesture
-    CGesture* iGesture;
-    
-    /// Tap gesture of the previous gesture. Used when double tap is enabled.
-    /// The gesture is cached, since it cannot be emitted until gesture helper
-    /// knows whether the next gesture forms a double tap
-    /// @see CGestureHelperImpl::iDoubleTapTimer
-    CGesture* iPreviousTapGesture;
-
-    /// This is a recyclable object pool with just one object.
-    /// This class needs one or two gesture objects at any one time. There is one
-    /// less error condition to handle if gesture objects are not created after
-    /// construction. Therefore, if only one gesture object is needed at a specific,
-    /// point in time, the unused gesture object is stored here.
-    CGesture* iUnusedGesture;
-    
-    /// When double tap is enabled, a tap
-    /// event (and it's released event) is only emitted after the double tap timeout
-    /// passes. If user taps again before the timeout (in the same position),
-    /// this gesture is emitted as a double tap (followed by the released event, 
-    /// and the second tap is not emitted at all.
-    /// If user taps, and then swipes before the double tap timeout, this tap
-    /// event (and it's released event) event is emitted, and only then the swipe's
-    /// down and drag events are emitted. In other words, if user presses down
-    /// during the timeout, the down event it not emitted until the gesture
-    /// helper knows that the gesture is not another tap.
-    /// Behavior while double tap enabled:
-    /// Swipe: Down + drag + up => emits down + swipe/cancel + released
-    /// Tap: Down + up => emits down ... timeout ... + tap + released
-    /// Double tap: Down + up + down + up => emits down ... double tap + released
-    /// Tap + quick swipe: Down + up + down + drag + ... => emits down ... tap + up (for tap) + down (for swipe ) + drag + ...
-    /// Double tap timer is cancelled when the second pointer down event is received,
-    /// i.e., it does not matter if user does this: 
-    /// down + up + down ... long wait ... + up. It's still a double tap.
-    CCallbackTimer* iDoubleTapTimer;
-    
-    /// holding is activated when user keeps pointer down in the same place for 
-    /// a longer period. the holding timer activates off when enough time has passed.
-    CCallbackTimer* iHoldingTimer;
-    
-    /// observer for gesture events
-    MGestureObserver& iObserver;
-    
-    /// captures subsequent pointer events after pointer down received,
-    /// until pointer up
-    CPointerCapturer* iPointerCapturer;
-
-    TTime  iLastEventTime;
-    TTime  iLastTouchUpTime;
-    TTime  iLastDoubleTapTime;
-    
-    CCallbackTimer*  iLongTouchTimer;
-    CGestureEventFilter* iEventFilter;
-    CGestureEventSender* iEventSender;
-    };
-    
-} // GestureHelper
-
-#endif // _GESTUREHELPERIMPL_H_
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturerecogniser.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper implementation
-*
-*/
-
-#include "gesturerecogniser.h"
-
-#include <e32math.h>
-
-#include "gesturedefs.h"
-#include <rt_gestureobserver.h>
-#include "pointarray.h"
-#include "utils.h"
-
-using namespace RT_GestureHelper;
-
-/**
- * Vector class (math)
- */
-NONSHARABLE_CLASS( TVector )
-    {
-public:
-    /** 
-     * Constructor
-     * @param aFrom starting point of the vector
-     * @param aTo ending point of the vector
-     */
-    TVector( const TPoint& aFrom, const TPoint& aTo )
-            : iX( aTo.iX - aFrom.iX ),
-              iY( aTo.iY - aFrom.iY )
-        {
-        }
-        
-    /** @return angle of the vector */
-    TReal Angle() const
-        {
-        TReal angle = 0;   
-        TReal length = Length();
-        if ( length != 0 )
-            {
-            Math::ACos( angle, iX / Length() );
-            if ( iY < 0 )
-                {
-                angle = 2 * KPi - angle;
-                }
-            }
-        return Degrees( angle ); 
-        }
-        
-    /** @return length of the vector */
-    TReal Length() const
-        {
-        TReal length = 0;
-        Math::Sqrt( length, iX * iX + iY * iY );
-        return length;
-        }
-
-private:
-    /** @return radians in degrees */
-    inline TReal Degrees( TReal aRadians ) const
-        {
-        return aRadians * 180 / KPi;
-        }
-
-public:
-    /// x coordinate that represent the vector
-    TReal iX;
-    /// y coordinate that represent the vector
-    TReal iY;
-    };
-
-inline TPoint LastPoint( const TPointArray& aPoints ) 
-    {
-    __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) );
-    return aPoints[ aPoints.Count() - 1 ] ;
-    }
-
-/** 
- * @return Length of the gesture in points
- */
-inline TReal GestureLength( const TPointArray& aPoints )
-    {
-    return TVector( aPoints[0], LastPoint( aPoints ) ).Length();
-    }
-
-/** 
- * @return ETrue if aAngleUnderTest is almost aAngle
- *         Closeness of the angles is controlled by KAngleTolerance
- */
-static TBool IsNear( TReal aAngleUnderTest, TReal aAngle )
-    {
-    return aAngle - KAngleTolerance <= aAngleUnderTest && 
-           aAngleUnderTest <= aAngle + KAngleTolerance;
-    }
-    
-/**
- * @return the angle as a direction flags of TGesture
- */
-inline TGestureCode Direction( TReal aAngle ) 
-    {
-    TGestureCode direction = EGestureUnknown;
-
-    if ( IsNear( aAngle, 90.0 ) )
-        {
-        direction = EGestureSwipeDown;
-        }
-    else if ( IsNear( aAngle, 180.0 ) )
-        {
-        direction = EGestureSwipeLeft;
-        }
-    else if ( IsNear( aAngle, 270.0 ) )
-        {
-        direction = EGestureSwipeUp;
-        }
-    else if ( 360.0 - KAngleTolerance <= aAngle || aAngle <= KAngleTolerance )
-        {
-        direction = EGestureSwipeRight;
-        }
-    else // for lint warning
-        {
-        // unknown angle
-        }
-    
-    return direction;
-    }
-
-/** @return direction between points */
-inline TGestureCode Direction( const TPoint& aFromPoint, const TPoint& aToPoint )
-    {
-    return Direction( TVector( aFromPoint, aToPoint ).Angle() );
-    }
-    
-/** @return overall direction between points */
-static TGestureCode GeneralDirection( const TPointArray& aPoints ) 
-    {
-    // If the start and end points are too close to each other, direction
-    // is undefined
-    if ( ToleranceRect( aPoints[0] ).Contains( LastPoint( aPoints ) ) )
-        {
-        return EGestureUnknown;
-        }
-    return Direction( aPoints[0], LastPoint( aPoints ) );
-    }
-
-// function type to get a point in the point array
-typedef TPoint (TPointArray::*PointByIndexFunc)( TInt aIndex ) const;    
-
-/// @return latest point outside tolerance area or KErrNotFound if not point outside it
-TInt LatestCertainPointIndex( const TPointArray& aPoints, PointByIndexFunc aPointByIndex )   
-    {
-    __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) );
-
-    int i = aPoints.Count();
-    TRect toleranceRect = ToleranceRect( (aPoints.*aPointByIndex)( aPoints.Count() - 1 ) );
-    // Find out the first point from the end of the array  
-    // that is not contained in the tolerance rect.
-    while( 0 <= --i )
-        {
-        // if the point does not belong inside tolerance rect, it is the first point
-        // outside the rect
-        if( !toleranceRect.Contains( (aPoints.*aPointByIndex)(i) ) )
-            {
-            break;
-            }
-        }
-    return i;
-    }
-    
-/** @return last direction of dragging */
-inline TGestureCode LastDirection( const TPointArray& aPoints ) 
-    {
-    TInt latestPointIndex = LatestCertainPointIndex( aPoints, TPointArray::operator[] );
-    if ( KErrNotFound != latestPointIndex )
-        {
-        return Direction( aPoints[latestPointIndex], LastPoint( aPoints ) );
-        }
-    // no points were outside the rect, and hence the direction is unknown
-    return EGestureUnknown;
-    }
-    
-/**
- * @return ETrue if points for a tap event
- */
-inline TBool IsTap( const TPointArray& aPoints )
-    {
-    return KErrNotFound == LatestCertainPointIndex( aPoints, TPointArray::Raw );
-    }  
-    
-// ----------------------------------------------------------------------------
-// Return gesture code of a gesture formed by a sequence of points
-// ----------------------------------------------------------------------------
-//
-TGestureCode TGestureRecogniser::GestureCode( const TPointArray& aPoints ) const
-    {
-    __ASSERT_DEBUG( aPoints.Count() > 0, Panic( EGesturePanicIllegalLogic ) );
-    
-    // tap needs to be treated separately, because recognising that needs to consider
-    // raw points (and not points in which x or y axis has been filtered out)
-    if ( IsTap( aPoints ) )
-        {
-        return EGestureTap;
-        }
-    
-    TGestureCode direction = GeneralDirection( aPoints );
-    // if last direction is opposite of the general one, user has cancelled a swipe
-    if ( direction != LastDirection( aPoints ) )
-        {
-        direction = EGestureUnknown;
-        }
-    return direction;
-    }
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturerecogniser.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Algorithm to recognise gesture from a stream of points
-*
-*/
-
-#ifndef _GESTURERECOGNISER_H_
-#define _GESTURERECOGNISER_H_
-
-#include <e32std.h>
-#include <rt_gestureobserver.h>
-
-namespace RT_GestureHelper
-{
-
-class TPointArray;
-
-/**
- * Note: Not a static class or a function pointer, just to make it sligthly 
- * easier to replace it with a heavier implementation
- */
-NONSHARABLE_CLASS( TGestureRecogniser )
-    {
-public:
-    /** 
-     * Translates points into a gesture code
-     * @param aPoints Points that form the gestures. Client is not required 
-     *                to pass in repeated points (sequential points that are 
-     *                almost in the same place)
-     * @param aIsHolding ETrue if gesture was ended at pointer being held down at same position
-     *                   EFalse if gesture ended at pointer being released 
-     * @return recognised gesture id or EUnknownGesture
-     */
-    TGestureCode GestureCode( const TPointArray& aPoints ) const;
-    };
-    
-} // namespace GestureHelper
-
-#endif // _GESTURERECOGNISER_H_
--- a/webengine/webkitutils/rt_gesturehelper/src/pointarray.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Array of points
-*
-*/
-
-
-#include "pointarray.h"
-
-using namespace RT_GestureHelper;
-
-// ----------------------------------------------------------------------------
-// TPointArray constructor
-// ----------------------------------------------------------------------------
-//
-TPointArray::TPointArray( const RArray< TPointEntry >& aPoints )
-        : iPoints( aPoints )
-    {}
-    
-// ----------------------------------------------------------------------------
-// TPointArray length
-// ----------------------------------------------------------------------------
-//
-TInt TPointArray::Count() const
-    {
-    return iPoints.Count();
-    }
-
-// ----------------------------------------------------------------------------
-// point at index, no filtering
-// ----------------------------------------------------------------------------
-//
-TPoint TPointArray::operator[]( TInt aIndex ) const 
-    {
-    return iPoints[aIndex].iPos;
-    }
-
-// ----------------------------------------------------------------------------
-// Unfiltered point at index
-// ----------------------------------------------------------------------------
-//
-TPoint TPointArray::Raw( TInt aIndex ) const
-    {
-    return iPoints[aIndex].iPos;
-    }
-
--- a/webengine/webkitutils/rt_gesturehelper/src/pointarray.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Array of points
-*
-*/
-
-
-#ifndef _POINTARRAY_H_
-#define _POINTARRAY_H_
-
-#include <e32std.h>
-
-namespace RT_GestureHelper
-{
-
-/** 
- * Represents a single point given at certain time
- */
-struct TPointEntry 
-    {
-    /** constructor */
-    inline TPointEntry( const TPoint& aPos, const TTime& aTime ) 
-            : iPos( aPos ), iTime( aTime )
-        {
-        }
-    
-    TPoint iPos;
-    TTime iTime;
-    };
-    
-/**
- * Array of points that wraps another point array
- * The purpose of this class is to allow deriving classes to override []
- * and in that member function adjust the point, e.g., by setting one
- * axis to always a constant value. This allows providing a sequence of
- * points to the recogniser in which the other axis is ignored.
- */
-NONSHARABLE_CLASS( TPointArray )
-    {
-public:
-    /** 
-     * @param aPoints points array to wrap (and filter)
-     */
-    TPointArray( const RArray< TPointEntry >& aPoints ); 
-    /** @returns length of the array */
-    TInt Count() const;
-    /** 
-     * @returns a filtered point at aIndex. Default implementation same
-     *          as Raw(...)
-     * virtual so deriving classes can modify the point (e.g., filter one axis)
-     */
-    virtual TPoint operator[]( TInt aIndex ) const;
-    /** @returns an raw, non-filtered point at aIndex */
-    TPoint Raw( TInt aIndex ) const;
-    
-private:
-    const RArray< TPointEntry >& iPoints;
-    };
-
-} // namespace GestureHelper
-
-#endif // _POINTARRAY_H_
--- a/webengine/webkitutils/rt_gesturehelper/src/utils.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture recognition utilities
-*
-*/
-
-
-#include "utils.h"
-
-#include <coemain.h> // for CCoeEnv
-#include <eikappui.h>  // for CEikAppUi
-
-#include "gesturedefs.h"
-
-namespace RT_GestureHelper
-    {
-    /** @return the longer edge of the size */
-    inline TInt LongerEdge( const TSize& aSize ) 
-        {
-        return Max( aSize.iHeight, aSize.iWidth );
-        }
-    
-    // for documentation, see header file
-    TRect ToleranceRect( const TPoint& aCenterPoint ) 
-        {
-        /*
-        TSize screenSize = static_cast<CEikAppUi*>( CCoeEnv::Static()->AppUi() )
-            ->ApplicationRect().Size(); 
-        // multiplication has to be done first, to avoid rounding integer to 0 with division
-        int toleranceLength = ( KGestureTolerancePercent * LongerEdge( screenSize ) ) / 100; 
-        */
-        long toleranceLength = Mm2Pixels(KFingerSize_mm) / 2;
-        TRect toleranceRect( aCenterPoint, TSize() );
-        // grow by the tolerance length, while keeping the center point
-        toleranceRect.Shrink( -toleranceLength, -toleranceLength );
-        return toleranceRect;
-        }
-    
-    long Twips2Pixels(long twips) 
-        {
-        CWsScreenDevice* screen = CCoeEnv::Static()->ScreenDevice();
-        TZoomFactor deviceMap(screen);
-        deviceMap.SetZoomFactor(TZoomFactor::EZoomOneToOne);
-        long px = deviceMap.VerticalTwipsToPixels(twips); //assuming that vertical
-        return px;                                        //the same as horizontal
-        
-        }
-    
-    long Mm2Pixels(long mm) 
-        {
-        return Twips2Pixels(mm * KTwipsInMm); 
-        }
-    
-    long Inches2Pixels(double inches) 
-        {
-        return Twips2Pixels(inches * KTwipsInInch); 
-        }
-
-        
-    } // namespace GestureHelper
--- a/webengine/webkitutils/rt_gesturehelper/src/utils.h	Mon Jan 18 21:20:18 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture recognition utilities
-*
-*/
-
-
-#ifndef _GESTURE_UTILS_H_
-#define _GESTURE_UTILS_H_
-
-#include <e32std.h>
-
-namespace RT_GestureHelper
-    {
-      
-    /**
-     * @return the a rectange in which dragging will be ignored. Tolerance rect 
-     *         represents a rectange within which any movement will not be considered
-     *         intentional, but as accidental stylus movement.
-     */
-    TRect ToleranceRect( const TPoint& aCenterPoint ); 
-    
-    long Twips2Pixels(long twips);
-    long Mm2Pixels(long mm);
-    long Inches2Pixels(double inches);
-
-    } // namespace GestureHelper
-
-#endif // _GESTURE_UTILS_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/bwins/stmgesturefwu.def	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	?RemoveListener@CStmGestureContext@@QAEHPAVMStmGestureListener@@@Z @ 1 NONAME ; int CStmGestureContext::RemoveListener(class MStmGestureListener *)
+	?SetContext@CStmGestureContext@@QAEXPAVCCoeControl@@@Z @ 2 NONAME ; void CStmGestureContext::SetContext(class CCoeControl *)
+	?Deactivate@CStmGestureContext@@QAEXXZ @ 3 NONAME ; void CStmGestureContext::Deactivate(void)
+	?NewL@CStmGestureEngine@@SAPAV1@XZ @ 4 NONAME ; class CStmGestureEngine * CStmGestureEngine::NewL(void)
+	?HandlePointerEventL@CStmGestureEngine@@QAEXABUTPointerEvent@@PAX@Z @ 5 NONAME ; void CStmGestureEngine::HandlePointerEventL(struct TPointerEvent const &, void *)
+	?CreateContextL@CStmGestureEngine@@QAEPAVCStmGestureContext@@H@Z @ 6 NONAME ; class CStmGestureContext * CStmGestureEngine::CreateContextL(int)
+	??0CStmGestureParameters@@QAE@ABV0@@Z @ 7 NONAME ; CStmGestureParameters::CStmGestureParameters(class CStmGestureParameters const &)
+	?Context@CStmGestureEngine@@QAEPAVCStmGestureContext@@H@Z @ 8 NONAME ; class CStmGestureContext * CStmGestureEngine::Context(int)
+	?AddListenerL@CStmGestureContext@@QAEXPAVMStmGestureListener@@H@Z @ 9 NONAME ; void CStmGestureContext::AddListenerL(class MStmGestureListener *, int)
+	?ActivateL@CStmGestureContext@@QAEXXZ @ 10 NONAME ; void CStmGestureContext::ActivateL(void)
+	??0CStmGestureParameters@@QAE@XZ @ 11 NONAME ; CStmGestureParameters::CStmGestureParameters(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/eabi/stmgesturefwu.def	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,17 @@
+EXPORTS
+	_ZN17CStmGestureEngine14CreateContextLEi @ 1 NONAME
+	_ZN17CStmGestureEngine19HandlePointerEventLERK13TPointerEventPv @ 2 NONAME
+	_ZN17CStmGestureEngine4NewLEv @ 3 NONAME
+	_ZN17CStmGestureEngine7ContextEi @ 4 NONAME
+	_ZN18CStmGestureContext10DeactivateEv @ 5 NONAME
+	_ZN18CStmGestureContext10SetContextEP11CCoeControl @ 6 NONAME
+	_ZN18CStmGestureContext12AddListenerLEP19MStmGestureListeneri @ 7 NONAME
+	_ZN18CStmGestureContext14RemoveListenerEP19MStmGestureListener @ 8 NONAME
+	_ZN18CStmGestureContext9ActivateLEv @ 9 NONAME
+	_ZN21CStmGestureParametersC1ERKS_ @ 10 NONAME
+	_ZN21CStmGestureParametersC1Ev @ 11 NONAME
+	_ZN21CStmGestureParametersC2ERKS_ @ 12 NONAME
+	_ZN21CStmGestureParametersC2Ev @ 13 NONAME
+	_ZTI18CStmGestureContext @ 14 NONAME
+	_ZTV18CStmGestureContext @ 15 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/group/bld.inf	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:    Build information 
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../../../../web_plat/browser_platform_api/inc/Browser_platform_variant.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/stmgesturefw.iby             CORE_MW_LAYER_IBY_EXPORT_PATH(stmgesturefw.iby)
+
+PRJ_MMPFILES
+#ifndef __S60_32__
+stmgesturefw.mmp
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/group/stmgesturefw.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:    Project definition file 
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET		stmgesturefw.dll
+TARGETTYPE	dll
+UID		0x1000008d 0x200212EA
+
+CAPABILITY      CAP_CLIENT_DLL
+VENDORID        VID_DEFAULT
+
+USERINCLUDE  ../inc
+MW_LAYER_SYSTEMINCLUDE
+
+
+#if defined(WINSCW)
+deffile ../BWINS/stmgesturefw.def
+#elif defined(ARMCC)
+deffile ../EABI/stmgesturefw.def
+#endif
+
+SOURCEPATH    ../src
+SOURCE		gestureengine.cpp 
+SOURCE		gestureframework.cpp
+SOURCE		gestureframeworkimpl.cpp
+SOURCE		genericsimplegesture.cpp 
+SOURCE		tapgesturerecogniser.cpp
+SOURCE		pangesturerecogniser.cpp
+SOURCE		longpressgesturerecogniser.cpp
+SOURCE		pinchgesturerecogniser.cpp
+SOURCE		touchgesturerecogniser.cpp
+SOURCE		releasegesturerecogniser.cpp
+SOURCE		flickgesturerecogniser.cpp
+SOURCE		UiEvent.cpp
+SOURCE		stateengine.cpp
+SOURCE		statemachine.cpp
+SOURCE		uieventsender.cpp
+SOURCE		stateengineconfiguration.cpp
+SOURCE		utils.cpp
+SOURCE		stmgestureinterface.cpp 
+SOURCE		gesturehelpereventsender.cpp
+#ifdef GESTURE_LOGGING
+SOURCE		filelogger.cpp
+#endif 
+
+LIBRARY		euser.lib
+LIBRARY		efsrv.lib
+LIBRARY		cone.lib
+LIBRARY		PlatformEnv.lib
+LIBRARY		bafl.lib
+LIBRARY		eikcore.lib
+LIBRARY		avkon.lib
+LIBRARY		gdi.lib
+LIBRARY		ws32.lib
+LIBRARY		flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/callbacktimer.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Timer implementation
+*
+*/
+
+#ifndef CALLBACKTIMER_H_
+#define CALLBACKTIMER_H_
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <coemain.h>
+#include <aknutils.h>
+#include <e32property.h>
+#include <w32std.h>
+
+namespace stmUiEventEngine
+{
+/**
+ * define the method to be called by the timer; this includes the pointer number
+ * the timer is associated with (maybe some other solution could do this, but...)
+ */
+class CStateMachine ;
+typedef void (CStateMachine::*CallbackFunctionL)(TInt aPointerNumber);
+
+
+/**
+ * CCallbackTimer to implement the timers.  This needs to be replaced
+ * with something else if cross platform is needed.
+ */
+NONSHARABLE_CLASS( CCallbackTimer ): public CTimer
+{
+public:
+    /** Two-phase constructor */
+    static CCallbackTimer* NewL(CStateMachine& aHelper,
+            CallbackFunctionL aCallbackFunctionL, 
+            TInt aDelay, 
+            TInt aPointerNumber, 
+            TBool aIsEnabled)
+    {
+        CCallbackTimer* self = new (ELeave) CCallbackTimer(aHelper,
+                aCallbackFunctionL, aDelay, aPointerNumber, aIsEnabled);
+        CleanupStack::PushL(self);
+        self->ConstructL(); // construct base class
+        CActiveScheduler::Add(self);
+        CleanupStack::Pop(self);
+        return self;
+    }
+
+    /** Destructor */
+    ~CCallbackTimer()
+    {
+        Cancel();
+    }
+
+    /** Set whether sending events is currently enabled */
+    void SetEnabled(TBool aEnabled)
+    {
+        iIsEnabled = aEnabled;
+        // cancel in case timer is already running
+        Cancel();
+    }
+
+    /** @return whether sending events is currently enabled */
+    TBool IsEnabled() const
+    {
+        return iIsEnabled;
+    }
+
+    /** Start the timer. Calls callback upon completion.  It is possible to give temporary delay if needed,
+     * otherwise use the defined delay.
+     */
+    void Start(TInt aNewDelay = 0)
+    {
+        if (iIsEnabled)
+        {
+            Cancel();
+            if (aNewDelay != 0)
+            {
+                After(aNewDelay);
+            }
+            else
+            {
+                After(iDelay);
+            }
+        }
+    }
+    void SetDelay(TInt aDelay)
+    {
+        iDelay = aDelay;
+    }
+    TInt GetDelay()
+    {
+        return iDelay;
+    }
+    /**
+     * method for checking are we inside the RunL method...
+     */
+    TBool isTriggered()
+    {
+        return iIsTriggered;
+    }
+
+private:
+    /** Constructor */
+    CCallbackTimer(CStateMachine& aHelper, CallbackFunctionL aCallbackFunctionL,
+            TInt aDelay, TInt aPointerNumber, TBool aIsEnabled)
+    :
+                CTimer(EPriorityRealTime - 1), // handle the timers always first before anything else
+                iHelper(aHelper), iCallbackFunctionL(aCallbackFunctionL),
+                iDelay(aDelay), iIsEnabled(aIsEnabled), iPointerNumber(aPointerNumber)
+    {
+        iIsTriggered = EFalse;
+    }
+
+    void RunL() // From CActive
+    {
+        iIsTriggered = ETrue ;
+        (iHelper .*iCallbackFunctionL)(iPointerNumber);
+        iIsTriggered = EFalse ;
+    }
+
+private:
+    /// helper object that will be called back when timer is triggered
+    CStateMachine& iHelper;
+    /// Function in the iHelper object call
+    CallbackFunctionL iCallbackFunctionL;
+    /// How long a time to wait before calling back after Start()
+    TInt iDelay;
+    /// whether sending holding events is currently enabled
+    TBool iIsEnabled;
+    /**
+     * while we are inside RunL iIsTriggered = ETrue
+     */
+    TBool iIsTriggered;
+    /*
+     * in multitouch now we need timers for each pointer
+     * could this be handled in some other way?
+     */
+    TInt iPointerNumber ;
+};
+} // namespace
+
+#endif /* CALLBACKTIMER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/edgescrollgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Edge Scroll Recognizer
+*
+*/
+
+#ifndef EDGESCROLLGESTURERECOGNISER_H_
+#define EDGESCROLLGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+/*!
+ * CEdgeScrollGestureRecogniser handles edge scroll gesture: Hold event near the edges of the window
+ *
+ */
+NONSHARABLE_CLASS( CEdgeScrollGestureRecogniser ): public CPeriodic, 
+                                                   public MGestureRecogniserIf
+{
+public:
+    static const TGestureUid KUid = EGestureUidEdgeScroll;
+
+    /** Two-phase constructor */
+    static CEdgeScrollGestureRecogniser* NewL(MGestureListener* aListener);
+    virtual ~CEdgeScrollGestureRecogniser();
+
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+    virtual void enable(bool enabled) ;
+    virtual bool isEnabled() ;
+    virtual void setOwner(CCoeControl* owner) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+    /*!
+     * Additional methods to set up edge scroll gesture recogniser:
+     * define the rectangle where the edges would be watched.
+     * \param theArea
+     */
+    void setArea(const TRect& theArea)  ;
+
+    /*!
+     * Additional methods to set up edge scroll gesture recogniser:
+     * Define how close to the border the Hold UI event must be
+     * \param rangeInPixels
+     */
+    void setScrollRange(int rangeInPixels) ;
+    /*!
+     * for testing purposes we need to log the stuff somewhere...
+     */
+public:
+    virtual void enableLogging(bool loggingOn) ;
+    /*!
+     * The timer function to handle timeout for generating scroll events
+     */
+    virtual void RunL() ;
+
+
+private:
+    CEdgeScrollGestureRecogniser(MGestureListener* aListener) ;
+    bool m_loggingenabled ;
+private:
+    CCoeControl* m_powner ; // The owning control for this gesture
+    MGestureListener* m_listener ;
+    bool m_waitingforsecondtap ;
+    TRect m_area ;
+    bool m_gestureEnabled ;
+    int  m_rangesizeInPixels ;
+};
+
+} // namespace
+
+#endif /* EDGESCROLLGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/filelogger.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  API for FileLogger.dll
+*
+*/
+// This file defines the API for FileLogger.dll
+#ifndef __FILELOGGER_H__
+#define __FILELOGGER_H__
+
+#include <f32file.h>
+const TInt KMaxLogEntrySize = 400;
+
+#ifdef GESTURE_LOGGING
+#if defined(__WINS__) && !defined(__SERIES60_30__)
+#define RDEBUG(args...) RDebug::Printf(args)
+#define RDEBUG8(args) RDebug::RawPrint(args)
+#define RDEBUG16(args...) RDebug::Print(args...)
+#else
+#define RDEBUG(args...)
+#define RDEBUG8(args)
+#define RDEBUG16(args...)
+#endif
+
+#define LOGFLUSH            CFileLogger::Flush()
+#define LOGCLOSE            CFileLogger::Close()
+#define LOGARG(txt,parm...) {_LIT8(KTxt, txt); CFileLogger::Write(KTxt, parm); RDEBUG(txt, parm);}
+#define LOGTXT(txt) {_LIT8(KTxt, txt); CFileLogger::Write((const TDesC8&)KTxt); RDEBUG8(KTxt);}
+#define LOGDES8(des)        {CFileLogger::Write(des); RDEBUG8(des);}
+#define LOGDES16(des)       {CFileLogger::Write(des); RDEBUG16(des);}
+#define LOGERR(txt,err)     if (!err) {} else {LOGARG(txt, err);}
+#define LOGCALL(exp) {LOGARG("Calling \"%s\"", #exp); exp; LOGARG("Call to \"%s\" passed.", #exp);}
+#define LOGENTER            LOGARG("%s start", __PRETTY_FUNCTION__)
+#define LOGEXIT             LOGARG("%s end", __PRETTY_FUNCTION__)
+#define LOGMEM(ptr)         LOGARG("%s [0x%x]", #ptr, (TUint)ptr)
+
+NONSHARABLE_CLASS( CFileLogger ): public CBase
+{
+public:
+    static void Write(const TDesC8& aText);
+    static void Write(const TDesC16& aText);
+    static void Write(TRefByValue<const TDesC8> aFmt,...);
+    static void Close();
+    static void Flush();
+
+private:
+    CFileLogger();
+    ~CFileLogger();
+    TBool Construct();
+    static CFileLogger* Logger();
+    void DoWrite();
+    TBool GetLogFileNameWithoutExt(TDes& aFileName);
+    void DoFlush() ;
+
+private:
+    RFs                     iFs;
+    RFile                   iFile;
+    TBuf8<KMaxLogEntrySize> iLogBuffer;
+};
+
+#else 
+#define LOGFLUSH     
+#define LOGCLOSE     
+#define LOGARG(txt,parm...) 
+#define LOGTXT(txt) 
+#define LOGDES8(des)
+#define LOGDES16(des)       
+#define LOGERR(txt,err)     
+#define LOGCALL(exp) 
+#define LOGENTER     
+#define LOGEXIT      
+#define LOGMEM(ptr)  
+#endif 
+
+
+
+
+#endif  // __FILELOGGER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/flickgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Flick Recognizer
+*
+*/
+
+#ifndef FLICKGESTURERECOGNISER_H_
+#define FLICKGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+/*!
+ * CFlickGestureRecogniser handles release "gesture"
+ * This is countarpart to touch gesture recogniser, just
+ * informing the app that ERelease has been seen.
+ * This should be placed towards the end of the list of gesture
+ * recognisers, all other recognisers which handle ERelease with
+ * some other events preceding the ERelease must be before this one.
+ *
+ */
+NONSHARABLE_CLASS( CFlickGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidFlick;
+
+    /** Two-phase constructor */
+    static CFlickGestureRecogniser* NewL(MGestureListener* aListener);
+    virtual ~CFlickGestureRecogniser();
+
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+public:
+    void setFlickingSpeed(float aSpeed) __SOFTFP;
+
+private:
+    CFlickGestureRecogniser(MGestureListener* aListener) ;
+
+private:
+    float m_speed ;
+};
+
+} // namespace
+
+#endif /* FLICKGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/genericsimplegesture.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture Definitions
+*
+*/
+
+#ifndef GENERICSIMPLEGESTURE_H_
+#define GENERICSIMPLEGESTURE_H_
+#include <rt_gestureif.h>
+#include <rt_uievent.h>
+
+
+namespace stmGesture
+{
+
+/*!
+ * Class for creating a simple gesture for notifying the listener.
+ * If the basic features are enough for the gesture, then this class
+ * is enough to be instantiated; there is the location and speed
+ * determined from the UI event; also type can be specified as well
+ * as integer detail data.
+ */
+NONSHARABLE_CLASS( TGenericSimpleGesture ): public MGestureIf
+{
+public:
+    TGenericSimpleGesture(
+        TGestureUid uid, const TPoint& loc, int type = 0,
+        const stmUiEventEngine::MUiEventSpeed* speedIf = NULL);
+
+public: // implementation of MGestureIf
+
+    TGestureUid gestureUid() const { return m_uid; }
+    void setDetails(int aDetails) { m_details = aDetails;}  // additional info can be passed here.
+    /*!
+     * MGestureIf methods
+     */
+    virtual TPoint getLocation() const  ;  // Location where the gesture happened (if applicable)
+    virtual int getType() const ;         // If the gesture can have different types
+    virtual float getSpeedX() const __SOFTFP
+    {
+        return m_speed ? m_speed->speedX() : 0.f;
+    }
+    virtual float getSpeedY() const __SOFTFP
+    {
+        return m_speed ? m_speed->speedY() : 0.f;
+    }
+    virtual int getDetails() const  ;    // Other possible details....
+
+    virtual void setName(const TDesC8& aName) ;
+    virtual TPtrC8 getGestureName() ;       // String name for gesture
+
+public:
+    void setType(int aType)
+        {
+        m_type = aType;
+        }
+
+protected:
+    TPoint m_location ;
+    TGestureUid m_uid;
+    int m_type ;
+    // What would be the other details?
+    int m_details ;
+    const stmUiEventEngine::MUiEventSpeed* m_speed ;
+    TPtrC8 m_name ;
+};
+
+NONSHARABLE_CLASS( TDirectionalGesture ): public TGenericSimpleGesture
+{
+public:
+    TDirectionalGesture(
+        TGestureUid uid, const TPoint& loc, const TPoint& prevLoc,
+        const stmUiEventEngine::MUiEventSpeed* speedIf = NULL, bool logging = false);
+
+    void setVector(const TPoint& last, const TPoint& previous) ;
+    void setLogging(bool enabled) { m_loggingEnabled = enabled; }
+
+    TPoint getLengthAndDirection() const {return m_vector;}
+    TGestureDirection getDirection() const ;
+    TInt getLength() const
+    {
+        return ((m_vector.iX*m_vector.iX)+(m_vector.iY*m_vector.iY)) ;
+    }
+
+protected:
+    TPoint m_vector ;
+    bool m_loggingEnabled ;
+};
+
+NONSHARABLE_CLASS( TTwoPointGesture ): public TDirectionalGesture
+{
+public:
+    TTwoPointGesture(TGestureUid uid, const TPoint& pos1, const TPoint& pos2);
+    TPoint getPinchEndPos() const { return m_location2; }
+
+private:
+    TPoint m_location2 ;
+};
+
+} // namespace
+
+#endif /* GENERICSIMPLEGESTURE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/gesturedefs.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#ifndef _GESTUREDEFS_H_
+#define _GESTUREDEFS_H
+
+#include <e32std.h> 
+
+namespace stmUiEventEngine
+{
+
+/// time to hold the stylus in the same position to activate holding
+const TInt KHoldDuration = 500000; // microseconds
+
+/// time to tap again for the second tap to be a double tap
+const TInt KMaxDoubleTapDuration = 400000; // microseconds
+
+/// time in which speed becomes zero if user stops stylus movement before
+/// lifting the pointer
+const TInt KSpeedStopTime = 150000; // microseconds
+
+/// tolerance in degrees to either side of an angle, for direction to be the
+/// same as reference angle
+const TReal KAngleTolerance = 25;
+
+/// Nth pointer event before the latest point
+const TInt KPreviousPointOffset = 3;
+
+/// Tolerance for ignoring small movements, percent of longer screen edge
+const TInt KGestureTolerancePercent = 2; // of 100
+
+const TInt KFingerSize_mm = 8;
+
+const TInt KTwipsInInch = 1440;
+
+const TReal KTwipsInMm = 56.7;
+
+const TInt  KMaxTapDuration = 300000; //microseconds
+
+const TInt  KFlickSpeed = 500;
+
+const TInt KDoubleTapMaxActivationInterval = 500000;     // 500 ms
+
+const TInt KDoubleTapMinActivationInterval = 40000;   // 40 ms
+
+const TInt KDoubleTapIdleInterval = 700000;           // 700 ms, to prevent triple-tap effects
+
+const TInt KLongTapDuration = 2000000; //2 sec
+
+const TInt KMinTimeBetweenDrags = 20000; // 20 ms
+/**
+ * Panic codes
+ */
+enum TGesturePanic
+    {
+    EGesturePanicIllegalLogic
+    };
+
+/** Panics the thread */
+inline void Panic( TGesturePanic aReason )
+    {
+     _LIT( KComponentName, "GestureHelper" );
+    User::Panic( KComponentName, aReason );
+    }
+
+} 
+
+#endif // _GESTUREDEFS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/gestureengine.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#ifndef GESTUREENGINE_H_
+#define GESTUREENGINE_H_
+
+#include <coemain.h>
+#include <e32property.h>
+#include <w32std.h>
+
+#include "rt_gestureengineif.h"
+#include "rt_uievent.h"
+
+namespace stmGesture
+{
+
+/*!
+ * CGEstureEngine handles the processing of the UI events.
+ * It acts as a stmUiEventEngine::MUiEventObserver to receive the UI events.
+ * The gesture recognisers are stored in a list, and at each HandleUiEventL the
+ * list of gesture recognisers is processed.  The first one to return EGestureActive
+ * from the recognise method "owns" the gesture.  If some other recogniser owned it
+ * previously, its release method is called. Gesture recogniser can also lock the gesture
+ * by returning ELockToThisGesture. Then only that gesture recogniser will be called
+ * until release is detected or the recogniser returns something else than ELockToThisGesture.
+ */
+NONSHARABLE_CLASS( CGestureEngine ): public CBase, 
+                                     public MGestureEngineIf, 
+                                     public stmUiEventEngine::MUiEventObserver
+{
+public:
+    CGestureEngine();
+    virtual ~CGestureEngine();
+
+    /*!
+     *  add gesture to the end of the list of gestures
+     */
+    virtual bool addGesture(const MGestureRecogniserIf* aNewGesture) ;
+    /*!
+     * inset a gesture to the beginning of the list of gestures
+     */
+    virtual bool insertGesture(const MGestureRecogniserIf* aNewGesture) ;
+    /*!
+     * inset a gesture to the specific position
+     */
+    virtual bool insertGestureAt(const MGestureRecogniserIf* aNewGesture, int position) ;
+    /*!
+     * remove a gesture from the list
+     */
+    virtual bool removeGesture(const MGestureRecogniserIf* aOldGesture) ;
+    /*!
+     * get the number of non-empty event streams.
+     * Event streams correspond UI events generated by one touch pointer (=finger).
+     * The low level state machine handles the necessary filtering etc.
+     * so that it is safe to remove the event stream after UI Release event has been processed.
+     */
+    virtual int activeStreamCount() const ;
+    /*!
+     * get the UI events of stream X
+     * \param indexOfActiveStream defines which active stream is used.
+     * Note that MUiEvent contains all the events from down up to the current event.
+     * Assumption: the UI events contain the target "window handle", i.e.
+     * the gesture recognition needs to be aware of all possible windows of the application.
+     */
+    virtual const stmUiEventEngine::MUiEvent* getUiEvents(int indexOfActiveStream) const ;
+	/*!
+	 * enable/disable logging
+	 */
+	virtual void enableLogging(bool aLoggingEnabled) {m_loggingEnabled = aLoggingEnabled;} ;
+	/*!
+     * The stmUiEventEngine::MUiEventObserver interface
+     */
+    virtual void HandleUiEventL( const stmUiEventEngine::MUiEvent& aEvent ) ;
+private:
+    /*!
+     * The list of available gesture recognisers
+     */
+    RPointerArray< MGestureRecogniserIf >  m_gestures;
+    /*!
+     * Is 5 UI event streams enough?  Jos tulee Torvisen voittaja?
+     * We need to store only the latest event since the interface has
+     * methods to walk trough the events. The current (sept 2009) 9.2 seems to have dual-touch support  
+     */
+    const stmUiEventEngine::MUiEvent* m_uiEventStream[stmUiEventEngine::KMaxNumberOfPointers] ;
+
+    void storeUiEvent(const stmUiEventEngine::MUiEvent& aEvent) ;
+    void walkTroughGestures() ;
+    void updateUiEvents() ;
+    int m_numOfActiveStreams ;
+    int m_currentGestureOwner ;
+    int m_currentLockedGesture ;
+	bool m_loggingEnabled ;
+};
+
+}
+
+#endif /* GESTUREENGINE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/gestureframework.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#ifndef GESTUREFRAMEWORK_H
+#define GESTUREFRAMEWORK_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+// external classes
+namespace stmUiEventEngine
+{
+    class CStateMachine ;
+}
+
+// CLASS DECLARATION
+namespace stmGesture
+{
+// Forward declarations
+class CGestureFrameworkImpl ;
+
+/*!
+  *  Gesture framework contains the following elements
+ *  \li UI State Machine.  This is the lower level driver handling the events and generating UI events.
+ *  Gesture framework creates an instance of the UI state machine and adds itself to be the UI event listener.
+ *  \li Gesture Engine.  The gesture engine processes the UI events received via MUiEventObserver
+ *  and calls gesture recogniser interface MGestureRecogniserIf of all the gestures in the list.
+  *  \li Gesture Recognisers.  Gesture recognisers scan the list of UI events and if they recognise
+ *  a gesture, they call the MGestureListener.
+ */
+NONSHARABLE_CLASS( CGestureFramework ): public CBase
+{
+public:
+    // Constructors and destructor
+
+    /**
+     * Destructor.
+     */
+    virtual ~CGestureFramework();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CGestureFramework* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CGestureFramework* NewLC();
+public:
+    // new functions,
+    static TVersion Version();
+    /*!
+     * Get the gesture engine interface
+     */
+    MGestureEngineIf* getGestureEngine() ;
+    /*!
+     * Get the underlying low level UI event interface
+     */
+    stmUiEventEngine::CStateMachine* getUiStateMachine() ;
+    /*!
+     * logging on or off
+     */
+    void enableLogging(bool loggingEnabled);
+
+private:
+
+    /*!
+     * Constructor for performing 1st stage construction
+     */
+    CGestureFramework();
+
+    /*!
+     * EPOC default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+private:
+    CGestureFrameworkImpl* m_impl ;
+
+    bool m_loggingenabled ;
+
+};
+
+} // namespace
+#endif // GESTUREFRAMEWORK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/gestureframeworkimpl.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#ifndef GESTUREENGINEIMPL_H
+#define GESTUREENGINEIMPL_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// forward declarations
+namespace stmUiEventEngine
+{
+    class CStateMachine ;
+    class MStateMachine ;
+}
+
+// CLASS DECLARATION
+namespace stmGesture
+{
+// Forward declarations
+class CGestureEngine ;
+class MGestureEngineIf ;
+
+/**
+ *  CGestureFrameworkImpl
+ *
+ */
+NONSHARABLE_CLASS( CGestureFrameworkImpl ): public CBase
+{
+public:
+    // Constructors and destructor
+
+    /**
+     * Destructor.
+     */
+    ~CGestureFrameworkImpl();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CGestureFrameworkImpl* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CGestureFrameworkImpl* NewLC();
+    /*!
+     *
+     */
+    MGestureEngineIf* getGestureEngine() ;
+    /*!
+     *
+     */
+    stmUiEventEngine::CStateMachine* getUiStateMachine() {return m_statemachine; }
+
+	void enableLogging(bool loggingEnabled) ;
+private:
+
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CGestureFrameworkImpl();
+
+    /**
+     * EPOC default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+    CGestureEngine* m_gestureEngine ;
+    stmUiEventEngine::CStateMachine*  m_statemachine ;
+	bool m_loggingenabled ;
+
+};
+} // namespace
+#endif // GESTUREENGINEIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/gesturehelpereventsender.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#ifndef GESTUREHELPEREVENTSENDER_H_
+#define GESTUREHELPEREVENTSENDER_H_
+
+#include <e32base.h>
+#include <coemain.h>
+#include "stmgestureinterface.h"
+
+NONSHARABLE_CLASS(CGestureEventSender) : public CActive
+    {
+public:
+    enum TEventSenderState
+        {
+        ENoEvents,
+        EEventsReady,
+        EBusy
+        };
+    static CGestureEventSender* NewL(  MStmGestureListener& aObserver );
+    ~CGestureEventSender();
+    TInt AddEvent(TStmGestureUid aUid, const MStmGesture* aGestureEvent);
+protected:    
+    void RunL();
+    void DoCancel();
+    TInt RunError(TInt aError);
+private:
+    CGestureEventSender(MStmGestureListener& aObserver);
+    void Complete();
+    void EmitEventL( const TStmGestureEvent& aGestureEvent );
+    
+    MStmGestureListener& iObserver;
+    RArray< TStmGestureEvent >  iEvents;
+    TEventSenderState iState;
+    };
+
+#endif /* GESTUREHELPEREVENTSENDER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/hoveringgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:Hover Gesture Recognizer
+*
+*/
+
+#ifndef HOVERINGGESTURERECOGNISER_H_
+#define HOVERINGGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+/*!
+ * Recognise hovering gesture.
+ * If the EMove distance from previous is short enough, then
+ * we assume hovering gesture.  If the previous UI event is ETouch, EHold or EMove
+ * and the distance is short enough the gesture takes control.
+ */
+NONSHARABLE_CLASS( CHoveringGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidHover;
+
+    static CHoveringGestureRecogniser* NewL(MGestureListener* aListener);
+
+    virtual ~CHoveringGestureRecogniser();
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+    void setHoveringSpeed(float aSpeed) __SOFTFP ;
+
+private:
+    CHoveringGestureRecogniser(MGestureListener* aListener) ;
+    bool m_hovering ;
+    float m_hoveringspeed ;
+};
+
+}
+
+#endif /* HOVERINGGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/leftrightgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LeftRight Gesture Recognizer
+*
+*/
+
+#ifndef LEFTRIGHTGESTURERECOGNISER_H_
+#define LEFTRIGHTGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+NONSHARABLE_CLASS( CLeftrightGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidLeftRight;
+
+    static CLeftrightGestureRecogniser* NewL(MGestureListener* aListener);
+
+    virtual ~CLeftrightGestureRecogniser();
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+private:
+    CLeftrightGestureRecogniser(MGestureListener* aListener) ;
+};
+
+}
+
+#endif /* LEFTRIGHTGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/longpressgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:LongPress Gesture Recognizer
+*
+*/
+
+#ifndef LONGPRESSGESTURERECOGNISER_H_
+#define LONGPRESSGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+/*!
+ * CLongPressGestureRecogniser handles long press gesture (generated from Hold UI event)
+ *
+ */
+NONSHARABLE_CLASS( CLongPressGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidLongPress;
+
+    /** Two-phase constructor */
+    static CLongPressGestureRecogniser* NewL(MGestureListener* aListener);
+    virtual ~CLongPressGestureRecogniser();
+
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+    /*!
+     * Additional methods to set up edge scroll gesture recogniser:
+     * define the rectangle
+     * \param theArea
+     */
+    void setArea(const TRect& theArea) ;
+
+private:
+    CLongPressGestureRecogniser(MGestureListener* aListener) ;
+
+private:
+    bool m_waitingforsecondtap ;
+    TRect m_area ;
+};
+
+} // namespace
+
+#endif /* LONGPRESSGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/pangesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:Pan Gesture Recognizer
+*
+*/
+
+#ifndef PANGESTURERECOGNISER_H_
+#define PANGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+NONSHARABLE_CLASS( CPanGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidPan;
+
+    static CPanGestureRecogniser* NewL(MGestureListener* aListener);
+
+    virtual ~CPanGestureRecogniser();
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+    virtual void setPanningSpeedLow(float aSpeed) __SOFTFP ;
+    virtual void setPanningSpeedHigh(float aSpeed) __SOFTFP ;   // speeds above this are flicks
+
+private:
+    CPanGestureRecogniser(MGestureListener* aListener) ;
+
+private:
+    float m_panningspeedlow ;
+    float m_panningspeedhigh ;
+};
+
+}
+
+#endif /* PANGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/pinchgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:Pinch Gesture Recognizer
+*
+*/
+
+#ifndef PINCHGESTURERECOGNISER_H_
+#define PINCHGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+/*!
+ * Recognise pinching gesture. !!! very experimental !!!
+ * It seems that in capacitive touch in Symbian 9.4 touching with two
+ * fingers causes fast EDrag events which are far from each other.
+ * This gesture recogniser tries to use that feature
+ * to determine when the gestures looks like a pinch.
+ * Would requires a lot of tuning to be really useful, if at all possible.
+ * With current implementation it is easy to zoom in but
+ * almost impossible to zoom out.
+ */
+NONSHARABLE_CLASS( CPinchGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidPinch;
+
+    static CPinchGestureRecogniser* NewL(MGestureListener* aListener);
+
+    virtual ~CPinchGestureRecogniser();
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+    /* define the pinch triggering as speed value */
+    /* after EHold has been seen, then any move which is faster than this will enter pinch gesture */
+    /* note that the value varies depending on techology, speed is measured as pixels / ms */
+    void setPinchingSpeed(float aSpeed) __SOFTFP;
+
+private:
+    CPinchGestureRecogniser(MGestureListener* aListener) ;
+
+    void calculateZoomingLine() ;
+    float calculateDistance() ;
+    int adjustPinchMove(float& aPreviousDistance, float aNewDistance) ;
+
+private:
+    bool m_pinching ;
+    float m_pinchingspeed ;
+    TPoint m_pinchstart ;
+    TPoint m_pinchend ;
+
+    float m_m ;
+    float m_b ;
+
+    float m_ddistance ;
+    bool m_holdseen ;
+    TPoint m_holdseenAtPos ;
+    TTime m_holdseenAtTime ;
+};
+
+}
+
+#endif /* PINCHGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/releasegesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: release Gesture Recognizer
+*
+*/
+
+#ifndef RELEASEGESTURERECOGNISER_H_
+#define RELEASEGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+/*!
+ * CReleaseGestureRecogniser handles release "gesture"
+ * This is countarpart to touch gesture recogniser, just
+ * informing the app that ERelease has been seen.
+ * This should be placed towards the end of the list of gesture
+ * recognisers, all other recognisers which handle ERelease with
+ * some other events preceding the ERelease must be before this one.
+ *
+ */
+NONSHARABLE_CLASS( CReleaseGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidRelease;
+
+    /** Two-phase constructor */
+    static CReleaseGestureRecogniser* NewL(MGestureListener* aListener);
+    virtual ~CReleaseGestureRecogniser();
+
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+    /*!
+     * Additional methods to set up edge scroll gesture recogniser:
+     * define the rectangle where the touch is watched
+     * \param theArea
+     */
+    void setArea(const TRect& theArea) ;
+
+private:
+    CReleaseGestureRecogniser(MGestureListener* aListener) ;
+
+private:
+    TRect m_area ;
+};
+
+} // namespace
+
+#endif /* RELEASEGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/rt_gestureengineif.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef RT_GESTUREENGINEIF_H_
+#define RT_GESTUREENGINEIF_H_
+
+#include <rt_gesturelistener.h>
+#include <rt_gestureif.h>
+
+// Forward declarations
+class CCoeControl;
+
+namespace stmUiEventEngine
+{
+    class MUiEvent ;
+}
+
+namespace stmGesture
+{
+
+// Forward declarations
+class MGestureRecogniserIf ;
+
+/*!
+ *  MGestureEngineIf defines the methods for the gesture recognisers
+ *  to be added to the gesture engine.
+ *  TODO: add rule based settings to position the gesture recognisers to the list.
+ *  The gesture recogniser order rules would be defined how?
+ *  - defining the order inside the application
+ *  - defining the order in some configuration file (maybe not)
+ *
+ *  This requires:
+ *  - the gesture recognisers need to have an ID
+ *  - a type can also be defined if the rules can be set based on types.
+ *
+ *  The gesture recognisers are arranged in a list so that the correct gesture recogniser
+ *  gets the opportunity to detect the gesture in time.  An axample of a set of gesture recognisers
+ *  could be e.g.
+ *
+ *  |---------------------------------------------|
+ *  |  scrolling stop by tap -gesture recogniser  | A is enabled only when needed, when enabled must precede all others
+ *  |                                             |   (note that locking partly can be used to achieve the same)
+ *  |---------------------------------------------|
+ *  | location specific: zoom + button tap gesture| B these must detect the location first
+ *  |---------------------------------------------|
+ *  | location specific: zoom - button tap gesture| B these must detect the location first
+ *  |---------------------------------------------|
+ *  | location specific: edge scroll gesture      | B these must detect the location first
+ *  |---------------------------------------------|
+ *  | pinch zoom gesture                          |   standard gesture, but application wide (spans windows)
+ *  |                                             | C another requirement: disable all but me/restore state
+ *  |                                             |   so that other gestures will not meddle in while pinching
+ *  |---------------------------------------------|
+ *  | hover gesture                               | C standard gesture, needs to detect the EMove speed
+ *  |---------------------------------------------|
+ *  | pan gesture                                 | C standard gesture, but must be after hover
+ *  |---------------------------------------------|
+ *  | tap/doubletap gesture                       | C standard gesture, order not that important, since
+ *  |                                             |   needs just to see certain events in history: touch/release
+ *  |---------------------------------------------|
+ *
+ *  The order of gesture recognisers determine how the system behaves, so there must be an easy way
+ *  to define the order.  The order could be defined either by specifying the IDs or just their types, if then the
+ *  order is not that important.  TODO to study whether it would be a good idea to implement this so that
+ *  there are separate lists for the three different classes of gesture recognisers A, B and C; this might
+ *  make the implementation simpler.
+ */
+class MGestureEngineIf
+{
+public:
+    /*!
+     *  add gesture to the end of the list of gestures
+     */
+    virtual bool addGesture(const MGestureRecogniserIf* aNewGesture) = 0 ;
+    /*!
+     * inset a gesture to the beginning of the list of gestures
+     */
+    virtual bool insertGesture(const MGestureRecogniserIf* aNewGesture) = 0 ;
+    /*!
+     * inset a gesture to specific position
+     */
+    virtual bool insertGestureAt(const MGestureRecogniserIf* aNewGesture, int position) = 0 ;
+
+    /*!
+     * remove a gesture from the list
+     */
+    virtual bool removeGesture(const MGestureRecogniserIf* aOldGesture) = 0 ;
+    /*!
+     * get the number of non-empty event streams.
+     * Event streams correspond UI events generated by one touch pointer (=finger).
+     * The low level state machine handles the necessary filtering etc.
+     * so that it is safe to remove the event stream after UI Release event has been processed.
+     */
+    virtual int activeStreamCount() const = 0 ;
+    /*!
+     * get the UI events of stream X
+     * \param indexOfActiveStream defines which active stream is used.
+     * Note that MUiEvent contains all the events from down up to the current event.
+     * Assumption: the UI events contain the target "window handle", i.e.
+     * the gesture recognition needs to be aware of all possible windows of the application.
+     */
+    virtual const stmUiEventEngine::MUiEvent* getUiEvents(int indexOfActiveStream) const = 0 ;
+    /*!
+     * Enable/disable logging
+     */
+    virtual void enableLogging(bool aLoggingEnabled) = 0 ;
+};
+
+/*!
+ * Enumerated values for the gesture recogniser
+ */
+enum TGestureRecognitionState
+{
+    EGestureActive,     /*! < gesture recognised and gesture notification sent */
+    ELockToThisGesture, /*! < gesture recognised, and only this recogniser called until release/this returns something else */
+    ENotMyGesture       /*! < not this gesture, try the next one in the list  */
+};
+
+/*!
+ * The types of gesture recognisers. TODO to implement rule based gesture engine
+ * where the recognisers can be added in any order, and the rules define the order of them.
+ * The rules may define
+ */
+enum TGestureRecogniserType
+{
+    ECriticalGestureRecogniser,           /*! < This kind of gestures should be at the beginning of the list */
+    ELocationSpecificGestureRecogniser,   /*! < This kind of gestures should be at the next in the list */
+    EGenericGestureRecogniser             /*! < This kind of gestures should be at the next in the list */
+};
+
+/*!
+ * MGestureRecogniserIf defines the interface needed to be implemented by every gesture recognition element.
+ * The gesture recogniser gets the UI events and needs to determine whether they define the expected gesture.
+ *
+ */
+class MGestureRecogniserIf
+{
+public:
+    /*!
+     *  Virtual destuructor.
+     */
+    virtual ~MGestureRecogniserIf() {}
+    /*!
+     * Process the UI event.
+     * \param numOfActiveStreams : indicates how many pointers are currently active.
+     * \param ge the gesture engine.  The Gesture recogniser uses this to get the current active events.
+     *
+     * \return EMaybeGesture    if gesture was not yet recognised but can be possible (e.g. after first touch everyone returns this)
+     * \return EGestureActive   if gesture was recognised and a gesture notification was sent; this is then the active gesture
+     * \return ENotMygesture    if gesture can not be this one, e.g. TAP gesture after receiving Move UI event.
+     *
+     * Note that a gesture may take control only if it sends out a gesture notification. (or is it so?)
+     * Until no gesture recogniser has sent a gesture notification, all recognisers who have not returned
+     * ENotMyGesture are eligible, based on the order they are in the list.
+     *
+     * The gesture engine may be either in dynamic gestures mode or fixed gestures mode.
+     * In dynamic gestures mode each time an UI event is processed, engine will call each
+     * gesture recogniser until one of the recognisers returns EGestureActive.
+     *
+     * In fixed gestures mode the index of the gesture recogniser first returning EGestureActive is stored
+     * and the subsequent UI events are processed so that only that recogniser is allowed to send gesture
+     * notification.  If it returns !=EGestureActive, it relinguishes the control.
+     *
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) = 0 ;
+    /*!
+     * In dynamic gestures mode the gesture engine will call release of the recogniser
+     * who lost activation status because a preceding recogniser in the list took control.
+     *
+     * Note that the recogniser must then do whatever (if anything) is needed to cancel the gesture.
+     */
+    virtual void release(MGestureEngineIf* ge) = 0  ;
+    /*!
+     * Enable or disable recogniser.  E.g. if two gestures are related so that
+     * a gesture ending recogniser needs to be activated to stop a t5imer driven
+     * behaviour it is useful to add the recogniser to the top of the list
+     * and then disable it until needed.
+     */
+    virtual void enable(bool enableRecogniser) = 0 ;
+    /*!
+     * Get the state of the gesture recogniser, whether it is enabled or not
+     * \return true, if the recogniser is enabled.
+     */
+    virtual bool isEnabled() = 0 ;
+    /*!
+     * Return the type of the gesture recogniser
+     */
+    virtual TGestureUid gestureUid() const = 0;
+    
+    /*!
+     * for testing purposes
+     */
+    virtual void enableLogging(bool loggingEnabled) = 0 ;
+
+    virtual void setOwner(CCoeControl* owner) = 0;
+};
+
+NONSHARABLE_CLASS( CGestureRecogniser ): public CBase, public MGestureRecogniserIf
+{
+public:
+    virtual ~CGestureRecogniser()
+    {
+
+    }
+    /*!
+     * MGestureRecogniserIf methods; partial implementation
+     */
+    virtual void enable(bool enabled)
+    {
+        m_gestureEnabled = enabled ;
+    }
+    virtual bool isEnabled()
+    {
+        return m_gestureEnabled ;
+    }
+    virtual void enableLogging(bool loggingOn)
+    {
+        m_loggingenabled = loggingOn;
+    }
+    virtual void setOwner(CCoeControl* owner)
+    {
+        m_powner = owner;
+    }
+protected:
+    CGestureRecogniser(MGestureListener* aListener) :
+        m_powner(aListener->getOwner()), 
+        m_listener(aListener), 
+        m_gestureEnabled(true), 
+        m_loggingenabled(false)
+    {
+
+    }
+
+protected:
+    CCoeControl* m_powner ; // The owning control for this gesture
+    MGestureListener* m_listener ;
+    bool m_gestureEnabled ;
+    bool m_loggingenabled ;
+};
+
+} // namespace
+#endif /* RT_GESTUREENGINEIF_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/rt_gesturelistener.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MGestureListener
+*
+*/
+
+#ifndef RT_GESTURELISTENER_H_
+#define RT_GESTURELISTENER_H_
+
+#include <rt_gestureif.h>
+
+namespace stmGesture
+{
+/*!
+ * The gesture listener interface.  This interface needs to be implemented by the
+ * listener of the standard gestures implemented in the gesture framework.
+ */
+class MGestureListener
+{
+public:
+    /*!
+     * The method that will be called by the gesture framework
+     * to inform about a gesture being recognised.
+     * \param theGesture: contains the recognised gesture.
+     * The MGestureIf contains generic part and gesture specific part
+     * so the listener needs to know how to handle specific gestures.
+     */
+    virtual void gestureEnter(MGestureIf& theGesture) = 0 ;
+    /*!
+     * The method to inform the listener that the gesture has ended.
+     * This happens if another gesture is recognised or e.g. the Release UI
+     * event is handled.
+     * \note Some gestures produce only gestureEnter() callback and no gestureExit().
+     */
+    virtual void gestureExit(TGestureUid gestureUid) = 0 ;
+    /*!
+     * The listener needs to provide the target control (CCoeControl*) to the
+     * standard gestures.  Since the gesture framework processes all events in the
+     * application, the gesture recognisers check whether the events are targeted
+     * to the listener owning control.
+     * Not all gesture recognisers need to perform this check.
+     * \return the owning CCoeControl of the gesture listener.
+     */
+    virtual CCoeControl* getOwner() = 0 ;
+};
+
+}
+#endif /* RT_GESTURELISTENER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/stateengine.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   State Engine
+*
+*/
+#ifndef STATEENGINE_H_
+#define STATEENGINE_H_
+
+#include "rt_uievent.h"
+#include "timerinterface.h"
+#include "statemachine_v2.h"
+#include "uieventsender.h"
+#include "stateengineconfiguration.h"
+
+namespace stmUiEventEngine
+{
+
+/*!
+ * Define THwEvent since we need the point, the type and timestamp to be stored.
+ * The HW event is used also to handle the timer events so that the wrapper class calling the
+ * state machine will handle the starting, canceling etc. of the timers and the state machine
+ * sees the timers as messages.  This hopefully makes it easier to keep the core state machine as
+ * OS agnostic as possible.
+ */
+class THwEvent
+{
+public:
+    THwEvent() {} ;
+    THwEvent(const THwEvent& ev):
+        iType(ev.iType), iPosition(ev.iPosition),
+        iTime(ev.iTime), iTarget(ev.iTarget), iPointerNumber(ev.iPointerNumber) {}
+    THwEvent(TStateMachineEvent code, 
+             const TPoint& pos, 
+             TTime time, 
+             void* aTarget, 
+             TInt aPointerNr):
+             iType(code), iPosition(pos),
+             iTime(time), iTarget(aTarget), iPointerNumber(aPointerNr) 
+             {
+             }
+
+    TStateMachineEvent iType ;
+    TPoint  iPosition ;
+    TTime   iTime ;
+    void*   iTarget ;
+	TInt	iPointerNumber ;
+};
+
+
+NONSHARABLE_CLASS( CStateEngine ) : public CBase
+{
+public:
+    /**
+     * constructor and destructor
+     */
+	CStateEngine(CStateEngineConfiguration* aConfig, MTimerInterface* timerif, int index) ;
+
+    ~CStateEngine() ;
+    /**
+     *  The methods needed for state machine
+     */
+    void ConsumeEvent() ;
+    bool IsTouchTimer() ;
+    bool IsHoldTimer() ;
+    bool IsSuppressTimer() ;
+    bool IsTouchTimeArea() ;
+    bool IsTouchArea() ;
+    bool IsHoldArea() ;
+    bool InsideTouchTimeArea() ;
+    bool InsideTouchArea() ;
+    bool InsideHoldArea() ;
+    bool LooksLikeHold() ;
+    void ErrorEvent() ;
+    void InitTouchTimer() ;
+    void InitHoldTimer() ;
+    void RestartHoldTimer() ;
+    void InitTouchSuppressTimer() ;
+    void InitMoveSuppressTimer() ;
+    void ClearTouchTimer() ;
+    void ClearHoldTimer() ;
+    void ClearSuppressTimer() ;
+    void ProduceTouch() ;
+    void ProduceMove() ;
+    void ProduceRelease() ;
+    void ProduceHold() ;
+    void RenameToDrag() ;
+    void PrepareTouchTimeArea() ;
+    void PrepareTouchArea() ;
+    void PrepareHoldArea() ;
+    void SetCurrentPos() ;
+    void SetGestureStart() ;
+    void AddToTouch() ;
+    void AddDraggingPos() ;
+    void StoreMovePos() ;
+
+    /**
+     * The event interface
+     */
+
+    THwEvent& initEvent()
+    {
+        m_hwe.iPointerNumber = m_index;
+        return m_hwe;
+    }
+
+    // event returned by initEvent() must initialized first
+	bool handleStateEvent()  ;
+
+	TRect getTouchArea() ;
+	TRect getHoldArea() ;
+	bool wasLastMessageFiltered() ;
+
+private:
+    bool m_eventConsumed ;
+    THwEvent m_hwe ;
+
+    bool isNewHoldingPoint() ;
+    RPointerArray<THwEvent> iDragPoints;
+    MTimerInterface* m_timerif ;
+
+    RArray<THwEvent> iTouchPoints;
+
+    // Variables for running the state machine
+    TStateMachineState m_currentState ;
+    bool m_isTimerEvent ;                   // We need to separate the pointer events and the timer events
+    TPoint m_currentTouchXY ;               // This is the touching point
+    TPoint m_gestureStartXY ;               // gesture started at this point
+    TPoint m_uiEventXY ;                    // The UI event XY point.
+    TPoint m_previousPointerEventPosition ;
+    TPoint m_deltaVector ;
+    TRect m_touchRect ;
+    TRect m_holdRect ;
+
+    bool m_wasFiltered ;
+    void CalculateDelta() ;
+    void CalculateTouchAverage() ;
+    void CalculateCurrentVector() ;
+    TPoint calculateTouchAverageFromPoints() ;
+    bool InsideArea(const TPoint& point, 
+                    const TRect& rect, 
+                    TAreaShape shape, 
+                    const TPoint& tolerance);
+    void setTolerance(long fingersize_mm, TPoint& tolerance, TAreaShape shape) ;
+
+    void DebugPrintState(TStateMachineState anextstate) ;
+    inline static TRect ToleranceRect( const TPoint& aCenterPoint, const TPoint& tolerance) ;
+    void turnStateMachine() ;
+
+    TPoint     m_touchCentre ;
+    TPoint     m_holdCentre ;
+
+    void*       m_gestureTarget ;
+    TTimeIntervalMicroSeconds getInterval() ;
+    TTime       m_lastMessageTime ;
+    CUiEvent* createUIEventL(TUiEventCode code, const TPoint& aPos) ;
+    TPoint getPreviousXY(const TPoint& aXY) ;
+    TPoint m_previousXY ;
+    bool isTimerMessage() ;
+    int  m_index ;
+    TUiEventCode m_previousUiGenerated ;
+    TPoint m_lastFilteredPosition ;
+    TTime m_lastFilteredMessageTime ;
+
+	CStateEngineConfiguration* m_config ;
+
+};
+}   // namespace
+
+#endif /* STATEENGINE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/stateengineconfiguration.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   State Engine Configuration
+*
+*/
+
+#ifndef STATEENGINECONFIGURATION_H_
+#define STATEENGINECONFIGURATION_H_
+
+#include "rt_uievent.h"
+#include "timerinterface.h"
+#include "statemachine_v2.h"
+
+
+namespace stmUiEventEngine
+{
+class CUiEventSender;
+
+
+NONSHARABLE_CLASS( CStateEngineConfiguration ): public CBase
+{
+public:
+    CStateEngineConfiguration() ;
+    void ConstructL();
+    ~CStateEngineConfiguration() ;
+
+    void setTouchTimeArea(const long fingersize_mm) ;
+    void setTouchArea(const long fingersize_mm) ;
+    TAreaShape getTouchAreaShape() ;
+    void setTouchAreaShape(const TAreaShape shape) ;
+    unsigned int getTouchTimeout() ;
+    void setTouchTimeout(unsigned int) ;
+    void setHoldArea(const long fingersize_mm) ;
+    TAreaShape getHoldAreaShape() ;
+    void setHoldAreaShape(const TAreaShape shape) ;
+    unsigned int getHoldTimeout() ;
+    void setHoldTimeout(unsigned int a) ;
+    unsigned int getTouchSuppressTimeout() ;
+    void setTouchSuppressTimeout(unsigned int a) ;
+    unsigned int getMoveSuppressTimeout() ;
+    void setMoveSuppressTimeout(unsigned int a) ;
+    bool addUiEventObserver(MUiEventObserver* observer) ;
+    bool removeUiEventObserver(MUiEventObserver* observer) ;
+    void enableLogging(bool a) ;
+
+private:
+    void setTolerance(long fingersize_mm, TPoint& tolerance, TAreaShape shape) ;
+
+public:
+    CUiEventSender* m_uiEventSender ;
+
+    TAreaShape m_touchAreaShape ;
+    TAreaShape m_holdAreaShape ;
+    bool       m_enableLogging ;
+    TPoint m_touchTimeTolerance ;
+    TPoint m_touchTolerance ;
+    TPoint m_holdTolerance ;
+    int  m_touchTimerLimit ;
+    int  m_holdTimerLimit ;
+    int  m_suppressTimerLimit ;
+    int  m_moveSuppressTimerLimit ;
+
+
+};
+
+} // namespace stmUiEventEngine
+
+#endif /* STATEENGINECONFIGURATION_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/statemachine.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: State Machine implementation
+*
+*/
+
+#ifndef STATEMACHINE_H
+#define STATEMACHINE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <aknwseventobserver.h>
+
+#include <rt_uievent.h>
+#include "timerinterface.h"
+#include "statemachine_v2.h"
+
+class CCoeEnv;
+
+namespace stmUiEventEngine
+{
+
+class CCallbackTimer;
+class CStateEngine;
+class THwEvent;
+class CStateEngineConfiguration;
+
+
+int Distance(int dx, int dy);
+
+inline int Distance(const TPoint& aP1, const TPoint& aP2)
+{
+    return Distance(aP1.iX - aP2.iX, aP1.iY - aP2.iY);
+}
+
+// CLASS DECLARATION
+/**
+ *  CStateMachine
+ *
+ */
+NONSHARABLE_CLASS( CStateMachine ): public CBase, 
+                                    public MTimerInterface, 
+                                    public MAknWsEventObserver, 
+                                    public MStateMachine
+{
+public:
+    /**
+     * The MStateMachine interface methods
+     */
+    virtual TRect getTouchArea(TInt aPointerNumber) ;
+    virtual void setTouchTimeArea(long fingersize_mm) ;
+    virtual void setTouchArea(long fingersize_mm) ;
+    virtual TAreaShape getTouchAreaShape() ;
+    virtual void setTouchAreaShape(const TAreaShape shape) ;
+    virtual unsigned int getTouchTimeout() ;
+    virtual void setTouchTimeout(unsigned int) ;
+    virtual TRect getHoldArea(TInt aPointerNumber) ;
+    virtual void setHoldArea(long fingersize_mm) ;
+    virtual TAreaShape getHoldAreaShape() ;
+    virtual void setHoldAreaShape(const TAreaShape shape) ;
+    virtual unsigned int getHoldTimeout();
+    virtual void setHoldTimeout(unsigned int a);
+    virtual unsigned int getTouchSuppressTimeout() ;
+    virtual void setTouchSuppressTimeout(unsigned int a) ;
+    virtual unsigned int getMoveSuppressTimeout() ;
+    virtual void setMoveSuppressTimeout(unsigned int a) ;
+    virtual bool addUiEventObserver(MUiEventObserver* observer) ;
+    virtual bool removeUiEventObserver(MUiEventObserver* observer) ;
+    virtual bool wasLastMessageFiltered(TInt aPointerNumber) ;
+    virtual void enableCapacitiveUp(bool enable) ;
+    virtual void enableLogging(bool aEnable) ;
+    virtual void enableYadjustment(bool aEnable) ;
+    virtual int getNumberOfPointers() ;
+
+    /**
+     * MAknWsEventObserver methods
+     */
+    virtual void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination) ;
+
+    /* other methods */
+    /**
+     * Pointer event handling in case the messaging should be handled that way, note that the target CCoeControl needs to be givem
+     */
+    void HandlePointerEventL(const TPointerEvent& aPointerEvent, void* target) ;
+    /**
+     * Simple toggle changes from handling the messages using ...WsEventL or ...PointerEventL
+     */
+    void EnableWsEventMonitoring(bool aEnable) ;
+    /**
+     * Method to handle the TPointerEvent
+     */
+    bool HandleStateEvent(const TPointerEvent& aPointerEvent, void* aTarget, const TTime& aTime) ;
+    /*!
+     * Setting the Y adjustment useful in capacitive touch
+     * Note that there are problems with the adjustment if done at this level,
+     * the most proper place would be the window server.
+     */
+
+    /**
+     * MTimerInterface methods, these are internal and do not need to be exported
+     */
+    virtual void startTouchTimer(TInt aDelay, TInt aPointerNumber) ;
+    virtual void cancelTouchTimer(TInt aPointerNumber)  ;
+    virtual void startHoldTimer(TInt aDelay, TInt aPointerNumber)  ;
+    virtual void cancelHoldTimer(TInt aPointerNumber)  ;
+    virtual void startSuppressTimer(TInt aDelay, TInt aPointerNumber) ;
+    virtual void cancelSuppressTimer(TInt aPointerNumber)  ;
+
+public:
+    ~CStateMachine();
+    static CStateMachine* NewL();
+    static CStateMachine* NewLC();
+
+private:
+    CStateMachine();
+    void ConstructL();
+
+    inline static TInt PointerIndex(const TPointerEvent& aPointerEvent);
+
+    /**
+     * Convert pointer event into our own event format (including timestamp)
+     */
+    void CreateHwEvent(THwEvent& aEvent, 
+                       const TPointerEvent& aPointerEvent, 
+                       void* aTarget, 
+                       const TTime& aTime) ;
+    
+    void CreateTimerEvent(THwEvent& aEvent, TStateMachineEvent aEventCode) ;
+    
+    /**
+     * the actual state machines implementing the transitions etc.
+     */
+    CStateEngine* m_impl[KMaxNumberOfPointers] ;
+    /*
+     * The configuration for state machines
+     */
+    CStateEngineConfiguration* m_config ;
+    /*!
+     * convert window coordinates to screen coordinates.
+     */
+    TPoint screenCoordinates(const TPoint& aPos, void* aGestureTarget) ;
+
+    CCoeEnv* m_coeEnv;
+
+    bool m_WasMessageFiltered ;
+    bool m_wseventmonitoringenabled ;
+    bool m_loggingenabled ;
+    bool m_capacitiveup ;
+
+    int m_3mminpixels ;
+    bool m_adjustYposition ;
+    // Use same naming scheme with the timers, and variables and methods
+    // using macro expansion tricks (with multitouch support starts to look quite ugly):
+#define DECLARE_TIMER(x) \
+            void start##x##Timer(TInt aPointerNumber) ;\
+            CCallbackTimer* m_##x##Timer[KMaxNumberOfPointers] ;\
+            void handle##x##Timer(TInt aPointerNumber) ;\
+            void cancel##x##Timer(TInt aPointerNumber)
+
+    DECLARE_TIMER(touch) ;
+    DECLARE_TIMER(hold) ;
+    DECLARE_TIMER(suppress) ;
+
+};
+}   // namespace
+#endif // STATEMACHINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/statemachine_v2.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#ifndef STATEMACHINE_V2_H_
+#define STATEMACHINE_V2_H_
+
+namespace stmUiEventEngine
+{
+/**
+ * the next templates define the static callbacks required to pass the this object to the member function
+ * There are two definitions, one for the TBool is*() method checking the message,
+ * the other one returning void for entry, event and action methods.
+ */
+template<class T, bool (T::*F)()>
+bool isF(void *p)
+{
+    return ((reinterpret_cast<T*>(p))->*F)();
+}
+
+template<class T, void (T::*F)()>
+void aF(void *p)
+{
+    ((reinterpret_cast<T*>(p))->*F)();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+// We define the state machine in C fashion so that we get the initialized state table
+// already at compilation phase.  The message checking methods, event methods  and action methods are
+// then passed to the C++ object to be processed.
+// The currently defined states are the following, at the same time they are used as the index to the array of states.
+enum TStateMachineState {
+            Eignore, 
+            EInit, 
+            EDispatch, 
+            EInTouchTime, 
+            EInHoldTime_U, 
+            EInHoldTime_D, 
+            EInTouchArea, 
+            ESuppress_D
+        } ;
+// Using these kind of functions the state machine is of course single threaded
+// the necessary parameters need to be passed in the member variables
+typedef bool  (*condition_t)(void* ) ;
+typedef void  (*action_t)(void*) ;
+
+/*
+ * The possible events to the state machine.  The pointer and timer events are possible.
+ */
+enum TStateMachineEvent {
+            EDown, 
+            EDrag, 
+            ECapacitiveUP, 
+            EResistiveUP, 
+            ETouchTimer, 
+            EHoldTimer, 
+            ESuppressTimer
+        } ;
+/*!
+ * STATE_ELEMENT defines one line in the state/event instance.
+ * It contains three fields: ConditionFunction, ActionFunction and NextState.
+ * The generic state machine will call the ConditionFunction (if it is != NULL)
+ * and if the result is true, it will call ActionFunction (if it is != NULL).
+ * Then it will continue to NextState.
+ * If NextState is Eignore, it will try the next line of state/event.
+ */
+typedef struct _STATE_ELEMENT {
+    /*!
+     * Condition function contains the pointer to the method used to check some condition.
+     * If the pointer is non-NULL the state machine will call the function and based on the result
+     * (if true) calls the ActionFunction.
+     */
+    const condition_t conditionFunction ;
+    /*!
+     * ActionFunction contains a pointer to a method performing some action.  The state machine
+     * will call the method if the pointer is non-NULL.
+     */
+    const action_t    actionFunction ;
+    /*!
+     * NextState contains either the next state or Eignore.  The state machine will process state elements
+     * until the NextState != Eignroe is found.
+     */
+    const TStateMachineState  nextState ;
+} STATE_ELEMENT ;
+
+/*!
+ * Each state contains an array defining the possible event and the state elements
+ * that are processed if the event happens.
+ */
+typedef struct _STATE {
+    /*!
+     * The event defines the pointer event or timer event being processed
+     */
+    const TStateMachineEvent    theEvent ;        //
+    /*!
+     * StateElements points to the array of STATE_ELEMENT entries which define the
+     * condition and action functions to be processed and the resulting nesxt state.
+     */
+    const STATE_ELEMENT* const   stateElements ;
+} STATE ;
+
+} // namespace
+
+#endif /* STATEMACHINE_V2_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/tapgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Tap Gesture Recognizer
+*
+*/
+
+#ifndef TAPGESTURERECOGNISER_H_
+#define TAPGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+/*!
+ * CTapGestureRecogniser handles both tap and double tap recognition.
+ * Doubletap needs to work even if it crosses window boundaries, so
+ * CTapGestureRecogniser is a "global" recogniser.  The application
+ * creates only one instance of it (TODO later: how to use Singleton
+ * pattern in Symbian, seems to be tricky since we would need to have
+ * writable static variable to hold the one instance, so currently
+ * we need well-behaving app to handle this: the application must known
+ * the nature of this gesture recogniser).
+ * The different windows can add their callbacks, and when recognising tap
+ * the target window is stored so that proper callback can be called.
+ * Doubletap is reported either to the target of second tap, or if that windows parent
+ * has a doubletap listener, to that.
+ * Use separate listeners for tap and doubletap.
+ */
+NONSHARABLE_CLASS( CTapGestureRecogniser ): public CTimer, public MGestureRecogniserIf
+{
+public:
+    static const TGestureUid KUid = EGestureUidTap;
+
+    /** Two-phase constructor */
+    static CTapGestureRecogniser* NewL(MGestureListener* aListener) ;
+
+    virtual ~CTapGestureRecogniser();
+
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+    virtual void enable(bool enabled) ;
+    virtual bool isEnabled() ;
+    virtual void setOwner(CCoeControl* owner) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+    /*!
+     * Additional methods to set up tap gesture recogniser:
+     * define the double tap timeout in microseconds.
+     * \param timeoutInMicroseconds
+     */
+    void setDoubleTapTimeout(int timeoutInMicroseconds) ;
+
+    /*!
+     * Additional methods to set up tap gesture recogniser:
+     * define how close the two taps need to be to be recognised
+     * as a double tap.
+     * \param rangeInMillimetres
+     */
+    void setDoubleTapRange(int rangeInMillimetres) ;
+    /*!
+     * Additional methods to set up tap gesture recogniser:
+     * Produce two separate taps or just ignore the first one
+     * if the second tap is outside range.
+     */
+    void ignoreFirstTap(bool ignore) ;
+
+    /*!
+     * Method to add a listener to tap gestures
+     */
+    void addTapListener(MGestureListener* aListener, CCoeControl* listenerOwner) ;
+    /*!
+     * Method to remove a listener from tap gestures
+     */
+    void removeTapListener(MGestureListener* aListener, CCoeControl* listenerOwner) ;
+    /*!
+     * Method to add a listener to doubletap gestures
+     */
+    void addDoubleTapListener(MGestureListener* aListener, CCoeControl* listenerOwner) ;
+    /*!
+     * Method to remove a listener from doubletap gestures
+     */
+    void removeDoubleTapListener(MGestureListener* aListener, CCoeControl* listenerOwner) ;
+
+    /*!
+     * for testing purposes we need to log the stuff somewhere...
+     */
+public:
+    virtual void enableLogging(bool loggingOn) ;
+
+    /*!
+     * The timer function to handle timeout for tap
+     */
+    virtual void RunL() ;
+
+
+private:
+    CTapGestureRecogniser(MGestureListener* aListener) ;
+    bool m_loggingenabled ;
+    bool isSecondTapClose(const TPoint& secondPoint, const TPoint& firstPoint) ;
+private:
+    CCoeControl* m_powner ; // The owning control for this gesture
+    bool m_waitingforsecondtap ;
+    TPoint m_firstTapXY ;
+    CCoeControl* m_firstTapTarget ;
+    float m_firstTapSpeedX ;
+    float m_firstTapSpeedY ;
+    int m_doubleTapTimeout ;
+    bool m_gestureEnabled ;
+    bool m_ignorefirst ;
+    int  m_rangesizeInPixels ;
+    // use simple arrays to store the listeners and corresponding windows
+    RPointerArray<MGestureListener> m_tapListeners ;
+    RPointerArray<CCoeControl> m_tapListenerWindows ;
+    RPointerArray<MGestureListener> m_doubleTapListeners ;
+    RPointerArray<CCoeControl> m_doubleTapListenerWindows ;
+
+
+};
+
+} // namespace
+
+#endif /* TAPGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/timerinterface.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Interface for Timer
+*
+*/
+
+#ifndef TIMERINTERFACE_H_
+#define TIMERINTERFACE_H_
+
+class MTimerInterface
+{
+public:
+	virtual void startTouchTimer(TInt aDelay, TInt aPointerNumber) = 0 ;
+	virtual void cancelTouchTimer(TInt aPointerNumber) = 0 ;
+	virtual void startHoldTimer(TInt aDelay, TInt aPointerNumber) = 0 ;
+	virtual void cancelHoldTimer(TInt aPointerNumber) = 0 ;
+	virtual void startSuppressTimer(TInt aDelay, TInt aPointerNumber) = 0 ;
+	virtual void cancelSuppressTimer(TInt aPointerNumber) = 0 ;
+};
+#endif /* TIMERINTERFACE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/touchgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Touch Gesture Recogniser
+*
+*/
+
+#ifndef TOUCHGESTURERECOGNISER_H_
+#define TOUCHGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+/*!
+ * CTouchGestureRecogniser handles touch "gesture".  The purpose is to inform the app
+ * that a touch has happened.  The gesture is never owned, since most of the gestures start with touch.
+ * The app may define the area where to watch the gestures, or it can define empty area:
+ * then the touch is recognised inside the window.
+ *
+ */
+NONSHARABLE_CLASS( CTouchGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidTouch;
+
+    /** Two-phase constructor */
+    static CTouchGestureRecogniser* NewL(MGestureListener* aListener);
+    virtual ~CTouchGestureRecogniser();
+
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+    /*!
+     * Additional methods to set up edge scroll gesture recogniser:
+     * define the rectangle where the touch is watched
+     * \param theArea
+     */
+    void setArea(const TRect& theArea) ;
+
+private:
+    CTouchGestureRecogniser(MGestureListener* aListener) ;
+
+private:
+    TRect m_area ;
+};
+
+} // namespace
+
+#endif /* TOUCHGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/uievent.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   UI Event
+*
+*/
+
+#ifndef UIEVENT_H_
+#define UIEVENT_H_
+#include "rt_uievent.h"
+
+namespace stmUiEventEngine
+{
+
+NONSHARABLE_CLASS( CUiEvent ): public MUiEvent
+{
+public:
+    virtual const TPoint& StartPos() const ;
+    virtual const TPoint& CurrentXY() const ; // current yx-coordinate
+    virtual const TPoint& PreviousXY() const ;    // Past yx coordinate
+    virtual TTimeIntervalMicroSeconds StateTransition() const ;    // Time taken for state transition
+    virtual bool TimerExpired() const;   // if timer expired
+    virtual TUiEventCode Code()const ;
+    virtual void* Target() const ;
+    virtual int Index() const ;
+    MUiEvent* previousEvent() const ;
+    virtual int countOfEvents() const  ;
+    virtual TInt64 timestamp() const ;
+    virtual float speedX() const __SOFTFP; // pixels / millisecond
+    virtual float speedY() const __SOFTFP; // pixels / millisecond
+
+    static CUiEvent* NewL(TUiEventCode aCode, const TPoint& aStart, const TPoint& aXY,
+        const TPoint& aPreviousXY, bool aTimerExpired, void* aTarget,
+        TTimeIntervalMicroSeconds aInterval, int aIndex, TInt64 aTimestamp) ;
+    ~CUiEvent() ;
+    /*!
+     * Chain the UI events ; the whole chain is deleted after release has been handled
+     * in UI sender
+     */
+    virtual void setPrevious(CUiEvent* aEvent) ;
+private:
+    CUiEvent(
+        TUiEventCode aCode,
+        const TPoint& aStart, const TPoint& aXY, const TPoint& aPreviousXY,
+        bool aTimerExpired, void* aTarget, TTimeIntervalMicroSeconds aInterval,
+        int aIndex, TInt64 aTimestamp) ;
+
+    TUiEventCode m_code ;
+    TPoint m_start ;
+    TPoint m_XY ;
+    TPoint m_previousXY ;
+    TTimeIntervalMicroSeconds m_statetransition ;
+    void* m_target ;
+    bool m_timerExpired ;
+    int  m_index ;
+    CUiEvent* m_previousEvent ;
+    TInt64 m_timestamp ;
+};
+}
+#endif /* UIEVENT_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/uieventsender.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Ui Event Sender Class
+*
+*/
+
+#ifndef UIEVENTSENDER_H_
+#define UIEVENTSENDER_H_
+
+#include <e32base.h>
+#include <coemain.h>
+#include <rt_uievent.h>
+
+namespace stmUiEventEngine
+{
+
+class CUiEvent;
+/**
+ * CUiEventSender class for handling the sending of events to the UI event listener
+ */
+NONSHARABLE_CLASS(CUiEventSender): public CBase
+    {
+public:
+    enum TEventSenderState
+        {
+        ENoEvents,
+        EEventsReady,
+        EBusy
+        };
+
+    static CUiEventSender* NewL( );
+    ~CUiEventSender();
+
+    TInt AddEvent(CUiEvent* aGestureEvent);
+    bool addObserver(MUiEventObserver* aObserver );
+    bool removeObserver(MUiEventObserver* aObserver );
+    void setLogging(bool a) {m_loggingenabled = a;} ;
+
+private:
+    CUiEventSender();
+    void EmitEventL( const CUiEvent& aGestureEvent );
+
+    /*!
+     * Should we be prepared for more than 5 pointers ?  Jos tulee Torvisen voittaja
+     */
+    CUiEvent* iEvents[stmUiEventEngine::KMaxNumberOfPointers];
+    void compressStack(CUiEvent* aUiEvent) ;
+
+    /*
+     * Let's be prepared for more than one observer,
+     * although usually there is only the gesture engine
+     */
+    RPointerArray<MUiEventObserver> iObserver;
+    bool m_loggingenabled ;
+
+    };
+}
+#endif /* UIEVENTSENDER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/unknowngesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Unknown gesture recognizer
+*
+*/
+
+#ifndef UNKNOWNGESTURERECOGNISER_H_
+#define UNKNOWNGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+/*!
+ * CUnknownGestureRecogniser handles unknown gestures at ERelease
+ * I.e. if no-one else has recognised a gesture when ERelease arrives,
+ * This recogniser can be at the end of the list to inform the app
+ * that something weird is happening...
+ *
+ */
+NONSHARABLE_CLASS( CUnknownGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidUnknown;
+
+    /** Two-phase constructor */
+    static CUnknownGestureRecogniser* NewL(MGestureListener* aListener);
+    virtual ~CUnknownGestureRecogniser();
+
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+private:
+    CUnknownGestureRecogniser(MGestureListener* aListener) ;
+
+};
+
+} // namespace
+
+#endif /* UNKNOWNGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/updowngesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Updown Gesture Recognizer
+*
+*/
+
+#ifndef UPDOWNGESTURERECOGNISER_H_
+#define UPDOWNGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+NONSHARABLE_CLASS( CUpdownGestureRecogniser ): public CGestureRecogniser
+{
+public:
+    static const TGestureUid KUid = EGestureUidUpDown;
+
+    static CUpdownGestureRecogniser* NewL(MGestureListener* aListener);
+
+    virtual ~CUpdownGestureRecogniser();
+    /*!
+     * MGestureRecogniserIf methods
+     */
+    virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+    virtual void release(MGestureEngineIf* ge) ;
+
+    virtual TGestureUid gestureUid() const
+        {
+        return KUid;
+        }
+
+private:
+    CUpdownGestureRecogniser(MGestureListener* aListener) ;
+};
+
+}
+
+#endif /* UPDOWNGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/utils.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Utility funtions
+*
+*/
+
+#ifndef _GESTURE_UTILS_H_
+#define _GESTURE_UTILS_H_
+
+#include <e32std.h>
+
+namespace stmUiEventEngine
+{
+
+    /**
+     * @return the rectange in which dragging will be ignored. Tolerance rect
+     *         represents a rectange within which any movement will not be considered
+     *         intentional, but as accidental stylus movement.
+     */
+    TRect ToleranceRect( const TPoint& aCenterPoint );
+
+    long Twips2Pixels(long twips);
+    long Mm2Pixels(long mm);
+    long Inches2Pixels(double inches);
+
+} // namespace stmProto04
+
+#endif // _GESTURE_UTILS_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/inc/zoomgesturerecogniser.h	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Zoom Gesture Recognizer
+*
+*/
+
+#ifndef ZOOMGESTURERECOGNISER_H_
+#define ZOOMGESTURERECOGNISER_H_
+
+#include "rt_gestureengineif.h"
+#include <rt_gestureif.h>
+#include <rt_gesturelistener.h>
+
+class CCoeControl ;
+
+namespace stmGesture
+{
+
+/*!
+ * CZoomGestureRecogniser handles zoomin gesture: start from near lower left / upper right corner and drag
+ * This is useful if one wants to implement single handed zooming so can be done using thumb
+ * (no need to use pinch i.e. hold device in one hand and use two fingers of the other)
+ * Current spec is:
+ * - touch lower left corner and start dragging => initialize ZOOM IN
+ * - touch upper right corner and start dragging => initialize ZOOM OUT
+ * store the touch point and then calculate the distance until release
+ * The distance is the zoom factor (probably needs some adjustment, not just the pixels...)
+ */
+NONSHARABLE_CLASS( CZoomGestureRecogniser ): public CGestureRecogniser
+{
+public:
+	static const TGestureUid KUid = EGestureUidCornerZoom;
+
+	/** Two-phase constructor */
+	static CZoomGestureRecogniser* NewL(MGestureListener* aListener);
+	virtual ~CZoomGestureRecogniser();
+
+	/*!
+	 * MGestureRecogniserIf methods
+	 */
+	virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
+	virtual void release(MGestureEngineIf* ge) ;
+	virtual TGestureUid gestureUid() const
+	{
+		return KUid;
+	}
+
+	/*!
+	 * Additional methods to set up zoom in gesture recogniser:
+	 * define the rectangle where the lower left corner is
+	 * \param theArea
+	 */
+	void setArea(const TRect& theArea) ;
+
+	/*!
+	 * Additional methods to set up zoom in gesture recogniser:
+	 * Define how close to the lower left corner the touch must happen
+	 * \param rangeInPixels
+	 */
+	void setRange(int rangeInPixels) ;
+
+private:
+	CZoomGestureRecogniser(MGestureListener* aListener) ;
+
+	float calculateDistance(const TPoint& aTp) ;
+	int adjustZoom(float& aPreviousDistance, float aNewDistance) ;
+
+private:
+	TRect m_area ;
+	int  m_rangesizeInPixels ;
+	TZoomType m_zoomtype ;
+	bool m_zooming ;
+	TPoint m_startingtouch ;
+	TPoint m_previoustouch ;
+	int m_delta ;
+
+};
+
+} // namespace
+
+#endif /* ZOOMGESTURERECOGNISER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/rom/stmgesturefw.iby	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  STM Gesture Fw iby file
+*
+*/
+
+
+#ifndef _STMGESTUREFW_IBY_
+#define _STMGESTUREFW_IBY_
+
+#include <platform/mw/Browser_platform_variant.hrh>
+
+#ifdef BRDO_USE_GESTURE_HELPER
+
+#include <data_caging_paths_for_iby.hrh>
+
+file=ABI_DIR\BUILD_DIR\stmgesturefw.dll SHARED_LIB_DIR\stmgesturefw.dll
+
+#endif // BRDO_USE_GESTURE_HELPER
+
+#endif // _STMGESTUREFW_IBY_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/sis/backup_registration.xml	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+  <system_backup/>
+  <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/UiEvent.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <e32math.h>
+#include "UiEvent.h"
+#include "filelogger.h"
+#include "statemachine.h" // for stmUiEventEngine::Distance(dx,dy)
+//#include "flogger.h"
+
+using namespace stmUiEventEngine ;
+
+static const char* const eventNames[] = {  // for debugging purposes define the names of the UI events
+        "noEvent",
+        "ETouch",
+        "EHold",
+        "EDrag",
+        "ERelease",
+        "ENull"
+} ;
+
+const char* stmUiEventEngine::EventName(stmUiEventEngine::TUiEventCode aCode)
+{
+    return eventNames[aCode];
+}
+
+CUiEvent* CUiEvent::NewL(
+    TUiEventCode aCode,
+    const TPoint& aStart, const TPoint& aXY, const TPoint& aPreviousXY,
+    bool aTimerExpired, void* aTarget, TTimeIntervalMicroSeconds aInterval,
+    int aIndex, TInt64 aTimestamp)
+{
+    CUiEvent* self = new (ELeave) CUiEvent(aCode, aStart, aXY, aPreviousXY,
+        aTimerExpired, aTarget, aInterval, aIndex, aTimestamp) ;
+    return self;
+}
+
+CUiEvent::CUiEvent(
+    TUiEventCode aCode,
+    const TPoint& aStart, const TPoint& aXY, const TPoint& aPreviousXY,
+    bool aTimerExpired, void* aTarget, TTimeIntervalMicroSeconds aInterval,
+    int aIndex, TInt64 aTimestamp) :
+    m_code(aCode), m_start(aStart), m_XY(aXY), m_previousXY(aPreviousXY),
+    m_statetransition(aInterval), m_target(aTarget), m_timerExpired(aTimerExpired),
+    m_index(aIndex), m_previousEvent(NULL), m_timestamp(aTimestamp)
+{
+}
+
+CUiEvent::~CUiEvent()
+{
+    delete m_previousEvent ;
+    m_previousEvent = NULL ;
+}
+const TPoint& CUiEvent::StartPos() const
+{
+    return m_start ;
+}
+const TPoint& CUiEvent::CurrentXY() const
+{
+    return m_XY ;
+}
+TUiEventCode CUiEvent::Code()const
+{
+    return m_code ;
+}
+const TPoint& CUiEvent::PreviousXY() const
+{
+    return m_previousXY ;
+}
+TTimeIntervalMicroSeconds CUiEvent::StateTransition() const
+{
+    return m_statetransition ;
+}
+bool CUiEvent::TimerExpired() const
+{
+    return m_timerExpired ;
+}
+void * CUiEvent::Target() const
+{
+    return m_target ;
+}
+int CUiEvent::Index() const
+{
+    return m_index ;
+}
+void CUiEvent::setPrevious(CUiEvent* aEvent)
+{
+    m_previousEvent = aEvent ;
+}
+MUiEvent* CUiEvent::previousEvent() const
+{
+    return m_previousEvent ;
+}
+int CUiEvent::countOfEvents() const
+{
+    int count = 1 ;
+    for(CUiEvent* prev = m_previousEvent; prev; prev = prev->m_previousEvent)
+        {
+        ++count;
+        }
+    return count ;
+}
+TInt64 CUiEvent::timestamp() const
+{
+    return m_timestamp ;
+}
+
+float CUiEvent::speedX() const __SOFTFP
+{
+    int distX = m_XY.iX - m_previousXY.iX;
+    // now calculate speed
+    float elapsed = float (m_statetransition.Int64()/1000) ; // use ms as time unit
+
+    float speed = 0;
+    if (elapsed == 0) {
+        elapsed = 5.0;    // if time is 0, take 5ms
+    }
+    speed = float(distX)/elapsed ;
+    return speed ;
+}
+
+float CUiEvent::speedY() const __SOFTFP
+{
+    int distY = m_XY.iY - m_previousXY.iY;
+    // now calculate speed
+    float elapsed = float (m_statetransition.Int64()/1000) ; // use ms as time unit
+    float speed = 0;
+    if (elapsed == 0) {
+        elapsed = 5.0;    // if time is 0, take 5ms
+    }
+    speed = float(distY)/elapsed ;
+    return speed ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/edgescrollgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GenericSimpleGesture.h"
+#include "edgescrollgesturerecogniser.h"
+#include "rt_uievent.h"
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+CEdgeScrollGestureRecogniser::CEdgeScrollGestureRecogniser(MGestureListener* aListener) :
+    CPeriodic(0), m_listener(aListener) , m_area()
+{
+    m_powner = aListener->getOwner() ;
+    m_gestureEnabled = true ;
+    m_rangesizeInPixels = 10 ;  // by default 10 pixels from the edges is the area
+}
+
+CEdgeScrollGestureRecogniser* CEdgeScrollGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CEdgeScrollGestureRecogniser* self = new (ELeave) CEdgeScrollGestureRecogniser(aListener) ;
+    CleanupStack::PushL(self);
+    self->ConstructL(); // construct base class
+    CActiveScheduler::Add(self);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CEdgeScrollGestureRecogniser::~CEdgeScrollGestureRecogniser()
+{
+    Cancel();
+}
+
+TGestureRecognitionState CEdgeScrollGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like edge scroll with one pointer
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be EHold
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        int countOfEvents = puie->countOfEvents();
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code();
+
+        if (m_loggingenabled)
+        {
+            LOGARG("CEdgeScrollGestureRecogniser: %d num %d code %d", 
+                    eventCode, countOfEvents, eventCode);
+        }
+
+        if (eventCode == stmUiEventEngine::EHold) // The last one is EHold, look if it is near the area defined
+        {
+            const TPoint& p = puie->CurrentXY();
+            if (m_loggingenabled)
+            {
+                LOGARG("CEdgeScrollGestureRecogniser: 0x%x EHold: num %d code %d, %d", 
+                        this, countOfEvents, p.iX, p.iY);
+                LOGARG("CEdgeScrollGestureRecogniser: area, %d,%d %d,%d, range: %d", 
+                        m_area.iTl.iX, 
+                        m_area.iTl.iY, 
+                        m_area.iBr.iX, 
+                        m_area.iBr.iY, 
+                        m_rangesizeInPixels);
+            }
+            // check where the point is inside the area defined but outside of the area shrinked by m_rangesizeInPixels.
+            TRect rcInner = m_area ;
+            rcInner.Shrink(m_rangesizeInPixels, m_rangesizeInPixels) ;
+            if (m_area.Contains(p) && !rcInner.Contains(p))
+            {
+                if (m_loggingenabled)
+                {
+                    LOGARG("CEdgeScrollGestureRecogniser: HIT, (%d,%d) in %d,%d %d,%d, range: %d", 
+                            p.iX, p.iY, m_area.iTl.iX, m_area.iTl.iY, 
+                            m_area.iBr.iX, m_area.iBr.iY, 
+                            m_rangesizeInPixels);
+                }
+
+                state = EGestureActive ;
+                // this is edge scroll, check where it is about...
+                TEdgeScroll scrolltype = EEdgeScrollUnknown ;
+                if (p.iY < m_area.iTl.iY + m_rangesizeInPixels)
+                    scrolltype = EEdgeScrollUp ;   // if Y is small enough, it is always up
+                else if (p.iY > m_area.iBr.iY - m_rangesizeInPixels)
+                    scrolltype = EEdgeScrollDown ; // if Y is big enough, it is always down
+                else if (p.iX < m_area.iTl.iX + m_rangesizeInPixels)
+                    scrolltype = EEdgeScrollLeft ; // if X is small enough, it is always left
+                else  if (p.iX > m_area.iBr.iX - m_rangesizeInPixels)
+                    scrolltype = EEdgeScrollRight ;   // if X is big enough, it is always right
+                // issue the edge scroll gesture
+                stmGesture::TGenericSimpleGesture pgest(KUid, p, scrolltype, puie) ;
+                // Call the listener to inform that a Tap has occurred...
+                m_listener->gestureEnter(pgest) ;
+            }
+        }
+    }
+    return state;
+}
+
+void CEdgeScrollGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    Cancel() ;  // some other gesture took hold of the thing, do not send gesture
+    if (m_loggingenabled)
+    {
+        LOGARG("CEdgeScrollGestureRecogniser: 0x%x release", this);
+    }
+}
+
+void CEdgeScrollGestureRecogniser::RunL()
+{
+    if (m_loggingenabled)
+    {
+        LOGARG("CEdgeScrollGestureRecogniser: 0x%x timer", this);
+    }
+}
+
+void CEdgeScrollGestureRecogniser::enableLogging(bool loggingOn)
+{
+    m_loggingenabled = loggingOn;
+}
+
+void CEdgeScrollGestureRecogniser::enable(bool enabled)
+{
+    m_gestureEnabled = enabled ;
+}
+
+bool CEdgeScrollGestureRecogniser::isEnabled()
+{
+    return m_gestureEnabled ;
+}
+
+void CEdgeScrollGestureRecogniser::setOwner(CCoeControl* owner)
+{
+    m_powner = owner;
+}
+
+void CEdgeScrollGestureRecogniser::setScrollRange(int rangeInPixels)
+{
+    m_rangesizeInPixels = rangeInPixels ;
+}
+
+void CEdgeScrollGestureRecogniser::setArea(const TRect& theArea)
+{
+    m_area = theArea ;
+    if (m_loggingenabled)
+    {
+        LOGARG("CEdgeScrollGestureRecogniser: set area, %d,%d %d,%d", m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/filelogger.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+#include "filelogger.h"
+
+#include <bautils.h>
+#include <pathinfo.h>
+
+_LIT(KLogFolder, "logs\\");
+_LIT(KLogFileExt, ".log");
+_LIT8(KLineEnd, "\r\n");
+
+const TInt KTimeRecordSize = 25;
+
+_LIT8(KTimeFormat,"%04d-%02d-%02d %02d:%02d:%02d.%03d ");
+_LIT8(KLogStart, "--== New %S log ==--\r\n");
+
+CFileLogger::CFileLogger()
+{
+}
+
+TBool CFileLogger::Construct()
+{
+    TInt err = iFs.Connect();
+    if (!err)
+    {
+        TFileName logFileName;
+        err = !GetLogFileNameWithoutExt(logFileName);
+        if(!err)
+        {
+            logFileName.Append(KLogFileExt);
+            err = iFile.Create(iFs, logFileName, EFileShareAny | EFileWrite);
+            if(!err)
+            {
+                TInt pos(0);
+                iFile.Seek(ESeekEnd, pos);
+                TBuf8<KMaxFullName> appName;
+                appName.Copy(BaflUtils::ExtractAppNameFromFullName(RThread().FullName()));
+                iLogBuffer.AppendFormat(KLogStart, &appName);
+                err = iFile.Write(iLogBuffer);
+            }
+        }
+    }
+    return (!err);
+}
+
+CFileLogger* CFileLogger::Logger()
+{
+    CFileLogger* logger = (CFileLogger*)Dll::Tls();
+    if (!logger)
+    {
+        logger = new CFileLogger;
+        if (logger)
+        {
+            if (logger->Construct())
+            {
+                Dll::SetTls(logger);
+            }
+            else
+            {
+                delete logger;
+                logger = NULL;
+            }
+        }
+    }
+    return logger;
+}
+
+void CFileLogger::Close()
+{
+    delete (CFileLogger*)Dll::Tls();
+    Dll::FreeTls();
+}
+
+CFileLogger::~CFileLogger()
+{
+    iFile.Close();
+    iFs.Close();
+}
+
+TBool CFileLogger::GetLogFileNameWithoutExt(TDes& aFileName)
+{
+    TFileName path = PathInfo::MemoryCardRootPath() ;
+    path.Append(PathInfo::OthersPath()) ;   // Put the log in the "Others" directory
+    aFileName.Append(path);
+    aFileName.Append(KLogFolder);
+    TBool res = BaflUtils::FolderExists(iFs, aFileName);
+    if (!res)
+    {
+        aFileName.Zero();
+        aFileName.Append(path) ; // put it then directly to Others folder
+        res = ETrue ;
+    }
+    TPtrC fileName(BaflUtils::ExtractAppNameFromFullName(RThread().FullName()));
+    aFileName.Append(fileName);
+    TTime time;
+    time.HomeTime();
+    TDateTime dateTime;
+    dateTime = time.DateTime();
+    // add timestamp to the name (then one has to clear them manually)
+    aFileName.AppendNum(dateTime.Month()+1) ;
+    aFileName.AppendNum(dateTime.Day()+1) ;
+    aFileName.AppendNum(dateTime.Hour()) ;
+    aFileName.AppendNum(dateTime.Minute()) ;
+    aFileName.AppendNum(dateTime.Second()) ;
+    return res;
+}
+
+void CFileLogger::Write(const TDesC8& aText)
+{
+    CFileLogger* logger = Logger();
+    if(logger)
+    {
+        logger->iLogBuffer.Copy(aText);
+        logger->DoWrite();
+    }
+}
+
+void CFileLogger::Write(const TDesC16& aText)
+{
+    CFileLogger* logger = Logger();
+    if(logger)
+    {
+        logger->iLogBuffer.Copy(aText);
+        logger->DoWrite();
+    }
+}
+
+void CFileLogger::Write(TRefByValue<const TDesC8> aFmt,...)
+{
+    CFileLogger* logger = Logger();
+    if (logger)
+    {
+        VA_LIST list;
+        VA_START(list, aFmt);
+        logger->iLogBuffer.FormatList(aFmt, list);
+        logger->DoWrite();
+        VA_END(list);
+    }
+}
+
+void CFileLogger::DoWrite()
+{
+    if(iFile.SubSessionHandle())
+    {
+        TTime time;
+        time.HomeTime();
+        TDateTime dateTime;
+        dateTime = time.DateTime();
+        TBuf8<KTimeRecordSize> timeRecord;
+        timeRecord.Format(KTimeFormat, dateTime.Year(), dateTime.Month()+1, dateTime.Day()+1, 
+                          dateTime.Hour(), dateTime.Minute(), dateTime.Second(), 
+                          dateTime.MicroSecond()/1000);
+        iLogBuffer.Insert(0, timeRecord);
+        iLogBuffer.Append(KLineEnd);
+        iFile.Write(iLogBuffer);
+    }
+}
+void CFileLogger::DoFlush()
+{
+    if(iFile.SubSessionHandle())
+    {
+        iFile.Flush();
+    }
+
+}
+void CFileLogger::Flush()
+{
+    CFileLogger* logger = Logger();
+    if (logger)
+    {
+        logger->DoFlush() ;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/flickgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GenericSimpleGesture.h"
+#include "flickgesturerecogniser.h"
+#include "rt_uievent.h"
+#include "filelogger.h"
+//#include "flogger.h"
+
+using namespace stmGesture ;
+
+CFlickGestureRecogniser::CFlickGestureRecogniser(MGestureListener* aListener) :
+    CGestureRecogniser(aListener)
+{
+}
+
+CFlickGestureRecogniser* CFlickGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CFlickGestureRecogniser* self = new (ELeave) CFlickGestureRecogniser(aListener) ;
+    return self;
+}
+
+CFlickGestureRecogniser::~CFlickGestureRecogniser()
+{
+}
+/*!
+ * Release gesture recogniser.  Note that this one never owns the gesture, it just calls
+ * the callback if it detects ERelease inside the area being watched.
+ * There could be also check for the target window?
+ */
+TGestureRecognitionState CFlickGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like flick with one pointer
+    if (numOfActiveStreams == 1)
+    {
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        if (!puie) return state;
+        int countOfEvents = puie->countOfEvents();
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code();
+        if (m_loggingenabled)
+        {
+            LOGARG("CFlickGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
+
+        }
+        if (m_powner == puie->Target() && eventCode == stmUiEventEngine::ERelease)
+        {
+            if (m_loggingenabled)
+            {
+                LOGARG("CFlickGestureRecogniser: 0x%x ERelease: num %d code %d, %d", this, countOfEvents, puie->CurrentXY().iX, puie->CurrentXY().iY);
+            }
+            // Check if the speed before release was fast enough for flick
+            const stmUiEventEngine::MUiEvent* puieprev = puie->previousEvent() ;
+            if (puieprev && puieprev->Code() == stmUiEventEngine::EMove)
+            {
+                using stmUiEventEngine::TUiEventSpeed;
+
+                float thespeedX = puieprev->speedX() ;
+                float thespeedY = puieprev->speedY() ;
+                if (m_loggingenabled)
+                {
+                    LOGARG("CFlickGestureRecogniser: prev speed: %f (limit: %f)", double(thespeedX), double(m_speed)) ;
+                }
+                if (Abs( thespeedX) >= m_speed || Abs( thespeedY) >= m_speed )
+                {
+                    state = EGestureActive ;
+
+                    TUiEventSpeed speedIf(thespeedX, thespeedY);
+
+                    // issue the flick gesture using the TDirectionalGesture (it has the speed and direction)
+                    stmGesture::TDirectionalGesture pgest(
+                            KUid,
+                            puieprev->CurrentXY(),
+                            puieprev->PreviousXY(),
+                            &speedIf,
+                            m_loggingenabled);
+
+                    // Call the listener to inform that a flick has occurred...
+                    m_listener->gestureEnter(pgest);
+                }
+            }
+        }
+    }
+    return state;
+}
+void CFlickGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    if (m_loggingenabled)
+    {
+        LOGARG("CFlickGestureRecogniser: 0x%x flick", this);
+    }
+}
+void CFlickGestureRecogniser::setFlickingSpeed(float aSpeed) __SOFTFP
+{
+    m_speed = aSpeed ;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/genericsimplegesture.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GenericSimpleGesture.h"
+#include "filelogger.h"
+
+using namespace stmGesture ;
+using stmUiEventEngine::MUiEventSpeed;
+
+
+TGenericSimpleGesture::TGenericSimpleGesture(
+    TGestureUid uid, const TPoint& loc, int type, const MUiEventSpeed* speedIf) :
+    m_location(loc), m_uid(uid), m_type(type), m_details(0), m_speed(speedIf)
+{
+}
+
+TPoint TGenericSimpleGesture::getLocation()  const
+{
+    return m_location ;
+}
+
+int TGenericSimpleGesture::getType()  const
+{
+    return m_type ;
+}
+
+int TGenericSimpleGesture::getDetails() const
+{
+    return m_details ;
+}
+
+void TGenericSimpleGesture::setName(const TDesC8& aName)
+{
+    m_name.Set(aName) ;
+}
+
+TPtrC8 TGenericSimpleGesture::getGestureName()
+{
+    return m_name ;
+}
+
+TDirectionalGesture::TDirectionalGesture(
+    TGestureUid uid, const TPoint& loc, const TPoint& prevLoc,
+    const MUiEventSpeed* speedIf, bool logging) :
+    TGenericSimpleGesture(uid, loc, 0, speedIf), m_loggingEnabled(logging)
+{
+    setVector(loc, prevLoc);
+}
+
+void TDirectionalGesture::setVector(const TPoint& last, const TPoint& previous)
+{
+    m_vector = TPoint(last.iX-previous.iX, previous.iY-last.iY) ;  // x > 0 => east, y > 0 => north
+    if (m_loggingEnabled)
+    {
+        LOGARG("CHoveringGesture: x: %d , %d prev: %d, %d", last.iX, last.iY, previous.iX, previous.iY) ;
+    }
+}
+
+TGestureDirection TDirectionalGesture::getDirection() const
+{
+    TGestureDirection dir = ENorth ;
+    int x = Abs(m_vector.iX) ;
+    int y = Abs(m_vector.iY) ;
+    if (y <= x/2)
+    {
+        if (m_vector.iX < 0)
+            dir = EWest ;
+        else
+            dir = EEast ;
+    }
+    else if (y > x/2 && y <= (x+x/2))
+    {
+        if (m_vector.iX < 0)
+        {
+            if (m_vector.iY < 0 )
+                dir = ESouthWest ;
+            else
+                dir = ENorthWest ;
+        }
+        else
+        {
+            if (m_vector.iY < 0 )
+                dir = ESouthEast ;
+            else
+                dir = ENorthEast ;
+        }
+    }
+    else if (y > x+x/2)
+    {
+        if (m_vector.iY < 0)
+            dir = ESouth ;
+        else
+            dir = ENorth ;
+    }
+    if (m_loggingEnabled)
+    {
+        LOGARG("CHoveringGesture: x: %d y: %d direction: %d", m_vector.iX, m_vector.iY, dir) ;
+    }
+    return dir ;
+}
+
+TTwoPointGesture::TTwoPointGesture(TGestureUid uid, const TPoint& loc, const TPoint& prevLoc) :
+    TDirectionalGesture(uid, loc, prevLoc, NULL),
+    m_location2(prevLoc)
+{
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/gestureengine.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GestureEngine.h"
+
+#include "filelogger.h"
+
+
+using namespace stmGesture ;
+
+CGestureEngine::CGestureEngine()
+{
+    m_numOfActiveStreams = 0 ;
+    m_currentGestureOwner = -1 ;
+    m_currentLockedGesture = -1 ;
+    for (int i = 0; i < stmUiEventEngine::KMaxNumberOfPointers; i++)
+    {
+        m_uiEventStream[i] = NULL ;
+    }
+}
+
+CGestureEngine::~CGestureEngine()
+{
+    m_gestures.Reset() ;
+}
+
+bool CGestureEngine::addGesture(const MGestureRecogniserIf* aNewGesture)
+{
+    // Add the new gesture recogniser to our list of recognisers
+    return m_gestures.Append(aNewGesture) == 0;
+}
+
+bool CGestureEngine::insertGesture(const MGestureRecogniserIf* aNewGesture)
+{
+    return insertGestureAt(aNewGesture, 0) == 0;
+}
+
+bool CGestureEngine::insertGestureAt(const MGestureRecogniserIf* aNewGesture, int position)
+{
+    return m_gestures.Insert(aNewGesture, position) == 0 ;
+}
+
+bool CGestureEngine::removeGesture(const MGestureRecogniserIf* aOldGesture)
+{
+    // If gestures are removed, there cannot be current gesture owner...
+    if (m_currentGestureOwner != -1)
+    {
+        MGestureRecogniserIf* pgrif = m_gestures[m_currentGestureOwner] ;
+        pgrif->release(this) ;
+        m_currentGestureOwner = -1 ;    // no more gesture owners...
+    }
+    TInt ix = m_gestures.Find(aOldGesture) ;
+    bool found = (ix != -1);
+    if (found)
+    {
+        m_gestures.Remove(ix) ;
+    }
+    return found ;
+}
+
+int CGestureEngine::activeStreamCount() const
+{
+    return m_numOfActiveStreams ;
+}
+
+const stmUiEventEngine::MUiEvent* CGestureEngine::getUiEvents(int indexOfActiveStream) const
+{
+#if defined(ADVANCED_POINTER_EVENTS)
+	// create temporary array of active event streams and initialize with zero
+	const stmUiEventEngine::MUiEvent* activeEventPointers[stmUiEventEngine::KMaxNumberOfPointers] ;
+	for (int x = 0; x < stmUiEventEngine::KMaxNumberOfPointers; x++) activeEventPointers[x] = 0 ;
+	// then fill from currently active event streams
+	int indextoactiveEventPointers = 0 ;
+    for (int i = 0; i < stmUiEventEngine::KMaxNumberOfPointers; i++)
+    {
+    	if (m_uiEventStream[i])
+    	    activeEventPointers[indextoactiveEventPointers++] = m_uiEventStream[i] ;
+    }
+	// then return the active event stream asked
+    return activeEventPointers[indexOfActiveStream] ;
+#else
+    // in single touch it is enough to return the only possible pointer
+    return m_uiEventStream[indexOfActiveStream] ;
+#endif
+}
+
+/*!
+ * Process the UI events
+ */
+void CGestureEngine::HandleUiEventL(const stmUiEventEngine::MUiEvent& aEvent )
+{
+    // process one incoming UI event
+    storeUiEvent(aEvent) ;  // store the event to the "stream" based on the index of pointer
+    walkTroughGestures() ;  // and walk trough the gestures to process the UI event
+    updateUiEvents() ;
+    // If it was last release event, make sure no-one has the gestures locked
+    m_numOfActiveStreams = 0 ;
+    for (int i = 0; i < stmUiEventEngine::KMaxNumberOfPointers; i++)
+    {
+        if (m_uiEventStream[i]) m_numOfActiveStreams++ ;
+    }
+    if (m_numOfActiveStreams == 0)
+    {
+        if (m_currentLockedGesture != -1)
+        {
+            MGestureRecogniserIf* pgrif = m_gestures[m_currentLockedGesture] ;
+            pgrif->release(this) ;
+        }
+        m_currentLockedGesture = -1 ;
+    }
+}
+
+/*!
+ * Store the UI event.  There are max X "streams" of events, one for each
+ * pointer.  The streams are actually just pointers to the latest event, since the
+ * MUiEvent interface has methods to walk trough the chain of events.
+ */
+void CGestureEngine::storeUiEvent(const stmUiEventEngine::MUiEvent& aEvent)
+{
+    m_uiEventStream[aEvent.Index()] = &aEvent ;
+    m_numOfActiveStreams = 0 ;
+    for (int i = 0; i < stmUiEventEngine::KMaxNumberOfPointers; i++)
+    {
+        if (m_uiEventStream[i]) m_numOfActiveStreams++ ;
+    }
+}
+
+/*!
+ *  Call each gesture handler in turn until one claims to be in control of the gesture.
+ */
+void CGestureEngine::walkTroughGestures()
+{
+    int newowner = -1 ;
+    int newlocker = m_currentLockedGesture ;
+    // check if someone has locked the gesture
+    TGestureRecognitionState thestate = ENotMyGesture ;
+    if (m_currentLockedGesture != -1)
+    {
+        MGestureRecogniserIf* pgrif = m_gestures[m_currentLockedGesture] ;
+        if (pgrif)
+        {
+            if (m_loggingEnabled)
+            {
+                // log entry about locked gesture (hmm.. should have added names to the MGestureRecogniserIf
+                LOGARG("locked gesture recognizer %d (addr %d), active streams %d",
+                        m_currentLockedGesture, pgrif, m_numOfActiveStreams);
+            }
+
+            thestate = pgrif->recognise(m_numOfActiveStreams, this) ;
+            switch (thestate)
+            {
+            case EGestureActive:
+            {
+                // This gesture recogniser owns the gesture, so release the lock
+                newlocker = -1 ;
+                newowner = m_currentLockedGesture ;
+                if (m_loggingEnabled)
+                {
+                    LOGARG("new owner %d lock release", m_currentLockedGesture);
+                }
+                break;
+            }
+            case ELockToThisGesture:
+            {
+                // this gesture recogniser wants to keep the lock
+                newowner = m_currentLockedGesture ;
+                newlocker = m_currentLockedGesture ;
+                if (m_loggingEnabled)
+                {
+                    LOGARG("new owner %d keep lock", m_currentLockedGesture);
+                }
+                break;
+
+            }
+            case ENotMyGesture:
+            {
+                break;
+            }
+            }
+        }
+        else
+        {
+            if (m_loggingEnabled)
+            {
+                LOGARG("NULL recogniser for %d", m_currentLockedGesture);
+            }
+        }
+    }
+
+    if (thestate == ENotMyGesture)
+    {
+        if (m_loggingEnabled)
+        {
+            LOGARG("walk trough recognizers active streams %d", m_numOfActiveStreams);
+        }
+        // No locking gesture, walk trough the list until someone handles this
+        for (int i = 0; i < m_gestures.Count(); i++)
+        {
+            bool controlObtained = false;
+            MGestureRecogniserIf* pgrif = m_gestures[i];
+            if (pgrif)
+            {
+                switch (pgrif->recognise(m_numOfActiveStreams, this))
+                {
+                case EGestureActive:
+                {
+                    // This gesture recogniser owns the gesture, stop looping...
+                    controlObtained = true;
+                    newowner = i;
+                    break;
+                }
+                case ELockToThisGesture:
+                {
+                    // this gesture recogniser wants to take ownership
+                    controlObtained = true;
+                    newowner = i;
+                    newlocker = i;
+                    break;
+
+                }
+                case ENotMyGesture:
+                {
+                    break;
+                }
+                }
+            }
+            if (controlObtained)
+            {
+                break; // do not process rest of the gestures
+            }
+
+        }
+    }
+    if (newowner != -1 && newowner != m_currentGestureOwner)
+    {
+        if (m_currentGestureOwner != -1)
+        {
+            MGestureRecogniserIf* pgrif = m_gestures[m_currentGestureOwner] ;
+            pgrif->release(this) ;
+        }
+        m_currentGestureOwner = newowner ;
+    }
+    m_currentLockedGesture = newlocker ;    // if someone locked it or released the lock
+}
+
+void CGestureEngine::updateUiEvents()
+{
+    for (int i = 0; i < stmUiEventEngine::KMaxNumberOfPointers; i++)
+    {
+        if (m_uiEventStream[i])
+        {
+            if (m_uiEventStream[i]->Code() == stmUiEventEngine::ERelease)
+            {
+                // Event can be removed since Release is the last event
+                // note that it is the lower layer event engine
+                // which actually deletes the object
+                m_uiEventStream[i] = NULL ;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/gestureframework.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "statemachine.h"
+#include "gestureframework.h"
+#include "gestureframeworkimpl.h"
+#include "GestureEngine.h"
+#include "rt_gestureengineif.h"
+#include "rt_gesturelistener.h"
+#include "tapgesturerecogniser.h"
+#include "pangesturerecogniser.h"
+
+using namespace stmGesture ;
+
+CGestureFramework::CGestureFramework()
+{
+    // No implementation required
+}
+
+CGestureFramework::~CGestureFramework()
+{
+    delete m_impl ;
+}
+
+CGestureFramework* CGestureFramework::NewLC()
+{
+    CGestureFramework* self = new (ELeave) CGestureFramework();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+CGestureFramework* CGestureFramework::NewL()
+{
+    CGestureFramework* self = CGestureFramework::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+void CGestureFramework::ConstructL()
+{
+    m_impl = CGestureFrameworkImpl::NewL() ;
+}
+
+TVersion CGestureFramework::Version()
+{
+    // Version number of example API
+    const TInt KMajor = 1;
+    const TInt KMinor = 0;
+    const TInt KBuild = 1;
+    return TVersion(KMajor, KMinor, KBuild);
+}
+
+/*!
+ * Create new gesture engine if not already existing and return the interface
+ */
+MGestureEngineIf*  CGestureFramework::getGestureEngine()
+{
+    return m_impl->getGestureEngine() ;
+}
+
+stmUiEventEngine::CStateMachine* CGestureFramework::getUiStateMachine()
+{
+    return m_impl->getUiStateMachine() ;
+}
+
+void CGestureFramework::enableLogging(bool loggingEnabled)
+{
+    m_loggingenabled = loggingEnabled;
+    if (m_impl) m_impl->enableLogging(loggingEnabled) ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/gestureframeworkimpl.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+
+#include "gestureframeworkimpl.h"
+#include "GestureEngine.h"
+#include "statemachine.h"
+
+using namespace stmGesture ;
+
+CGestureFrameworkImpl::CGestureFrameworkImpl()
+{
+    // No implementation required
+}
+
+CGestureFrameworkImpl::~CGestureFrameworkImpl()
+{
+    m_statemachine->removeUiEventObserver(m_gestureEngine) ;
+    delete m_gestureEngine ;
+    delete m_statemachine ;
+}
+
+CGestureFrameworkImpl* CGestureFrameworkImpl::NewLC()
+{
+    CGestureFrameworkImpl* self = new (ELeave) CGestureFrameworkImpl();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+CGestureFrameworkImpl* CGestureFrameworkImpl::NewL()
+{
+    CGestureFrameworkImpl* self = CGestureFrameworkImpl::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+void CGestureFrameworkImpl::ConstructL()
+{
+    /*!
+     * create the gesture engine and the low level UI event engine
+     */
+    m_gestureEngine = new (ELeave)CGestureEngine() ;
+    m_statemachine = stmUiEventEngine::CStateMachine::NewL() ;
+    // TODO: all kinds of default settings for the lower layer, but in the test app
+    // they are set from the settings menu so no need now...
+    // Add the gesture engine to be the observer of UI events...
+    m_statemachine->addUiEventObserver(m_gestureEngine) ;
+}
+MGestureEngineIf*  CGestureFrameworkImpl::getGestureEngine()
+{
+    return m_gestureEngine ;
+}
+
+void CGestureFrameworkImpl::enableLogging(bool loggingEnabled) 
+{
+	m_loggingenabled = loggingEnabled;
+	if (m_gestureEngine)
+	{
+		m_gestureEngine->enableLogging(loggingEnabled) ;
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/gesturehelpereventsender.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "gesturehelpereventsender.h"
+
+const TInt KEventsQueueGranularity = 4;
+
+CGestureEventSender* CGestureEventSender::NewL( MStmGestureListener& aObserver )
+    {
+    CGestureEventSender* self = new (ELeave) CGestureEventSender(aObserver);
+    
+    return self;
+    }
+
+CGestureEventSender::CGestureEventSender( MStmGestureListener& aObserver ) : 
+                                          CActive(EPriorityUserInput - 1),
+                                          iObserver(aObserver), iEvents(KEventsQueueGranularity)
+    { 
+    CActiveScheduler::Add(this);
+    }
+
+CGestureEventSender::~CGestureEventSender()
+    {
+    if (IsActive()) 
+        {
+        Cancel();
+        }
+
+    iEvents.Close();
+    }
+
+TInt CGestureEventSender::AddEvent(TStmGestureUid aUid, const MStmGesture* aGestureEvent)
+    {
+    TStmGestureEvent event;
+    if (aGestureEvent) {
+        event.SetCode(aGestureEvent->gestureUid());
+        event.SetCurrentPos(aGestureEvent->getLocation());
+        event.SetSpeed(TRealPoint(aGestureEvent->getSpeedX()*1000,aGestureEvent->getSpeedY()*1000));//App needs the speed in pixels/sec
+        event.SetType(TStmTapType(aGestureEvent->getType()));
+        event.SetDetails(aGestureEvent->getDetails());
+        event.SetGestureDirection(aGestureEvent->getDirection());
+        event.SetPinchEndPos(aGestureEvent->getPinchEndPos());
+        event.SetGestureState(EGestureEnter);
+    }
+    else {
+        if (aUid != stmGesture::EGestureUidPinch) {
+            return iEvents.Count();
+        }    
+        event.SetCode(aUid);
+        event.SetGestureState(EGestureExit);
+    }
+        
+    iEvents.Append(event);
+    if (iState != EBusy)
+        {
+        iState = EEventsReady;
+        }
+    
+    if (!IsActive()) 
+        {
+        Complete();
+        }
+    return iEvents.Count();
+    }
+
+void CGestureEventSender::Complete()
+    {
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    SetActive();
+    }
+
+void CGestureEventSender::RunL()
+    {
+    switch (iState)
+        {
+        case EEventsReady:
+            {
+            if (iEvents.Count() > 0)
+                {
+                TInt count = iEvents.Count();
+                for (int i = 0;  i < count; i++)
+                    {
+                    TStmGestureEvent& gst = iEvents[i];
+                    EmitEventL(gst);
+                    }
+                }
+            iEvents.Reset();
+            iState = ENoEvents;
+            Complete();
+            break;
+            }
+        }
+    }
+
+void CGestureEventSender::EmitEventL( const TStmGestureEvent& aGesture )
+    {
+    iState = EBusy;
+    iObserver.HandleGestureEventL(aGesture);
+    iState = EEventsReady;
+    }
+
+TInt CGestureEventSender::RunError(TInt aError)
+    {
+    iEvents.Reset();
+    return aError;
+    }
+
+void CGestureEventSender::DoCancel()
+    {
+    iEvents.Reset();
+    iState = ENoEvents;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/hoveringgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#include "hoveringgesturerecogniser.h"
+#include "GenericSimpleGesture.h"
+#include "rt_uievent.h"
+
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+extern long Mm2Pixels(long mm) ;
+
+
+CHoveringGestureRecogniser::CHoveringGestureRecogniser(MGestureListener* aListener) :
+    CGestureRecogniser(aListener)
+{
+    m_hovering = false ;
+    m_hoveringspeed = 0.9f ;
+}
+
+CHoveringGestureRecogniser* CHoveringGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CHoveringGestureRecogniser* self = new (ELeave) CHoveringGestureRecogniser(aListener) ;
+    return self;
+}
+
+CHoveringGestureRecogniser::~CHoveringGestureRecogniser()
+{
+}
+
+TGestureRecognitionState CHoveringGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like hovering
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be tap and release
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        int countOfEvents = puie->countOfEvents() ;
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code() ;
+        if (countOfEvents > 1) // do we have more than one event in the stream?
+        {
+            // Then look at the events to see if they are suitable for us
+            // should we check that all of the events are targeted to our window?
+            // currently we only check if the last one is for us and is EMove, then we pan...
+            if (puie->Target() == m_powner &&
+                    eventCode == stmUiEventEngine::EMove) // The last one is move in our window
+            {
+                float speedX = puie->speedX() ;
+                float speedY = puie->speedY() ;
+                if (m_loggingenabled)
+                {
+                    LOGARG("CHoveringGestureRecogniser: %d: num %d code %d, speed %f, limit %f",
+                        m_hovering, countOfEvents, eventCode, 
+                        double(speedX), double(m_hoveringspeed));
+                }
+                // It might be hovering gesture in our window, handle it
+                if (!m_hovering)
+                {
+                    // we are not yet hovering, so lets see if it is slow movement
+                    // but it must be movement; if it is 0.0 do not hover
+                    if ( ((speedX > 0.01f) ||(speedY > 0.01f)) && 
+                            ((speedX < m_hoveringspeed) || (speedY < m_hoveringspeed))
+                        )
+                    {
+                        state = EGestureActive;
+                        m_hovering = true;
+                    }
+                }
+                if (m_hovering)
+                {
+                    // after we've started hovering, the speed could be increased a little before we loose hovering
+                    // but this adjustment is not implemented now...
+                    if (speedX < m_hoveringspeed || speedY < m_hoveringspeed)
+
+                    {
+                        using stmUiEventEngine::TUiEventSpeed;
+
+                        state = EGestureActive;
+                        TUiEventSpeed speedIf(speedX, speedY);
+                        stmGesture::TDirectionalGesture pgest(
+                                        KUid,
+                                        puie->CurrentXY(),
+                                        puie->PreviousXY(),
+                                        &speedIf,
+                                        m_loggingenabled);
+
+                        // Call the listener to inform that a Hover has occurred...
+                        m_listener->gestureEnter(pgest);
+                    }
+                }
+            }
+            else if (m_hovering)
+            {
+                if (eventCode == stmUiEventEngine::ERelease) // The last one is release in any window
+                {
+                    m_hovering = false ;
+                    // release will handle informing of the listener
+                }
+            }
+        }
+        else
+        {
+            // count of events == 1, lets see if it is EMove, then we take it and start hovering
+            if (puie->Target() == m_powner &&
+                    eventCode == stmUiEventEngine::EMove) // The only one is move in our window
+            {
+                if (m_loggingenabled)
+                {
+                    LOGARG("CHoveringGestureRecogniser: move: num %d code %d", countOfEvents, eventCode);
+                }
+                state = EGestureActive;
+                stmGesture::TDirectionalGesture pgest(
+                                        KUid,
+                                        puie->CurrentXY(),
+                                        puie->PreviousXY(),
+                                        puie,
+                                        m_loggingenabled);
+
+                // Call the listener to inform that a Hover has occurred...
+                m_listener->gestureEnter(pgest);
+            }
+        }
+    }
+    if (state == ENotMyGesture)
+    {
+        // if it was not our gesture, then the state can not be hovering...
+        m_hovering = false ;
+    }
+    return state;
+}
+
+void CHoveringGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    m_hovering = false ;
+    m_listener->gestureExit(KUid) ;
+}
+
+void CHoveringGestureRecogniser::setHoveringSpeed(float aSpeed) __SOFTFP
+{
+    m_hoveringspeed = aSpeed ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/leftrightgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "leftrightgesturerecogniser.h"
+#include "GenericSimpleGesture.h"
+#include "rt_uievent.h"
+
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+_LIT8(KLeftrightName, "Leftlight");
+
+CLeftrightGestureRecogniser::CLeftrightGestureRecogniser(MGestureListener* aListener) : 
+        CGestureRecogniser(aListener)
+{
+}
+
+CLeftrightGestureRecogniser* CLeftrightGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CLeftrightGestureRecogniser* self = new (ELeave) CLeftrightGestureRecogniser(aListener) ;
+    return self;
+}
+
+CLeftrightGestureRecogniser::~CLeftrightGestureRecogniser()
+{
+}
+
+TGestureRecognitionState CLeftrightGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like a tap or double tap
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be tap and release
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        int countOfEvents = puie->countOfEvents() ;
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code() ;
+        if (countOfEvents > 1) // do we have more than one event in the stream?
+        {
+            // Then look at the events to see if they are suitable for us
+            // should we check that all of the events are targeted to our window?
+            // currently we only check if the last one is for us and is EMove, then check if |x| > |y|
+            if (puie->Target() == m_powner &&
+                    eventCode == stmUiEventEngine::EMove) // The last one is move in our window
+
+            {
+                if (m_loggingenabled)
+                {
+                    LOGARG("CLeftrightGestureRecogniser: Leftright: num %d code %d", 
+                            countOfEvents, eventCode);
+                }
+                // Is it leftright gesture in our window?
+                const TPoint& p = puie->CurrentXY();
+                TPoint dp = p - puie->PreviousXY();
+                if (Abs(dp.iX) > Abs(dp.iY))
+                {
+                    state = EGestureActive;
+                    stmGesture::TGenericSimpleGesture pgest(KUid, p, dp.iX, puie) ;
+                    pgest.setName(KLeftrightName) ;
+                    // Call the listener to inform that a Leftright has occurred...
+                    m_listener->gestureEnter(pgest) ;
+                }
+            }
+        }
+    }
+    return state;
+}
+
+void CLeftrightGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    m_listener->gestureExit(KUid) ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/longpressgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GenericSimpleGesture.h"
+#include "longpressgesturerecogniser.h"
+#include "rt_uievent.h"
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+CLongPressGestureRecogniser::CLongPressGestureRecogniser(MGestureListener* aListener) :
+    CGestureRecogniser(aListener)
+{
+}
+
+CLongPressGestureRecogniser* CLongPressGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CLongPressGestureRecogniser* self = new (ELeave) CLongPressGestureRecogniser(aListener) ;
+    return self;
+}
+
+CLongPressGestureRecogniser::~CLongPressGestureRecogniser()
+{
+}
+
+/*!
+ * recognise the long press; basically it is just the EHold UI event
+ */
+TGestureRecognitionState CLongPressGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+
+    // Look at the events to see if it looks like long press with one pointer
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be EHold
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        if (!puie) return state;
+        int countOfEvents = puie->countOfEvents();
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code();
+
+        if (m_loggingenabled)
+        {
+            LOGARG("CLongPressGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
+        }
+        if (puie->Target() == m_powner && eventCode == stmUiEventEngine::EHold) // The last one is EHold, look if it is near our borders
+        {
+            const TPoint& p = puie->CurrentXY() ;
+            if (m_loggingenabled)
+            {
+                LOGARG("CLongPressGestureRecogniser: (%d, %d) in (%d,%d)(%d,%d)", p.iX, p.iY,
+                        m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY);
+            }
+             state = EGestureActive ;
+             // issue the long press gesture
+             stmGesture::TGenericSimpleGesture pgest(KUid, p, 0, puie) ; // TODO: speed is 0?
+             // Call the listener to inform that the gesture has occurred...
+             m_listener->gestureEnter(pgest) ;
+        }
+    }
+    return state;
+}
+
+void CLongPressGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    if (m_loggingenabled)
+    {
+        LOGARG("CLongPressGestureRecogniser: 0x%x release", this);
+    }
+}
+
+void CLongPressGestureRecogniser::setArea(const TRect& theArea)
+{
+    m_area = theArea ;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/pangesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "pangesturerecogniser.h"
+#include "GenericSimpleGesture.h"
+#include "rt_uievent.h"
+
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+CPanGestureRecogniser::CPanGestureRecogniser(MGestureListener* aListener) : 
+        CGestureRecogniser(aListener)
+{
+}
+
+CPanGestureRecogniser* CPanGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CPanGestureRecogniser* self = new (ELeave) CPanGestureRecogniser(aListener) ;
+    return self;
+}
+
+CPanGestureRecogniser::~CPanGestureRecogniser()
+{
+}
+
+TGestureRecognitionState CPanGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like a tap or double tap
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be tap and release
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        if (!puie) return state;
+        int countOfEvents = puie->countOfEvents() ;
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code() ;
+        if (countOfEvents > 1) // do we have more than one event in the stream?
+        {
+            // Then look at the events to see if they are suitable for us
+            // should we check that all of the events are targeted to our window?
+            // currently we only check if the last one is for us and is EMove, then we pan if the speed is OK
+            if (puie->Target() == m_powner &&
+                eventCode == stmUiEventEngine::EMove) // The last one is move in our window
+
+            {
+                if (m_loggingenabled)
+                {
+                    LOGARG("CPanGestureRecogniser: Pan: num %d code %d", countOfEvents, eventCode);
+                }
+                float speedX = puie->speedX();
+                float speedY = puie->speedY();
+
+                using stmUiEventEngine::TUiEventSpeed;
+
+                state = EGestureActive;
+                TUiEventSpeed speedIf(speedX, speedY);
+                // Panning gesture
+                stmGesture::TDirectionalGesture pgest(
+                                 KUid,
+                                 puie->CurrentXY(),
+                                 puie->PreviousXY(),
+                                 &speedIf,
+                                 m_loggingenabled);
+
+               // Call the listener to inform that a Pan has occurred...
+               m_listener->gestureEnter(pgest);
+            }
+        }
+    }
+    return state;
+}
+
+void CPanGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    m_listener->gestureExit(KUid) ;
+}
+
+void CPanGestureRecogniser::setPanningSpeedLow(float aSpeed) __SOFTFP
+{
+    m_panningspeedlow = aSpeed ;
+}
+
+void CPanGestureRecogniser::setPanningSpeedHigh(float aSpeed) __SOFTFP
+{
+    m_panningspeedhigh = aSpeed ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/pinchgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,440 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+#include <e32math.h>
+#include "pinchgesturerecogniser.h"
+#include "GenericSimpleGesture.h"
+#include <rt_uievent.h>
+#include "filelogger.h"
+#include "statemachine.h" // for stmUiEventEngine::Distance(dx,dy)
+
+using namespace stmGesture ;
+
+extern long Mm2Pixels(long mm) ;
+
+
+CPinchGestureRecogniser::CPinchGestureRecogniser(MGestureListener* aListener) :
+        CGestureRecogniser(aListener)
+{
+    m_pinching = false ;
+    m_pinchingspeed = 3.5 ; // by default something suitable for capacitive
+    m_holdseen = false ;
+}
+
+CPinchGestureRecogniser* CPinchGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CPinchGestureRecogniser* self = new (ELeave) CPinchGestureRecogniser(aListener) ;
+    return self;
+}
+
+CPinchGestureRecogniser::~CPinchGestureRecogniser()
+{
+}
+
+TGestureRecognitionState CPinchGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    if (m_loggingenabled)
+    {
+        LOGARG("CPinchGestureRecogniser: %d %d %d ", m_pinching, m_holdseen, numOfActiveStreams) ;
+    }
+#if !defined(ADVANCED_POINTER_EVENTS)
+    // Look at the events to see if it looks like pinch in single touch
+    // WARNING: this code is a hack : in single touch capacitive touch device (like Alvin with 52.50) it works so-and-so,
+    // because the pointer events were reported from the corners of the rectangle formed by two fingers pressing.
+    // In resistive touch device like Tube or Ivalo the reported points are somewhere int he middle between the fingers
+    // and jumping a lot, so it is very difficult to get it right.
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, first we need to see a hold and then a fast jump
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        int countOfEvents = puie->countOfEvents() ;
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code() ;
+
+        if (countOfEvents > 0 ) // how many events
+        {
+            if (m_loggingenabled)
+            {
+                LOGARG("CPinchGestureRecogniser: %d %d %d %d %d, m: %d b: %d",
+                        m_pinching, m_holdseen, numOfActiveStreams, countOfEvents, eventCode,
+                        int(m_m), int(m_b)) ;
+            }
+
+            if (m_pinching)
+            {
+                // We have entered pinching state, lets move one of the points unless it is a release
+                if (eventCode == stmUiEventEngine::ERelease)
+                {
+                    m_pinching = false ;
+                    m_holdseen = false ;
+                }
+                else
+                {
+                    bool pointIgnored = true ;  // for logging purposes
+                    int currentLength = m_loggingenabled ?
+                                        stmUiEventEngine::Distance(m_pinchstart, m_pinchend) : 0;
+
+                    TPoint oStart(m_pinchstart) ;
+                    TPoint oEnd(m_pinchend) ;
+                    int difference = 0 ;
+                    state = ELockToThisGesture ;
+                    const TPoint& tp = puie->CurrentXY();
+                    // calculate the distance of the new point from the stored vector
+                    int d1 =  ((m_pinchstart.iX-tp.iX)*(m_pinchstart.iX-tp.iX)) +
+                                ((m_pinchstart.iY-tp.iY)*(m_pinchstart.iY-tp.iY)) ;
+                    int d2 =  ((m_pinchend.iX-tp.iX)*(m_pinchend.iX-tp.iX)) +
+                                ((m_pinchend.iY-tp.iY)*(m_pinchend.iY-tp.iY)) ;
+                    // check also if the Y coordinate happens to be near the hold point,
+                    // this seems to be the case at least with alvin, we keep getting two points,
+                    // where one is near the Y coordinate of the hold point
+                    int diffY = Abs(tp.iY-m_pinchstart.iY) ;
+
+                    if (d1 < d2 || diffY < 12)
+                    {
+                        // the detected point is near the first point,
+                        // or the detected point is about on the same horizontal line with the hold point
+                        // do not do anything, but keep the gesture
+                    }
+                    else
+                    {
+                        pointIgnored = false ;
+                        // the detected point is close to the other end, then adjust the stored vector
+                        int xd = m_pinchend.iX-tp.iX ;
+                        int yd = m_pinchend.iY-tp.iY ;
+                        if (xd < 0 ) xd = - xd ;
+                        if (yd < 0 ) yd = - yd ;
+                        // look which coordinate is closer to the original and use that
+                        if (xd < yd)
+                        {
+                            // calculate new point based on the X value
+                            m_pinchend.iX = tp.iX ;
+                            m_pinchend.iY = m_m*m_pinchend.iX + m_b ;
+                            if (m_pinchend.iY < 0) m_pinchend.iY = 0 ;
+                        }
+                        else
+                        {
+                            if (m_m != 0)
+                            {
+                                m_pinchend.iY = tp.iY ;
+                                m_pinchend.iX = (m_pinchend.iY - m_b)/m_m ;
+                                if (m_pinchend.iX <0 ) m_pinchend.iX = 0 ;
+                            }
+                            else
+                            {
+                                m_pinchend.iX = tp.iX ;
+                                m_pinchend.iY = m_m*m_pinchend.iX + m_b ;
+                                if (m_pinchend.iY < 0) m_pinchend.iY = 0 ;
+                            }
+                        }
+                        float newd = calculateDistance() ;
+                        // check if the difference is too big and adjust accordingly
+                        // the method also updates the m_ddistance
+                        difference = adjustPinchMove(m_ddistance, newd) ;
+                        // Now we have a pinch gesture with size as details
+                        stmGesture::TTwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+                        pgest.setLogging(m_loggingenabled);
+                        pgest.setDetails(difference) ;
+                        // inform the listener
+                        m_listener->gestureEnter(pgest);
+                    }
+                    if (m_loggingenabled)
+                    {
+                        int newLength = stmUiEventEngine::Distance(m_pinchstart, m_pinchend);
+                        float speedX = puie->speedX() ;
+                        float speedY = puie->speedY() ;
+
+                        LOGARG("CPinchGestureRecogniser: %d: o: %d, n: %d, d: %d (%d,%d) " \
+                                "speed %f (%d,%d : %d,%d) (from: (%d,%d : %d,%d) (m: %f b: %f)",
+                                pointIgnored,
+                                currentLength, newLength, difference,
+                                tp.iX, tp.iY, double(speedX),
+                                m_pinchstart.iX, m_pinchstart.iY, m_pinchend.iX, m_pinchend.iY,
+                                oStart.iX, oStart.iY, oEnd.iX, oEnd.iY,
+                                double(m_m), double(m_b)) ;
+
+                    }
+
+                }
+            }
+            else if (eventCode == stmUiEventEngine::EMove) // The last one is move and we were not pinching
+            {
+                if (m_loggingenabled)
+                {
+                    LOGARG("CPinchGestureRecogniser: %d: num %d code %d", m_pinching, countOfEvents, eventCode);
+                }
+                stmUiEventEngine::MUiEvent* puieFirst = puie->previousEvent();
+
+                // check if we have seen hold
+                if (m_holdseen)
+                {
+                    const TPoint& tp1 = puie->CurrentXY() ;
+                    float speedX = puie->speedX() ;
+                    float speedY = puie->speedY() ;
+                    if (m_loggingenabled)
+                    {
+                        LOGARG("CPinchGestureRecogniser: tp1: %d %d hold %d %d, speed %f",
+                                tp1.iX, tp1.iY,
+                                m_holdseenAtPos.iX, m_holdseenAtPos.iY, double(speedX) );
+                    }
+                    // is the speed extremely high so that it looks like other finger pressing in different location?
+                    if ( (speedX > m_pinchingspeed) || (speedY > m_pinchingspeed) )
+                    {
+                        TInt64 tstamp = puie->timestamp() ;
+                        TTime now(tstamp) ;
+                        TTimeIntervalMicroSeconds tim = now.MicroSecondsFrom(m_holdseenAtTime) ;
+                        m_pinching = true;
+                        m_pinchstart = m_holdseenAtPos;
+                        m_pinchend = tp1;
+                        calculateZoomingLine();
+                        m_ddistance = calculateDistance();
+                        state = ELockToThisGesture ;    // NOTE: once pinch is started, it will stay until release
+                        // create the first pich gesture which does not yet resize anything
+                        stmGesture::TTwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+                        pgest.setLogging(m_loggingenabled);
+                        pgest.setDetails(0) ;
+                        // inform the listener
+                        m_listener->gestureEnter(pgest);
+                    }
+                }
+            }
+        }
+        if (!m_pinching)
+        {
+            if (m_loggingenabled)
+            {
+                LOGARG("CPinchGestureRecogniser: not pinching %d", puie);
+            }
+            if (puie && puie->Code() == stmUiEventEngine::EHold) // The last one is hold and we were not pinching
+            {
+                m_holdseen = true;
+                m_holdseenAtPos = puie->CurrentXY();
+                m_holdseenAtTime = puie->timestamp() ;
+                if (m_loggingenabled)
+                {
+                    LOGARG("CPinchGestureRecogniser: hold seen at(%d, %d) at %Ld",
+                            m_holdseenAtPos.iX, m_holdseenAtPos.iY, m_holdseenAtTime.Int64());
+                }
+            }
+        }
+        if (puie && puie->Code() == stmUiEventEngine::ETouch) // The last one is touch
+        {
+            m_holdseen = false;
+        }
+        else if (puie && puie->Code() == stmUiEventEngine::ERelease) // The last one is release
+        {
+            m_holdseen = false;
+        }
+    }
+#else
+    // This is the multi touch case: two event streams needs to be there; this is the real pinch zoom
+    if (numOfActiveStreams == 2)
+    {
+        const stmUiEventEngine::MUiEvent* puie1 = pge->getUiEvents(0);
+        const stmUiEventEngine::MUiEvent* puie2 = pge->getUiEvents(1);
+        stmUiEventEngine::TUiEventCode eventCode1 = puie1->Code() ;
+        stmUiEventEngine::TUiEventCode eventCode2 = puie2->Code() ;
+
+        if (m_loggingenabled)
+        {
+            TPoint p1 = puie1->CurrentXY() ;
+            TPoint p2 = puie2->CurrentXY() ;
+            LOGARG("CPinchGestureRecogniser: two streams: %s at [%d,%d], %s at [%d,%d]",
+                    stmUiEventEngine::EventName(eventCode1), p1.iX, p1.iY,
+                    stmUiEventEngine::EventName(eventCode1), p2.iX, p2.iY
+                    ) ;
+
+        }
+
+
+        if (!m_pinching)
+        {
+            // This means we start pinching, the events can be any combination of ETouch, EMove, EHold
+            if ( (  eventCode1 == stmUiEventEngine::ETouch  ||
+                    eventCode1 == stmUiEventEngine::EMove   ||
+                    eventCode1 == stmUiEventEngine::EHold
+                  ) &&
+                 (  eventCode2 == stmUiEventEngine::ETouch  ||
+                    eventCode2 == stmUiEventEngine::EMove   ||
+                    eventCode2 == stmUiEventEngine::EHold )
+                 )
+            {
+                // This is valid pinching start
+                m_pinching = true ;
+                // get the start and end position for the picnhing vector
+                m_pinchstart = puie1->CurrentXY() ;
+                m_pinchend = puie2->CurrentXY() ;
+                calculateZoomingLine();
+                m_ddistance = calculateDistance();
+                state = ELockToThisGesture ;    // NOTE: once pich is started, it will stay until release
+                if (m_loggingenabled)
+                {
+                    LOGARG("CPinchGestureRecogniser: pinch start: [%d,%d][%d,%d]",
+                            m_pinchstart.iX, m_pinchstart.iY, m_pinchend.iX, m_pinchend.iY) ;
+
+                }
+                // create the first pich gesture which does not yet resize anything
+                stmGesture::TTwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+                pgest.setLogging(m_loggingenabled);
+                pgest.setDetails(0) ;
+                // inform the listener
+                m_listener->gestureEnter(pgest);
+            }
+            else
+            {
+            	// Not a valid pinching start, do nothing (maybe it were easier to just check if one of the events is ERelease)
+            }
+        }
+        else
+        {
+            // We have entered pinching state, lets move one of the points unless it is a release
+            if (eventCode1 == stmUiEventEngine::ERelease || eventCode2 == stmUiEventEngine::ERelease)
+            {
+                release(pge);
+            }
+            else
+            {
+                state = ELockToThisGesture ;
+
+                // get the start and end position for the picnhing vector
+                m_pinchstart = puie1->CurrentXY() ;
+                m_pinchend = puie2->CurrentXY() ;
+                float newd = calculateDistance() ;
+                // check if the difference is too big and adjust accordingly
+                // the method also updates the m_ddistance
+                int difference = adjustPinchMove(m_ddistance, newd) ;
+                // Now we have a pinch gesture with size
+                if (m_loggingenabled)
+                {
+                    LOGARG("CPinchGestureRecogniser: pinch: [%d,%d][%d,%d], diff %d",
+                            m_pinchstart.iX, m_pinchstart.iY, m_pinchend.iX, m_pinchend.iY, difference) ;
+
+                }
+
+                stmGesture::TTwoPointGesture pgest(KUid, m_pinchstart, m_pinchend);
+                pgest.setLogging(m_loggingenabled);
+                pgest.setDetails(difference) ;
+                // inform the listener
+                m_listener->gestureEnter(pgest);
+            }
+        }
+
+    }
+#endif
+
+    if (state == ENotMyGesture)
+    {
+        if (m_loggingenabled)
+        {
+            LOGARG("CPinchGestureRecogniser: NotMyGesture %d %d %d ",
+                    m_pinching, m_holdseen, numOfActiveStreams) ;
+        }
+        // if it was not our gesture, then the state can not be pinching...
+        m_pinching = false ;
+    }
+    return state;
+}
+
+void CPinchGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    m_pinching = false ;
+    m_listener->gestureExit(KUid) ;
+}
+
+/*!
+ * Now that we know the two points where the zooming started, we move those points only along
+ * the same line y = mx + b, so lets calculate m and b.
+ */
+void CPinchGestureRecogniser::calculateZoomingLine()
+{
+    int sX = m_pinchstart.iX ;
+    int sY = m_pinchstart.iY ;
+    int eX = m_pinchend.iX ;
+    int eY = m_pinchend.iY ;
+
+    if (eX == sX)
+    {
+        m_m = 0.f ;
+    }
+    else
+    {
+        m_m = float(eY-sY)/(eX-sX) ;
+    }
+    m_b = sY-(m_m*sX) ;
+}
+
+/*!
+ * calculate the distance, return as float
+ */
+float CPinchGestureRecogniser::calculateDistance()
+{
+    double x = ((m_pinchstart.iX-m_pinchend.iX)*(m_pinchstart.iX-m_pinchend.iX))+
+               ((m_pinchstart.iY-m_pinchend.iY)*(m_pinchstart.iY-m_pinchend.iY)) ;
+    double ddist ;
+    Math::Sqrt(ddist, x) ;
+    return float(ddist) ;
+}
+
+/*!
+ * Set the pinching speed as pixels / ms (meaning that in case of singletouch device
+ * the other finger looks like the EMove UI event suddenly jumps to new location;
+ * in resistive the new location is somewhere in the middle of the touches, in capacitive
+ * the driver seems to report three or four points:
+ * original (x,y), new (a,b) and also (a,y), sometimes (x,b)
+ */
+void CPinchGestureRecogniser::setPinchingSpeed(float aSpeed) __SOFTFP
+{
+    m_pinchingspeed = aSpeed ;
+}
+
+/*!
+ * Adjust the pinch move so that it will not be too jumpy
+ */
+int CPinchGestureRecogniser::adjustPinchMove(float& aPreviousDistance, float aNewDistance)
+{
+    float diff = aNewDistance - aPreviousDistance ;
+    float logdiff = diff ;
+    if (diff < 0) diff = -diff ;	// Note that the next calculations need the positive diff value, but keep the original in logdiff
+    float changePercentage = (diff/aPreviousDistance)*100.f ;
+    if (changePercentage > 10.f)
+    {
+        // change more than 10%, make at most 10%
+        float newdiff = aPreviousDistance*0.1f ;
+        if (aPreviousDistance > aNewDistance) newdiff = -newdiff ;
+        if (m_loggingenabled)
+        {
+            LOGARG("CPinchGestureRecogniser: adjustPinchMove from %f to %f : was, now %f %f",
+                double(logdiff), double(newdiff), double(aPreviousDistance), double(aNewDistance));
+        }
+
+        aPreviousDistance = aPreviousDistance + newdiff ;
+        diff = newdiff ;
+    }
+    else
+    {
+        if (m_loggingenabled)
+        {
+            LOGARG("CPinchGestureRecogniser: adjustPinchMove from %f to %f : was, now %f %f",
+                double(logdiff), double(diff), double(aPreviousDistance), double(aNewDistance));
+        }
+        aPreviousDistance = aNewDistance ;  // accept the new value and update the new length
+        diff = logdiff ;    // put the original back (this is why the logdiff can not be Abs(diff)!
+    }
+    return (int)diff ;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/releasegesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GenericSimpleGesture.h"
+#include "releasegesturerecogniser.h"
+#include "rt_uievent.h"
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+_LIT8(KReleaseName, "Release");
+
+CReleaseGestureRecogniser::CReleaseGestureRecogniser(MGestureListener* aListener) :
+    CGestureRecogniser(aListener)
+{
+}
+
+CReleaseGestureRecogniser* CReleaseGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CReleaseGestureRecogniser* self = new (ELeave) CReleaseGestureRecogniser(aListener) ;
+    return self;
+}
+
+CReleaseGestureRecogniser::~CReleaseGestureRecogniser()
+{
+}
+
+/*!
+ * Release gesture recogniser.  Note that this one never owns the gesture, it just calls
+ * the callback if it detects ERelease inside the area being watched.
+ * There could be also check for the target window?
+ */
+TGestureRecognitionState CReleaseGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like edge scroll with one pointer
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be EHold
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        if (!puie) return state;
+        
+        int countOfEvents = puie->countOfEvents();
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code();
+
+        if (m_loggingenabled)
+        {
+            LOGARG("CReleaseGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
+        }
+        if (eventCode == stmUiEventEngine::ERelease)
+        {
+            if (m_loggingenabled)
+            {
+                LOGARG("CReleaseGestureRecogniser: 0x%x ERelease: num %d code %d, %d", 
+                        this, countOfEvents, puie->CurrentXY().iX, puie->CurrentXY().iY);
+                LOGARG("CReleaseGestureRecogniser: area, %d,%d %d,%d", 
+                        m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY);
+            }
+            bool produceGesture ;
+            if(!m_area.IsEmpty())
+            {
+                produceGesture = m_area.Contains(puie->CurrentXY()) ;
+                if(produceGesture && m_loggingenabled)
+                {
+                    LOGARG("CReleaseGestureRecogniser: HIT area (%d,%d) in %d,%d %d,%d", 
+                            puie->CurrentXY().iX, puie->CurrentXY().iY, 
+                            m_area.iTl.iX, m_area.iTl.iY, 
+                            m_area.iBr.iX, m_area.iBr.iY);
+                }
+            }
+            else
+            {
+                produceGesture = (m_powner == puie->Target()) ;  // no area defined, touch detected in the window
+            }
+            if (produceGesture)
+            {
+                state = EGestureActive ;
+                // issue the release gesture using the GenericSimpleGesture
+                stmGesture::TGenericSimpleGesture pgest(KUid, puie->CurrentXY());
+                // Give the gesture a name
+                pgest.setName(KReleaseName) ;
+                // Call the listener to inform that a release has occurred...
+                m_listener->gestureEnter(pgest);
+            }
+        }
+    }
+    return state;
+}
+
+void CReleaseGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    if (m_loggingenabled)
+    {
+        LOGARG("CReleaseGestureRecogniser: 0x%x release", this);
+    }
+}
+
+void CReleaseGestureRecogniser::setArea(const TRect& theArea)
+{
+    m_area = theArea ;
+    if (m_loggingenabled)
+    {
+        LOGARG("CReleaseGestureRecogniser: area, %d,%d %d,%d", 
+                m_area.iTl.iX, m_area.iTl.iY, 
+                m_area.iBr.iX, m_area.iBr.iY);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/stateengine.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,1159 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "stateengine.h"
+#include "utils.h"
+#include "uievent.h"
+#include "uieventsender.h"
+#include "filelogger.h"
+//#include "flogger.h"
+
+using namespace stmUiEventEngine ;
+
+/*!
+  State definitions glue together the methods of the stateengine.cpp
+  so that it will behave as defined in the state machine specification.
+  First define the separate elements for each possible event and then tie them together
+  to create one state entry.  The state entries then are put to array
+  where the index is at the same time also the state ID.
+
+  STATE_ELEMENT arrays define the methods called when handling a message.
+  \sa STATE_ELEMENT.
+  Note that the last row of STATE_ELEMENT array must NOT have a ConditionFunction entry
+  and it must have a NextState entry != Eignore.  Otherwise the state machine will
+  not behave correctly.
+
+ */
+/*! Add macro with token pasting to make creation of the state machine tables easier
+   and removing the necessity to write the classname twice.
+   Maybe there would be some better way to do this using templates and typedefs?
+ */
+#define CND(x) isF<CStateEngine,&CStateEngine::##x>
+#define ACT(x) aF<CStateEngine,&CStateEngine::##x>
+
+/*********************************************************************************
+ * empty statedef as a dummy entry
+ *  */
+const STATE_ELEMENT __ErrorEvent[1] = {
+        0,
+        ACT(ErrorEvent),
+        EInit
+};
+
+const STATE Ignore__[1] = {
+        EDown,          __ErrorEvent
+} ;
+
+/*!
+  :INIT state and its event specific elements
+  See the spec in http://wikis.in.nokia.com/Runtimes/NewGestureLibrary
+  Down is only valid event in :INIT state
+  The event is consumed immediately, so that the state machine will process only these
+  methods when processing the message.
+  If touch timer has been set, the next state is InTouchTime.
+  If no touch timer, but if hold timer has been defined, the next state is InHoldTime_U
+  If no touch or hold timer have been defined, but touch area has been defined, next state is InTouchArea.
+  11-May-2009: addition: add another touch area: one for touch time and one for touch area after touch time
+  has elapsed.  This allows "sloppy" touch to be handled properly without extra move if touchtimearea is larger,
+  but after touch has been detected a smaller movement is allowed.
+ */
+const STATE_ELEMENT Init__Down[12] = {
+        0,                  ACT(ConsumeEvent),    Eignore,
+        0,                  ACT(SetGestureStart), Eignore,
+        0,                  ACT(SetCurrentPos),   Eignore,
+        CND(IsTouchTimer),  ACT(InitTouchTimer),  Eignore,
+        CND(IsHoldTimer),   ACT(InitHoldTimer),   Eignore,
+        CND(IsTouchTimeArea),   ACT(PrepareTouchTimeArea),Eignore,
+        CND(IsHoldArea),    ACT(PrepareHoldArea) ,Eignore,
+        CND(IsTouchTimer),  0,                    EInTouchTime,
+        0,                  ACT(ProduceTouch),    Eignore,
+        CND(IsHoldTimer),   0,                    EInHoldTime_U,
+        CND(IsTouchArea),   ACT(PrepareTouchArea),EInTouchArea,
+        0,                  0,                    EDispatch             // If nothing else happens, goto to Dispatch state
+};
+/**
+ * All the rest of the events are errors so produce error entry to log and
+ * stay in the Init state
+ */
+const STATE_ELEMENT Init__ErrorEvent[2] = {
+        0,              ACT(ConsumeEvent),    Eignore,  // remember to consume event, otherwise state machine will loop...
+        0,              ACT(ErrorEvent),      EInit
+};
+
+/*!
+ * :INIT
+ * note that only valid event is DOWN, all the rest can be handled as errors
+ */
+const STATE Init__[7] = {
+        EDown,          Init__Down,
+        EDrag,          Init__ErrorEvent,
+        ECapacitiveUP,  Init__ErrorEvent,
+        EResistiveUP,   Init__ErrorEvent,
+        ETouchTimer,    Init__ErrorEvent,
+        EHoldTimer,     Init__ErrorEvent,
+        ESuppressTimer, Init__ErrorEvent
+};
+
+/*!
+ *  :Dispatch state end its elements
+ *  Here the valid events are DRAG and the UP events.
+ */
+const STATE_ELEMENT Dispatch__Drag[7] = {
+        0,                  ACT(StoreMovePos),    Eignore,
+        0,                  ACT(ConsumeEvent),    Eignore,
+        0,                  ACT(SetCurrentPos),   Eignore,
+        0,                  ACT(AddDraggingPos),  Eignore,
+        0,                  ACT(ProduceMove),     Eignore,
+        CND(LooksLikeHold), ACT(InitHoldTimer),EInHoldTime_U,
+        0,                  0,                    EDispatch
+} ;
+
+const STATE_ELEMENT Dispatch__CapacitiveUp[3] = {
+        0,                  ACT(ConsumeEvent),    Eignore,
+        0,                  ACT(SetCurrentPos),   Eignore,
+        0,                  ACT(ProduceRelease),  EInit
+} ;
+
+const STATE_ELEMENT Dispatch__ResistiveUp[4] = {
+        0,                   ACT(ConsumeEvent),       Eignore,
+        0,                   ACT(SetCurrentPos),   Eignore,
+        CND(IsSuppressTimer),ACT(InitMoveSuppressTimer),  ESuppress_D,
+        0,                   ACT(ProduceRelease),     EInit
+} ;
+
+/*!
+ * All the rest of the events are errors so produce error entry to log and
+ * stay in the Dispatch state
+ * (TODO: note that in the future we may further
+ * define the error cases so that they may change state; )
+ */
+const STATE_ELEMENT DispatchErrorEvent[2] = {
+        0,              ACT(ConsumeEvent),    Eignore,  // remember to consume event, otherwise state machine will loop...
+        0,              ACT(ErrorEvent),      EDispatch
+};
+
+const STATE Dispatch__[7] = {
+        EDown,          DispatchErrorEvent,
+        EDrag,          Dispatch__Drag,
+        ECapacitiveUP,  Dispatch__CapacitiveUp,
+        EResistiveUP,   Dispatch__ResistiveUp,
+        ETouchTimer,    DispatchErrorEvent,
+        EHoldTimer,     DispatchErrorEvent,
+        ESuppressTimer, DispatchErrorEvent
+};
+
+/*!
+ *  :InTouchTime state end its elements
+ *  Here the valid events are DRAG and the UP events and the TouchTimer
+ */
+const STATE_ELEMENT InTouchTime__Drag[6] = {
+        0,                  ACT(StoreMovePos),    Eignore,
+        CND(InsideTouchTimeArea), ACT(ConsumeEvent),      Eignore,
+        CND(InsideTouchTimeArea), ACT(AddToTouch),        EInTouchTime,     // Calculate touch XY as average of the touches
+        0,                    ACT(ClearTouchTimer),   Eignore,          // These lines are done only if InsideTouchArea returns false
+        0,                    ACT(ClearHoldTimer),    Eignore,
+        0,                    ACT(ProduceTouch),      EDispatch
+
+} ;
+/**
+ * Note that ConsumeEvent is missing so after doing this the state engine will do EDispatch
+ */
+const STATE_ELEMENT InTouchTime__CapacitiveUp[4] = {
+        0,                  ACT(SetCurrentPos),       Eignore,
+        0,                  ACT(ClearTouchTimer),     Eignore,
+        0,                  ACT(ClearHoldTimer),      Eignore,
+        0,                  ACT(ProduceTouch),        EDispatch
+} ;
+/**
+ * Note that ConsumeEvent is not called if IsHoldTimer returns false, so the Dispatch will be done
+ * by the state machine.
+ */
+const STATE_ELEMENT InTouchTime__ResistiveUp[5] = {
+        0,                   ACT(SetCurrentPos),   Eignore,
+        0,                   ACT(ClearTouchTimer),    Eignore,
+        0,                   ACT(ProduceTouch),       Eignore,
+        CND(IsHoldTimer),    0, /*ACT(ConsumeEvent),*/EInHoldTime_U,    // Note that otherwise immediate UP is handled improperly
+        0,                   0,                       EDispatch
+} ;
+
+const STATE_ELEMENT InTouchTime__TouchTimer[6] = {
+        0,                   ACT(ConsumeEvent),       Eignore,
+        0,                   ACT(ClearTouchTimer),    Eignore,
+        0,                   ACT(ProduceTouch),       Eignore,
+        CND(IsTouchArea),    ACT(PrepareTouchArea),Eignore,         // prepare the other touch area
+        CND(IsHoldTimer),    0,                       EInHoldTime_U,
+        0,                   0,                     EInTouchArea
+} ;
+
+
+/**
+ * All the rest of the events are errors so produce error entry to log and
+ * stay in the InTouchTime state
+ */
+const STATE_ELEMENT InTouchTimeErrorEvent[2] = {
+        0,              ACT(ConsumeEvent),    Eignore,  // remember to consume event, otherwise state machine will loop...
+        0,              ACT(ErrorEvent),      EInTouchTime
+};
+
+const STATE InTouchTime__[7] = {
+        EDown,          InTouchTimeErrorEvent,
+        EDrag,          InTouchTime__Drag,
+        ECapacitiveUP,  InTouchTime__CapacitiveUp,
+        EResistiveUP,   InTouchTime__ResistiveUp,
+        ETouchTimer,    InTouchTime__TouchTimer,
+        EHoldTimer,     InTouchTimeErrorEvent,
+        ESuppressTimer, InTouchTimeErrorEvent
+};
+
+/*!
+ *  :InHoldTime_U state end its elements
+ *  Here only touch timer event is invalid
+ */
+
+const STATE_ELEMENT InHoldTime_U__Down[1] = {
+        0,                    0,      EInHoldTime_D  // Note that ConsumeEvent is not called
+} ;
+
+const STATE_ELEMENT InHoldTime_U__Drag[3] = {
+        0,                  ACT(StoreMovePos),    Eignore,
+        CND(InsideHoldArea), ACT(ConsumeEvent),       EInHoldTime_U,
+        0,                    ACT(ClearHoldTimer),    EDispatch     // Note that in this case ConsumeEvent is not called
+} ;
+/**
+ * Note that ConsumeEvent is missing so after doing this the state engine will do EDispatch
+ */
+const STATE_ELEMENT InHoldTime_U__CapacitiveUp[1] = {
+        0,                  ACT(ClearHoldTimer),      EDispatch     // Note that ConsumeEvent not called
+} ;
+/**
+ *
+ */
+const STATE_ELEMENT InHoldTime_U__ResistiveUp[5] = {
+        0,                   ACT(ConsumeEvent),  Eignore,
+        0,                   ACT(SetCurrentPos),   Eignore,
+        CND(IsSuppressTimer),ACT(InitTouchSuppressTimer),  EInHoldTime_D,   // If suppression, start timer and wait for down or timer
+        0,                   ACT(ClearHoldTimer), Eignore,  // remember to do this
+        0,                   ACT(ProduceRelease), EInit     // No suppression, then this is immediate release
+} ;
+
+const STATE_ELEMENT InHoldTime_U__HoldTimer[3] = {
+        0,                   ACT(ConsumeEvent),       Eignore,
+        0,                   ACT(ProduceHold),        Eignore,
+        0,                   ACT(RestartHoldTimer),   EInHoldTime_U,
+} ;
+
+const STATE_ELEMENT InHoldTime_U__SuppressTimer[2] = {
+        0,              ACT(ConsumeEvent),    Eignore,  // remember to consume event, otherwise state machine will loop...
+        0,              ACT(ErrorEvent),      EInHoldTime_U
+} ;
+
+
+/**
+ * All the rest of the events are errors so produce error entry to log and
+ * stay in the InHoldTime_U state
+ */
+const STATE_ELEMENT InHoldTime_UErrorEvent[2] = {
+        0,              ACT(ConsumeEvent),    Eignore,  // remember to consume event, otherwise state machine will loop...
+        0,              ACT(ErrorEvent),      EInHoldTime_U
+};
+
+const STATE InHoldTime_U__[7] = {
+        EDown,          InHoldTime_U__Down,
+        EDrag,          InHoldTime_U__Drag,
+        ECapacitiveUP,  InHoldTime_U__CapacitiveUp,
+        EResistiveUP,   InHoldTime_U__ResistiveUp,
+        ETouchTimer,    InHoldTime_UErrorEvent,
+        EHoldTimer,     InHoldTime_U__HoldTimer,
+        ESuppressTimer, InHoldTime_U__SuppressTimer
+};
+
+
+/*!
+ *  :InHoldTime_D state end its elements
+ *  Here drag, touch timer and suppress timer events are invalid
+ */
+
+const STATE_ELEMENT InHoldTime_D__Down[5] = {
+        0,                    ACT(ClearSuppressTimer),    Eignore,
+        0,                    ACT(ConsumeEvent),      Eignore,
+        CND(InsideHoldArea),  0,                      EInHoldTime_U,
+        0,                    ACT(ClearHoldTimer),    Eignore,
+        0,                    ACT(ProduceMove),       EDispatch
+} ;
+
+/**
+ * Note that ConsumeEvent is missing so after doing this the state engine will do InHoldTime_U
+ */
+const STATE_ELEMENT InHoldTime_D__CapacitiveUp[1] = {
+        0,                  0,    EInHoldTime_U
+} ;
+/**
+ * Note that ConsumeEvent is missing so after doing this the state engine will do InHoldTime_U
+ */
+const STATE_ELEMENT InHoldTime_D__ResistiveUp[1] = {
+        0,                  0,    EInHoldTime_U     // InHoldTime_U initialises timers etc. if needed
+} ;
+/*!
+ * In case of hold timer has been elapsed stop the timers, generate Release UI event.
+ */
+const STATE_ELEMENT InHoldTime_D__HoldTimer[4] = {
+        0,                   ACT(ConsumeEvent),       Eignore,
+        0,                   ACT(ClearSuppressTimer), Eignore,
+        0,                   ACT(ClearHoldTimer),     Eignore,
+        0,                   ACT(ProduceRelease),     EInit,
+} ;
+/*!
+ * If suppress timer hits, stop the timers and generate Release UI event.
+ */
+const STATE_ELEMENT InHoldTime_D__SuppressTimer[4] = {
+        0,                   ACT(ConsumeEvent),       Eignore,
+        0,                   ACT(ClearSuppressTimer), Eignore,
+        0,                   ACT(ClearHoldTimer),     Eignore,
+        0,                   ACT(ProduceRelease),     EInit,
+} ;
+
+/**
+ * All the rest of the events are errors so produce error entry to log and
+ * stay in the InHoldTime_D state
+ */
+const STATE_ELEMENT InHoldTime_DErrorEvent[2] = {
+        0,              ACT(ConsumeEvent),    Eignore,  // remember to consume event, otherwise state machine will loop...
+        0,              ACT(ErrorEvent),      EInHoldTime_D
+};
+
+const STATE InHoldTime_D__[7] = {
+        EDown,          InHoldTime_D__Down,
+        EDrag,          InHoldTime_DErrorEvent,
+        ECapacitiveUP,  InHoldTime_D__CapacitiveUp,
+        EResistiveUP,   InHoldTime_D__ResistiveUp,
+        ETouchTimer,    InHoldTime_DErrorEvent,
+        EHoldTimer,     InHoldTime_D__HoldTimer,
+        ESuppressTimer, InHoldTime_D__SuppressTimer
+};
+
+
+/*!
+ *  :InTouchArea state end its elements
+ *  Here Drag and Up events are valid.
+ *  If drag is inside touch are it is ignored, otherwise
+ *  the Dispatch state will handle the event.
+ */
+
+const STATE_ELEMENT InTouchArea__Drag[3] = {
+        0,                  ACT(StoreMovePos),    Eignore,
+        CND(InsideTouchArea), ACT(ConsumeEvent),     EInTouchArea,
+        0,                    0,                     EDispatch  // Note that in this case ConsumeEvent has not been called so Dispatch state processes the message
+} ;
+
+/**
+ * Note that ConsumeEvent is missing so after doing this the state engine will do Dispatch
+ */
+const STATE_ELEMENT InTouchArea__CapacitiveUp[1] = {
+        0,                  0,    EDispatch
+} ;
+/**
+ * Note that ConsumeEvent is missing so after doing this the state engine will do Dispatch
+ */
+const STATE_ELEMENT InTouchArea__ResistiveUp[1] = {
+        0,                  0,    EDispatch
+} ;
+
+/**
+ * All the rest of the events are errors so produce error entry to log and
+ * stay in the InTouchArea state
+ */
+const STATE_ELEMENT InTouchAreaErrorEvent[2] = {
+        0,              ACT(ConsumeEvent),    Eignore,  // remember to consume event, otherwise state machine will loop...
+        0,              ACT(ErrorEvent),      EInTouchArea
+};
+
+const STATE InTouchArea__[7] = {
+        EDown,          InTouchAreaErrorEvent,
+        EDrag,          InTouchArea__Drag,
+        ECapacitiveUP,  InTouchArea__CapacitiveUp,
+        EResistiveUP,   InTouchArea__ResistiveUp,
+        ETouchTimer,    InTouchAreaErrorEvent,
+        EHoldTimer,     InTouchAreaErrorEvent,
+        ESuppressTimer, InTouchAreaErrorEvent
+};
+
+
+/*!
+ *  :Suppress_D state end its elements
+ *  Here Down and suppress timers are OK.
+ */
+
+/*!
+ * Down will be handled as a Drag event in the Dispatch state.
+ */
+const STATE_ELEMENT Suppress_D__Down[4] = {
+        0,           ACT(ClearSuppressTimer),    Eignore,
+        0,           ACT(RenameToDrag),          EDispatch
+} ;
+/*!
+ * Suppress timer will generate Release UI event.
+ */
+const STATE_ELEMENT Suppress_D__SuppressTimer[3] = {
+        0,                   ACT(ConsumeEvent),       Eignore,
+        0,                   ACT(ClearSuppressTimer), Eignore,
+        0,                   ACT(ProduceRelease),     EInit,
+} ;
+
+/**
+ * All the rest of the events are errors so produce error entry to log and
+ * stay in the Suppress_D state
+ */
+const STATE_ELEMENT Suppress_DErrorEvent[2] = {
+        0,              ACT(ConsumeEvent),    Eignore,  // remember to consume event, otherwise state machine will loop...
+        0,              ACT(ErrorEvent),      ESuppress_D
+};
+
+const STATE Suppress_D__[7] = {
+        EDown,          Suppress_D__Down,
+        EDrag,          Suppress_DErrorEvent,
+        ECapacitiveUP,  Suppress_DErrorEvent,
+        EResistiveUP,   Suppress_DErrorEvent,
+        ETouchTimer,    Suppress_DErrorEvent,
+        EHoldTimer,     Suppress_DErrorEvent,
+        ESuppressTimer, Suppress_D__SuppressTimer
+};
+/*!
+ * The allStates array contains all the possible states of the state machine.
+ */
+const STATE* const allStates[8] =
+{
+        Ignore__,
+        Init__,
+        Dispatch__,
+        InTouchTime__,
+        InHoldTime_U__,
+        InHoldTime_D__,
+        InTouchArea__,
+        Suppress_D__
+};
+/*!
+ * stateNames are used in the logging
+ */
+const char* const stateNames[8] =
+{
+        "Ignore",
+        "Init",
+        "Dispatch",
+        "InTouchTime",
+        "InHoldTime_U",
+        "InHoldTime_D",
+        "InTouchArea",
+        "Suppress"
+};
+
+// event names are also used in logging
+const char* const hweventNames[] = {
+        "EDown",
+        "EDrag",
+        "ECapacitiveUP",
+        "EResistiveUP",
+        "ETouchTimer",
+        "EHoldTimer",
+        "ESuppressTimer"
+} ;
+
+/*! CStateEngine contains the methods used in the state machine implementation.
+ *
+ *  The methods in CStateEngine used in the state machine definition are
+ *  either condition methods or action methods.
+ *
+ *  Constructor
+ *  \param[in]: MTimerInterface atimerif.  An attempt to make this more OS agnostic the actual
+ *  timers are accessed using a separate interface.
+ */
+CStateEngine::CStateEngine(CStateEngineConfiguration* aConfig, MTimerInterface* atimerif, int aIndex)
+{
+    m_config = aConfig ;
+    m_timerif = atimerif ;
+    m_currentState = EInit ;
+    m_index = aIndex ;
+}
+
+CStateEngine::~CStateEngine()
+{
+    // Just to be sure...
+    iTouchPoints.Reset() ;
+    iDragPoints.ResetAndDestroy() ;
+}
+/*!
+ * ConsumeEvent: the method defines that the turnStateMachine will stop the processing
+ * of the state methods after it has reached the next state.
+ *
+ */
+void CStateEngine::ConsumeEvent()
+{
+    m_eventConsumed = true ;
+}
+/*!
+ * Condition method
+ * \return true, if the touch timer limit > 0
+ */
+bool CStateEngine::IsTouchTimer()
+{
+    bool isit =  (m_config->m_touchTimerLimit > 0) ;
+
+    return isit ;
+}
+/*!
+ * Condition method
+ * \return true, if the hold timer limit > 0
+ */
+bool CStateEngine::IsHoldTimer()
+{
+    bool isit =  (m_config->m_holdTimerLimit > 0) ;
+
+    return isit ;
+}
+/*!
+ * Condition method
+ * \return true, if the suppress timer limit > 0
+ */
+bool CStateEngine::IsSuppressTimer()
+{
+    bool isit =  (m_config->m_suppressTimerLimit > 0) ;
+
+    return isit ;
+}
+/*!
+ * Condition method
+ * \return true, if the touch area has been defined (the touch tolerancelength > 0)
+ */
+bool CStateEngine::IsTouchTimeArea()
+{
+    bool isit = (m_config->m_touchTimeTolerance.iX > 0) ;
+    return isit  ;
+}
+/*!
+ * Condition method
+ * \return true, if the touch area has been defined (the touch tolerancelength > 0)
+ */
+bool CStateEngine::IsTouchArea()
+{
+    bool isit = (m_config->m_touchTolerance.iX > 0) ;
+    return isit  ;
+}
+/*!
+ * Condition method
+ * \return true, if the hold area has been defined (the hold tolerancelength > 0)
+ */
+bool CStateEngine::IsHoldArea()
+{
+    bool isit = (m_config->m_holdTolerance.iX > 0) ;
+    return isit  ;
+}
+
+bool CStateEngine::InsideArea(const TPoint& point,
+                              const TRect& rect,
+                              TAreaShape shape,
+                              const TPoint& tolerance)
+{
+    bool isit;
+    switch(shape)
+    {
+    default:    // pass trough
+    case ERectangle:
+    {
+        isit = rect.Contains(m_hwe.iPosition) ;
+        break ;
+    }
+    case ECircle:
+    {
+        TPoint delta = m_hwe.iPosition - point;
+        long circlepoint = delta.iX * delta.iX + delta.iY * delta.iY;
+        isit = (circlepoint < tolerance.iX * tolerance.iX);
+        break ;
+    }
+    case EEllipse:
+    {
+        int asquare = tolerance.iX * tolerance.iX ;
+        int bsquare = tolerance.iY * tolerance.iY ;
+        TPoint delta = m_hwe.iPosition - point;
+        int result = (delta.iX * delta.iX) * bsquare + (delta.iY * delta.iY) * asquare;
+
+        isit = (result < asquare * bsquare);
+        break ;
+    }
+    }
+    return isit ;
+}
+
+/*!
+ * Condition method
+ * Check if the current event is positioned inside the touch area.
+ * Touch area can be a rectangle, a circle or an ellipse, so different
+ * calculation needs to be done based on the shape of the area.
+ */
+bool CStateEngine::InsideTouchTimeArea()
+{
+    return InsideArea(m_touchCentre, m_touchRect,
+                      m_config->m_touchAreaShape, m_config->m_touchTimeTolerance);
+}
+/*!
+ * Condition method
+ * Check if the current event is positioned inside the touch area.
+ * Touch area can be a rectangle, a circle or an ellipse, so different
+ * calculation needs to be done based on the shape of the area.
+ */
+bool CStateEngine::InsideTouchArea()
+{
+    return InsideArea(m_touchCentre, m_touchRect,
+                      m_config->m_touchAreaShape, m_config->m_touchTolerance);
+}
+/*!
+ * Condition method
+ * Check if the current event is positioned inside the hold area.
+ * Hold area can be a rectangle, a circle or an ellipse, so different
+ * calculation needs to be done based on the shape of the area.
+ */
+bool CStateEngine::InsideHoldArea()
+{
+    return InsideArea(m_holdCentre, m_holdRect,
+                      m_config->m_holdAreaShape, m_config->m_holdTolerance);
+}
+/*!
+ * Condition method
+ * Check if the gesture looks like a hold, i.e. the movement has stopped.
+ * \sa isNewHoldingPoint
+ */
+bool CStateEngine::LooksLikeHold()
+{
+    bool isit = isNewHoldingPoint() ;
+    return isit ;
+}
+/*!
+ * Action method
+ * Error logging.
+ */
+void CStateEngine::ErrorEvent()
+{
+    // Log the error
+    if (m_config->m_enableLogging)
+    {
+        LOGARG("ErrorEvent: %s %s", stateNames[m_currentState], hweventNames[m_hwe.iType]) ;
+    }
+}
+/*!
+ * Action method
+ * Initialize touch timer.  At the same time calculate also the touch rectangle.
+ */
+void CStateEngine::InitTouchTimer()
+{
+    m_touchRect = ToleranceRect(m_hwe.iPosition, m_config->m_touchTolerance) ;
+    m_touchCentre = m_hwe.iPosition ;
+    m_timerif->startTouchTimer(m_config->m_touchTimerLimit, m_index) ;
+}
+/*!
+ * Action method.
+ * Initialize hold timer.  At the same time calculate also the hold rectangle.
+ */
+void CStateEngine::InitHoldTimer()
+{
+    m_holdRect = ToleranceRect(m_hwe.iPosition, m_config->m_holdTolerance) ;
+    m_holdCentre = m_hwe.iPosition ;
+    m_timerif->startHoldTimer(m_config->m_holdTimerLimit, m_index) ;
+}
+/*!
+ * Action method
+ * Restart the hold timer using the hold timer limit.
+ */
+void CStateEngine::RestartHoldTimer()
+{
+    m_timerif->startHoldTimer(m_config->m_holdTimerLimit, m_index) ;
+}
+/*!
+ * Action method
+ * Initialize suppression timer.  This timer is used during touch detection when
+ * resistive UP has been detected.  If new DOWN comes while timer is running, it is ignored.
+ */
+void CStateEngine::InitTouchSuppressTimer()
+{
+    m_timerif->startSuppressTimer(m_config->m_suppressTimerLimit, m_index) ;
+}
+/*!
+ * Action method.
+ * Initialize suppression timer after move.  Tests show that when user is using light touch and
+ * moving finger to opposite directions there may be accidental ups and downs where the time between
+ * up and down may be well over 120 ms.
+ */
+void CStateEngine::InitMoveSuppressTimer()
+{
+    m_timerif->startSuppressTimer(m_config->m_moveSuppressTimerLimit, m_index) ;
+}
+/*!
+ * Action method
+ * Stop the touch timer.
+ */
+void CStateEngine::ClearTouchTimer()
+{
+    m_timerif->cancelTouchTimer(m_index) ;
+}
+/*!
+ * Action method
+ * Stop the hold timer.
+ */
+void CStateEngine::ClearHoldTimer()
+{
+    m_timerif->cancelHoldTimer(m_index) ;
+}
+/*!
+ * Action method
+ * Stop the suppress timer.
+ */
+void CStateEngine::ClearSuppressTimer()
+{
+    m_timerif->cancelSuppressTimer(m_index) ;
+}
+/*!Helper method.
+ * Create UI event
+ * \param code The new UI event type (Touch, Release, Move, Hold)
+ */
+CUiEvent* CStateEngine::createUIEventL(TUiEventCode code, const TPoint& aPos)
+{
+
+    m_previousUiGenerated = code ;
+    return CUiEvent::NewL(code, m_gestureStartXY, aPos, getPreviousXY(aPos),
+        isTimerMessage(), m_hwe.iTarget, getInterval(), m_index, m_hwe.iTime.Int64()) ;
+}
+/*!
+ * Return the previous XY position and store the current for next round
+ */
+TPoint CStateEngine::getPreviousXY(const TPoint& aCurrentXY)
+{
+    TPoint p = m_previousXY ;
+    m_previousXY = aCurrentXY ;
+    return p ;
+}
+/*!
+ * \return true, if the current event was timer triggered
+ */
+bool CStateEngine::isTimerMessage()
+{
+    return (m_hwe.iType >= ETouchTimer); // NOTE: if new events are added at the end of the list this needs to be changed
+}
+/*!
+ * Action method.
+ * Generate the Touch UI event.
+ * If there are a set of touch points collected, calculate the position to the
+ * Touch UI event to be the average of the collected points.
+ */
+void CStateEngine::ProduceTouch()
+{
+    m_wasFiltered = false ;
+    CUiEvent* cue = NULL;
+    getInterval() ; // dummy call to initialize the variable....
+    TInt err(KErrNone);
+    if (iTouchPoints.Count()>0)
+    {
+        // calculate average of the touch points
+        m_currentTouchXY = calculateTouchAverageFromPoints() ;
+        TRAP(err, cue = createUIEventL(stmUiEventEngine::ETouch, m_currentTouchXY)) ;
+    }
+    else
+    {
+        TRAP(err, cue = createUIEventL(stmUiEventEngine::ETouch, m_uiEventXY)) ;
+    }
+    if(!err)
+        m_config->m_uiEventSender->AddEvent(cue) ;
+}
+/*!
+ * Action method
+ * Generate the Move UI event.  The position of the event has been set in the SetCurrentPos
+ * The previous position needs some special handling, if filtering has been used.
+ * \sa SetCurrentPos
+ */
+void CStateEngine::ProduceMove()
+{
+    m_wasFiltered = false ;
+    if (m_uiEventXY == m_previousXY) {
+    return;
+    }
+    CUiEvent* cue = NULL;
+    TRAPD(err, cue = createUIEventL(stmUiEventEngine::EMove, m_uiEventXY)) ;
+
+    if(!err)
+    	m_config->m_uiEventSender->AddEvent(cue) ;
+}
+/*!
+ * Action method
+ * Generate the Release UI event.
+ */
+void CStateEngine::ProduceRelease()
+{
+    m_wasFiltered = false ;
+    CUiEvent* cue = NULL;
+    TRAPD(err, cue = createUIEventL(stmUiEventEngine::ERelease, m_uiEventXY)) ;
+    if(!err)
+    	m_config->m_uiEventSender->AddEvent(cue) ;
+
+    if (m_config->m_enableLogging)
+    {
+        LOGFLUSH ;
+    }
+}
+/*!
+ * Action method
+ * Generate the Hold UI event.
+ */
+void CStateEngine::ProduceHold()
+{
+    m_wasFiltered = false ;
+    CUiEvent* cue = NULL;
+    TRAPD(err, cue = createUIEventL(stmUiEventEngine::EHold, m_holdCentre)) ;
+    if(!err)
+ 	   m_config->m_uiEventSender->AddEvent(cue) ;
+
+}
+/*!
+ * Action method
+ * Rename the current event to drag.  This is used when the accidental up/down message pair
+ * has been detected, the DOWN event is handled as it were a move event.
+ */
+void CStateEngine::RenameToDrag()
+{
+    m_hwe.iType = stmUiEventEngine::EDrag ;
+}
+/*!
+ * Action method
+ * Initialize the touch time area.  Clear the array for collected touch points and
+ * calculate the touch rectangle.
+ */
+void CStateEngine::PrepareTouchTimeArea()
+{
+    if (iTouchPoints.Count()>0) iTouchPoints.Reset() ;
+    m_touchRect = ToleranceRect(m_hwe.iPosition, m_config->m_touchTimeTolerance) ;
+}
+
+/*!
+ * Action method
+ * Initialize the touch area.  Clear the array for collected touch points and
+ * calculate the touch rectangle.
+ */
+void CStateEngine::PrepareTouchArea()
+{
+    if (iTouchPoints.Count()>0) iTouchPoints.Reset() ;
+    m_touchRect = ToleranceRect(m_hwe.iPosition, m_config->m_touchTolerance) ;
+}
+/*!
+ * Action method
+ * Initialize the hold area rectangle.
+ */
+void CStateEngine::PrepareHoldArea()
+{
+    m_holdRect = ToleranceRect(m_hwe.iPosition, m_config->m_holdTolerance) ;
+}
+/*!
+ * Action method
+ * Store the current position and time always when we see EDrag.  The stored value is used
+ * to calculate correct speed after filtered messages.
+ */
+void CStateEngine::StoreMovePos()
+{
+    if (m_config->m_enableLogging)
+    {
+        LOGARG("store move pos from (%d, %d) to (%d, %d)",
+                m_lastFilteredPosition.iX, m_lastFilteredPosition.iY,m_hwe.iPosition.iX,
+                m_hwe.iPosition.iY  ) ;
+    }
+    m_lastFilteredPosition = m_hwe.iPosition ;
+    m_lastFilteredMessageTime = m_hwe.iTime ;
+
+}
+/*!
+ * Action method
+ * Store the current position and time.
+ */
+void CStateEngine::SetCurrentPos()
+{
+    m_uiEventXY = m_hwe.iPosition ;
+}
+/*!
+ * Action method
+ * Initialize the gesture starting.
+ */
+void CStateEngine::SetGestureStart()
+{
+    m_gestureStartXY = m_hwe.iPosition ;
+    m_previousXY = m_hwe.iPosition ;
+    m_gestureTarget = m_hwe.iTarget ;
+    iDragPoints.ResetAndDestroy() ;
+    iTouchPoints.Reset() ;
+}
+/*!
+ * Action method
+ * Add current point to the set of touch points.
+ */
+void CStateEngine::AddToTouch()
+{
+    iTouchPoints.Append(THwEvent(m_hwe.iType,
+                                 m_hwe.iPosition,
+                                 m_hwe.iTime,
+                                 m_hwe.iTarget,
+                                 m_index)
+                        ) ;
+    // calculate the average of touch points and move the touch area accordingly
+    // this allows slight movement of the figertip while inside touch time
+    if (iTouchPoints.Count()>2)
+    {
+        TPoint newtp = calculateTouchAverageFromPoints() ;
+        m_touchRect = ToleranceRect(newtp, m_config->m_touchTolerance) ;
+        m_holdRect = ToleranceRect(newtp, m_config->m_holdTolerance) ;
+    }
+}
+/*!
+ * Action method
+ * Add the current point to the set of dragging points.
+ * The set of dragging points is examined to determine if a enw hold has been started.
+ */
+void CStateEngine::AddDraggingPos()
+{
+    iDragPoints.Append(new THwEvent(m_hwe.iType,
+                                    m_hwe.iPosition,
+                                    m_hwe.iTime,
+                                    m_hwe.iTarget,
+                                    m_index)
+                       ) ;
+}
+/*!
+ * HandleStateEvent processes one event, which can be either pointer event or timer event.
+ * The event is handled by calling the turnStateMachine method.
+ */
+bool CStateEngine::handleStateEvent()
+{
+    // We get an event into m_hwe by this moment, lets kick the state machine
+    m_wasFiltered = ETrue ;
+
+    CalculateDelta() ;
+    turnStateMachine() ;
+
+    m_previousPointerEventPosition = m_hwe.iPosition ;
+    return m_wasFiltered ;
+}
+
+/*!
+ *  Get the current touch rectangle.  If touch state not currently on, returns TRect(TPoint(0,0),TPoint(0,0))
+ * (touch state meaning that the touch timer is still running and the points have been kept inside the area)
+ */
+TRect CStateEngine::getTouchArea()
+{
+    return m_touchRect ;
+}
+/*!
+ * get the hold area rectangle
+ */
+TRect CStateEngine::getHoldArea()
+{
+    return m_holdRect ;
+}
+/*!
+ * MStateMachine method.
+ */
+bool CStateEngine::wasLastMessageFiltered()
+{
+    return m_wasFiltered ;
+}
+
+/*!
+ * Check if the last X points in the stored points look like the movement has stopped
+ */
+bool CStateEngine::isNewHoldingPoint()
+{
+    int x = iDragPoints.Count();
+    if (x > 2)    // are there any points to be checked?
+    {
+        THwEvent* phwe = iDragPoints[x-1] ;
+        THwEvent* phweinsidehold = phwe ;
+        TRect recth = ToleranceRect(phwe->iPosition, m_config->m_holdTolerance) ;
+        // Look backwards from the last point to see if there are enought points (enough in time) to look like a hold
+        x -= 2 ;
+        while (x > 0 && recth.Contains(iDragPoints[x]->iPosition))
+        {
+            phweinsidehold = iDragPoints[x];
+            --x;
+        }
+        TTimeIntervalMicroSeconds tival = phwe->iTime.MicroSecondsFrom(phweinsidehold->iTime) ;
+
+        /**
+         * remove the extra points from the list if they are outside of holding area
+         */
+        while (x > 0)
+        {
+            THwEvent* p = iDragPoints[x] ;
+            delete p ;
+            iDragPoints.Remove(x) ;
+            --x ;
+        }
+
+        // See the time difference of the two points which still are inside the hold area
+        TTimeIntervalMicroSeconds limit = m_config->m_holdTimerLimit/2 ;
+        if (tival > limit)
+        {
+            if (m_config->m_enableLogging)
+            {
+                LOGARG("isNewHoldingPoint: %s, dragpoints count %d",
+                        stateNames[m_currentState], iDragPoints.Count()) ;
+            }
+            return true ;
+        }
+    }
+    else
+    {
+        // one or 0 points does not look like hold
+
+    }
+    return false ;
+}
+/*!
+ * calculate simple average of the touch points, i.e. calculate the average of the previous and current
+ * position.  Note that the touch point remains the same, this just calculates new value for the UI position
+ */
+void CStateEngine::CalculateTouchAverage()
+{
+    m_uiEventXY.iX =  (m_uiEventXY.iX+m_hwe.iPosition.iX)/2 ;
+    m_uiEventXY.iY =  (m_uiEventXY.iY+m_hwe.iPosition.iY)/2 ;
+}
+/*!
+ * Calculate the movement vector.
+ */
+void CStateEngine::CalculateDelta()
+{
+    m_deltaVector.iX = m_hwe.iPosition.iX-m_previousPointerEventPosition.iX ;
+    m_deltaVector.iY = m_hwe.iPosition.iY-m_previousPointerEventPosition.iY ;
+}
+/*!internal
+ * Debug logging method
+ */
+void CStateEngine::DebugPrintState(TStateMachineState anextstate)
+{
+    if (m_config->m_enableLogging)
+    {
+    LOGARG("%s: cuiev(%d,%d) cTxy ((%d,%d)(%d,%d)) cHxy ((%d,%d)(%d,%d)) gsXY(%d,%d) dV(%d,%d) EVNT(%d,%d (%s)) going to %s",
+            stateNames[m_currentState],
+            m_uiEventXY.iX, m_uiEventXY.iY,
+            m_touchRect.iTl.iX, m_touchRect.iTl.iY,m_touchRect.iBr.iX, m_touchRect.iBr.iY,
+            m_holdRect.iTl.iX, m_holdRect.iTl.iY,m_holdRect.iBr.iX, m_holdRect.iBr.iY,
+            m_gestureStartXY.iX, m_gestureStartXY.iY,
+            m_deltaVector.iX, m_deltaVector.iY,
+            m_hwe.iPosition.iX, m_hwe.iPosition.iY, hweventNames[m_hwe.iType],
+            stateNames[anextstate]
+            );
+    }
+}
+
+/*!
+ * calculate the rectangle for touch or hold
+ */
+TRect CStateEngine::ToleranceRect(const TPoint& aCenterPoint, const TPoint& tolerance)
+{
+    // grow by the tolerance length, while keeping the center point
+    TRect toleranceRect(
+        aCenterPoint - tolerance,
+        aCenterPoint + tolerance);
+    return toleranceRect;
+}
+/*!
+ * turnStateMachine.  Go trough the state elements found for the current event
+ * until the event has been consumed.
+ *
+ * \pre m_currentState defines the current state and the index to the allStates array.
+ * \pre m_hwe is the message being handled.  The corresponding STATE_ELEMENT array must be found and processed.
+ *
+ */
+void CStateEngine::turnStateMachine()
+{
+
+    const STATE_ELEMENT* pelement ;
+    m_eventConsumed = false ;   // run the loop until the event has been consumed
+    // Now run trough the motions of the state elements, and prepare to change to next state while doing so.
+    // If the state elements set the m_eventConsumed then all is done
+    while (!m_eventConsumed)
+    {
+        int i = 0 ;
+        const STATE* const pcurrentstate = allStates[m_currentState] ;
+        // Since each state definition must contain entries for all possible events the following loop cannot fail ;-)
+        while (pcurrentstate[i].theEvent != m_hwe.iType ) ++i ;
+        pelement = pcurrentstate[i].stateElements ;
+        TStateMachineState      nextState = Eignore ;
+        /*
+         * Handle the individual state elements.  If there is a condition function,
+         * call the function and if it returns true, handle the action function and possible next state
+         * if the condition returns false, continue to next element
+         * if there is no condition, run the action function if it exists.
+         * if the next state is defined (i.e it is != Eignore), go to that state
+         */
+        while (nextState == Eignore)
+        {
+            condition_t cndfunc = pelement->conditionFunction ;
+            action_t    actfunc = pelement->actionFunction ;
+            if (cndfunc != 0)
+            {
+                /*
+                 * There was a condition function, call it to see whether the action needs to performed and/or the next satte defined
+                 */
+                if (cndfunc(this))
+                {
+                    // Condition was true, handle it
+                    // call the action if it exists
+                    if (actfunc != 0) actfunc(this) ;
+                    // and now get to the next state
+                    nextState   = pelement->nextState ; // Note that while this remains Eignore there are elements to be run
+                }
+            }
+            else
+            {
+                /**
+                 * No condition function, call the possible action function and get the next state
+                 */
+                if (actfunc != 0) actfunc(this) ;
+                nextState   = pelement->nextState ;     // Note that while this remains Eignore there are elements to be run
+            }
+            ++pelement ;    // next entry in the elements
+        }
+        if (m_config->m_enableLogging) DebugPrintState(nextState) ;
+        m_currentState = nextState ;    // Change to the next state
+    }
+}
+TTimeIntervalMicroSeconds CStateEngine::getInterval()
+{
+    TTime now ;
+    now.HomeTime() ;
+    TTimeIntervalMicroSeconds interval = now.MicroSecondsFrom(m_lastMessageTime) ;
+    m_lastMessageTime = now ;
+    return interval ;
+}
+
+TPoint CStateEngine::calculateTouchAverageFromPoints()
+{
+    TPoint tp ;
+    int count = iTouchPoints.Count() ;
+    for (int i = 0; i < count; i++)
+    {
+        tp += iTouchPoints[i].iPosition;
+    }
+    if(count)
+        {
+        tp.iX /= count ;
+        tp.iY /= count ;
+        }
+    return tp ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/stateengineconfiguration.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#include "stateengineconfiguration.h"
+#include "uieventsender.h"
+#include "utils.h"
+
+using namespace stmUiEventEngine ;
+
+CStateEngineConfiguration::CStateEngineConfiguration() :
+	m_touchAreaShape(ERectangle),
+	m_holdAreaShape(ERectangle)
+{
+}
+
+void CStateEngineConfiguration::ConstructL()
+{
+    m_uiEventSender = CUiEventSender::NewL() ;
+}
+
+CStateEngineConfiguration::~CStateEngineConfiguration()
+{
+    delete m_uiEventSender ;
+}
+
+void CStateEngineConfiguration::setTolerance(long fingersize_mm, 
+                                             TPoint& tolerance, 
+                                             TAreaShape shape)
+{
+    long s = Mm2Pixels(fingersize_mm) / 2;
+    switch(shape)
+    {
+    case EEllipse:
+        tolerance.iX = (s * 2) / 3;
+        tolerance.iY = s;
+        break ;
+    case ERectangle:
+    case ECircle:
+    default:
+        tolerance.iX = s;
+        tolerance.iY = s;
+        break ;
+    }
+}
+
+/*!
+ * Set the new touch limits for calculating the touch area.
+ * The size is given in millimetres.  The shape of the touch area
+ * defines how the parameter is used.
+ * Rectangle: each side of the rectangle has length of fingersize_mm.
+ * Circle:    the parameter defines the diameter of the cicle.
+ * Ellipse:   the parameter defines the vertical diameter of the ellipse,
+ *            horizontal diameter is half of it.
+ */
+void CStateEngineConfiguration::setTouchTimeArea(long fingersize_mm)
+{
+    setTolerance(fingersize_mm, m_touchTimeTolerance, m_touchAreaShape);
+
+    // make sure that both touch areas are defined, so if the touch area is not yet set,
+    // use the same as for touch time area.
+    if (m_touchTolerance.iX == 0)
+    {
+        setTouchArea(fingersize_mm) ;
+    }
+}
+/*!
+ * Set the new touch limits for calculating the touch area.
+ * The size is given in millimetres.  The shape of the touch area
+ * defines how the parameter is used.
+ * Rectangle: each side of the rectangle has length of fingersize_mm.
+ * Circle:    the parameter defines the diameter of the cicle.
+ * Ellipse:   the parameter defines the vertical diameter of the ellipse,
+ *            horizontal diameter is half of it.
+ */
+void CStateEngineConfiguration::setTouchArea(long fingersize_mm)
+{
+    setTolerance(fingersize_mm, m_touchTolerance, m_touchAreaShape);
+}
+/*!
+ * \return the touch are shape
+ */
+TAreaShape CStateEngineConfiguration::getTouchAreaShape()
+{
+     return m_touchAreaShape ;
+}
+/*!
+ * \parameter the touch are shape
+ */
+void CStateEngineConfiguration::setTouchAreaShape(TAreaShape aShape)
+{
+    this->m_touchAreaShape = aShape ;
+}
+/*!
+ * \return the touch timeout in microseconds.
+ */
+unsigned int CStateEngineConfiguration::getTouchTimeout()
+{
+    return m_touchTimerLimit ;
+}
+/*!
+ * set the touch timeout in microseconds.
+ */
+void CStateEngineConfiguration::setTouchTimeout(unsigned int a)
+{
+    m_touchTimerLimit = a ;
+}
+/*!
+ * Set the hold area.  Hold are shape determines how exactly the area is handled.
+ * \sa setTouchArea
+ */
+void CStateEngineConfiguration::setHoldArea(long fingersize_mm)
+{
+    setTolerance(fingersize_mm, m_holdTolerance, m_holdAreaShape);
+}
+/*!
+ * Get the shape of the hold area: Rectangle, Circle or Ellipse,
+ */
+TAreaShape CStateEngineConfiguration::getHoldAreaShape()
+{
+     return m_holdAreaShape ;
+}
+/*!
+ * Set the shape of the hold area: Rectangle, Circle or Ellipse,
+ */
+void CStateEngineConfiguration::setHoldAreaShape(TAreaShape aShape)
+{
+    m_holdAreaShape = aShape ;
+}
+/*!
+ * \return the hold timeout in microseconds.
+ */
+unsigned int CStateEngineConfiguration::getHoldTimeout()
+{
+    return m_holdTimerLimit ;
+}
+/*!
+ * set the hold timeout value in microseconds.
+ */
+void CStateEngineConfiguration::setHoldTimeout(unsigned int a)
+{
+    m_holdTimerLimit = a ;
+}
+/*!
+ * get the touch suppress timeout value in microseconds.
+ */
+unsigned int CStateEngineConfiguration::getTouchSuppressTimeout()
+{
+    return m_suppressTimerLimit ;
+}
+/*!
+ * set the touch suppress timeout.
+ * \param the timeout value in microseconds.
+ */
+void CStateEngineConfiguration::setTouchSuppressTimeout(unsigned int a)
+{
+    m_suppressTimerLimit = a ;
+}
+/*!
+ * MStateMachine method.
+ */
+unsigned int CStateEngineConfiguration::getMoveSuppressTimeout()
+{
+    return m_moveSuppressTimerLimit ;
+}
+/*!
+ * MStateMachine method.
+ */
+void CStateEngineConfiguration::setMoveSuppressTimeout(unsigned int a)
+{
+    m_moveSuppressTimerLimit = a ;
+}
+/*!
+ * MStateMachine method.
+ * Sets logging on or off.
+ */
+void CStateEngineConfiguration::enableLogging(bool a)
+{
+    m_enableLogging = a ;
+    m_uiEventSender->setLogging(a) ;
+}
+
+/*!
+ * \param a new UI event observer
+ */
+bool CStateEngineConfiguration::addUiEventObserver(MUiEventObserver* observer)
+{
+    // The event sender handles the observers
+    return m_uiEventSender->addObserver(observer) ;
+}
+/*!
+ * MStateMachine method.
+ */
+bool CStateEngineConfiguration::removeUiEventObserver(MUiEventObserver* observer)
+{
+    // The event sender handles the observers
+    return m_uiEventSender->removeObserver(observer) ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/statemachine.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,789 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#include <coemain.h>
+#include <aknutils.h>
+#include <aknappui.h>
+
+#include "statemachine.h"
+#include "stateengine.h"
+#include "rt_uievent.h"
+#include "callbacktimer.h"
+#include "stateengineconfiguration.h"
+
+#include "filelogger.h"
+#include "utils.h"
+
+using namespace stmUiEventEngine ;
+
+GLREF_D const char* stateNames[8] ;
+
+const char* const ttypeNames[] = {  // for debugging purposes define the names of the pointer events
+            "EButton1Down         ",
+            "EButton1Up           ",
+            "EButton2Down         ",
+            "EButton2Up           ",
+            "EButton3Down         ",
+            "EButton3Up           ",
+            "EDrag                ",
+            "EMove                ",
+            "EButtonRepeat        ",
+            "ESwitchOn            ",
+            "EOutOfRange          ",
+            "EEnterCloseProximity ",
+            "EExitCloseProximity  ",
+            "EEnterHighPressure   ",
+            "EExitHighPressure    "
+            };
+
+/// Fast integer distance
+int stmUiEventEngine::Distance(int x, int y)
+{
+/*
+    double d = dx * dx + dy * dy;
+    double dist ;
+    Math::Sqrt(dist, d) ;
+    return dist;
+*/
+    if(x<0) x=-x;
+    if(y<0) y=-y;
+    if(x < y)
+    {
+      int t = x;
+      x = y;
+      y = t;        // ensures that x >= y
+    }
+    int dist = (y < ((13107 * x)>>15)) ?    // * (.4)
+              (x + ((y * 6310)>>15)) :      // * (.192582403)
+              (((x * 27926)>>15)            // * (.852245894)
+                 + ((y * 18414)>>15));      // * (.561967668)
+    return dist;
+}
+
+
+/*!
+  CStateMachine implements the state machine and the integration fo the
+  state machine to the OS.  The CStateEngine handles the actual processing of the
+  finite state machine but CStateMachine provides the OS specific things like timers
+  and message conversion.
+
+  The CStateMachine implements the MAknWsEventObserver interface so it adds
+  itself to be the observer to the event monitor of the application UI.
+
+  It handles the pointer events either by using the monitoring interface or
+  lets the application call the HandlePointerEventL method.
+
+  If MAknWsEventObserver interface is used then all the events passed to the
+  application are seen.  The target of the gesture starting event is stored
+  so that the generated UI event contains the target as a void pointer. (should it just be CoeControl*?)
+
+  There is possibility to adjust the Y coordinate of the touch point.
+  In capacitive touch (Alvin) it seems that the perceived touch point is
+  below the middle part of the fingertip.  The user however tries to use the
+  finger to point so that the touch point should correspond to the tip of the finger.
+  It seems that this illusion can be achieved by adjusting the Y position about 3 mm up.
+  However, this adjustment can properly be done only when the touch point is far enough
+  from the window borders up or down.  When close to top or bottom of window, the adjustment
+  makes it impossible touch points near the edge, unless adjustment depends on the distance from
+  window border.
+  So in practice it should be the window server doing the adjustment, and after adjustment
+  deciding the target window.  At application level the adjustment can only be done properly
+  if window borders do not need to be crossed.
+
+ */
+CStateMachine::CStateMachine()
+{
+    m_WasMessageFiltered = false ;
+    m_wseventmonitoringenabled = false ; // NB: enabled only if really used by application
+    m_loggingenabled = false ;
+    m_capacitiveup = false ;
+    m_adjustYposition = false ;
+}
+/*!Destructor
+ */
+CStateMachine::~CStateMachine()
+{
+    for (int i = 0; i < KMaxNumberOfPointers; i++)
+    {
+        delete m_holdTimer[i] ;
+        delete m_touchTimer[i] ;
+        delete m_suppressTimer[i] ;
+        delete m_impl[i] ;
+    }
+    delete m_config ;
+}
+
+CStateMachine* CStateMachine::NewLC()
+{
+    CStateMachine* self = new (ELeave) CStateMachine();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+CStateMachine* CStateMachine::NewL()
+{
+    CStateMachine* self = CStateMachine::NewLC();
+    CleanupStack::Pop(self); 
+    return self;
+}
+/*!
+ Construct the actual state machine implemented in CStateEngine and
+ creates the timers.  It also adds itself to the observer list of
+ CAknWsEventMonitor of the application.
+
+ */
+void CStateMachine::ConstructL()
+{
+    m_config = new(ELeave)CStateEngineConfiguration() ;
+    m_config->ConstructL();
+
+    for (int i = 0; i < KMaxNumberOfPointers; i++)
+    {
+        m_impl[i] = new(ELeave) CStateEngine(m_config, this, i) ;
+        m_holdTimer[i] = CCallbackTimer::NewL(*this, handleholdTimer, 0, i, ETrue);
+        m_touchTimer[i] = CCallbackTimer::NewL(*this, handletouchTimer, 0, i, ETrue);
+        m_suppressTimer[i] = CCallbackTimer::NewL(*this, handlesuppressTimer, 0, i, ETrue);
+    }
+
+    m_coeEnv = CCoeEnv::Static();
+
+    /* IMEX: monitor added only if enabled
+      add us to see the WsEvents so that we are able to interpret them;
+
+    CAknAppUi* pui = (CAknAppUi*)m_coeEnv->AppUi() ;
+    pui->EventMonitor()->AddObserverL(this) ;
+    pui->EventMonitor()->Enable(ETrue) ;
+    */
+
+    m_3mminpixels = Mm2Pixels(1.5) ;
+}
+/*!
+ * Process one pointer event in the state machine.
+ * \return true, if the event did not generate a UI event immediately.
+ */
+bool CStateMachine::HandleStateEvent(const TPointerEvent& aPointerEvent, 
+                                     void* aTarget, 
+                                     const TTime& aTime)
+{
+    TInt index = PointerIndex(aPointerEvent);
+    CStateEngine* engine = m_impl[index];
+    CreateHwEvent(engine->initEvent(), aPointerEvent, aTarget, aTime) ;
+    if (m_loggingenabled)
+    {
+        LOGARG("HandleStateEvent: ptr %d", index) ;
+    }
+    m_WasMessageFiltered = engine->handleStateEvent() ;
+    return m_WasMessageFiltered ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+bool CStateMachine::wasLastMessageFiltered(TInt aPointerNumber)
+{
+    return m_impl[aPointerNumber]->wasLastMessageFiltered() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+TRect CStateMachine::getTouchArea(TInt aPointerNumber)
+{
+    return m_impl[aPointerNumber]->getTouchArea() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setTouchTimeArea(long fingersize_mm)
+{
+    m_config->setTouchTimeArea(fingersize_mm) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setTouchArea(long fingersize_mm)
+{
+    m_config->setTouchArea(fingersize_mm) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+TAreaShape CStateMachine::getTouchAreaShape()
+{
+    return m_config->getTouchAreaShape() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setTouchAreaShape(const TAreaShape aShape)
+{
+    m_config->setTouchAreaShape(aShape) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+unsigned int CStateMachine::getTouchTimeout()
+{
+    return m_config->getTouchTimeout() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setTouchTimeout(unsigned int aDelay)
+{
+    m_config->setTouchTimeout(aDelay) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+TRect CStateMachine::getHoldArea(TInt aPointerNumber)
+{
+    return m_impl[aPointerNumber]->getHoldArea() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setHoldArea(long fingersize_mm)
+{
+    m_config->setHoldArea(fingersize_mm) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+TAreaShape CStateMachine::getHoldAreaShape()
+{
+    return m_config->getHoldAreaShape() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setHoldAreaShape(const TAreaShape aShape)
+{
+    m_config->setHoldAreaShape(aShape) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+unsigned int CStateMachine::getHoldTimeout()
+{
+    return m_config->getHoldTimeout() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setHoldTimeout(unsigned int a)
+{
+    m_config->setHoldTimeout(a) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+unsigned int CStateMachine::getTouchSuppressTimeout()
+{
+    return m_config->getTouchSuppressTimeout() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setTouchSuppressTimeout(unsigned int a)
+{
+    m_config->setTouchSuppressTimeout(a) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+unsigned int CStateMachine::getMoveSuppressTimeout()
+{
+    return m_config->getMoveSuppressTimeout() ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::setMoveSuppressTimeout(unsigned int a)
+{
+    m_config->setMoveSuppressTimeout(a) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+bool CStateMachine::addUiEventObserver(MUiEventObserver* observer)
+{
+    return m_config->addUiEventObserver(observer) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+bool CStateMachine::removeUiEventObserver(MUiEventObserver* observer)
+{
+    return m_config->removeUiEventObserver(observer) ;
+}
+/*!
+ * wrapper method for the actual implementation in the CStateEngine.
+ */
+void CStateMachine::enableLogging(bool aEnable)
+{
+    m_loggingenabled = aEnable ;
+    m_config->enableLogging(aEnable) ;
+}
+
+TInt CStateMachine::PointerIndex(const TPointerEvent& aPointerEvent)
+{
+    TInt index = 0;
+#if defined(ADVANCED_POINTER_EVENTS)
+    if (aPointerEvent.IsAdvancedPointerEvent())
+    {
+        const TAdvancedPointerEvent* tadvp = aPointerEvent.AdvancedPointerEvent() ;
+        index = tadvp->PointerNumber() ;
+    }
+#endif
+    return index;
+}
+
+/*!
+ * Convert pointer event (TPointerEvent) into THwEvent into the variable m_hwe.
+ * THwEvent contains the position and simplified event type
+ * but also has the target window and timestamp included.
+ */
+void CStateMachine::CreateHwEvent(THwEvent& aEvent, 
+                                  const TPointerEvent& aPointerEvent, 
+                                  void* aTarget, 
+                                  const TTime& aTime)
+{
+/*  should be set by this moment by CStateEngine with that index in CStateEngine::initEvent()
+    aEvent.iPointerNumber = PointerIndex(aPointerEvent);
+*/
+    aEvent.iTarget = aTarget ;
+    aEvent.iTime = aTime;
+    // Change to screen coordinates here while the window is still existing....
+    aEvent.iPosition = screenCoordinates(aPointerEvent.iPosition, aTarget) ;
+    switch (aPointerEvent.iType)
+    {
+    case TPointerEvent::EButton1Down:
+    case TPointerEvent::EButton2Down:
+    case TPointerEvent::EButton3Down:
+    {
+        aEvent.iType = stmUiEventEngine::EDown ;
+        break ;
+    }
+    case TPointerEvent::EButton1Up:
+    case TPointerEvent::EButton2Up:
+    case TPointerEvent::EButton3Up:
+    {
+        if (m_capacitiveup)
+        {
+            aEvent.iType = stmUiEventEngine::ECapacitiveUP ;   // How could this be checked automagically?
+        }
+        else
+        {
+            aEvent.iType = stmUiEventEngine::EResistiveUP ;    // How could this be checked automagically?
+        }
+
+        break ;
+    }
+    case TPointerEvent::EDrag:
+    {
+        aEvent.iType = stmUiEventEngine::EDrag ;
+        break ;
+    }
+    }
+}
+////////////////////////////////////////////////////////////////////////////////////////////
+/*!
+ * Start the hold timer if it is not already active.
+ */
+void CStateMachine::startholdTimer(TInt aPointerNumber)
+{
+    if (!m_holdTimer[aPointerNumber]->IsActive())
+    {
+        m_holdTimer[aPointerNumber]->Start();
+    }
+}
+
+/*!
+ * The hold timer expiration: create a timer event and call the state machine
+ */
+void CStateMachine::handleholdTimer(TInt aPointerNumber)
+{
+    // We get an event, lets kick the state machine
+    CStateEngine* engine = m_impl[aPointerNumber];
+    CreateTimerEvent(engine->initEvent(), stmUiEventEngine::EHoldTimer) ;
+    engine->handleStateEvent() ;
+}
+/*!
+ * Stop the hold timer
+ */
+void CStateMachine::cancelholdTimer(TInt aPointerNumber)
+{
+    m_holdTimer[aPointerNumber]->Cancel();
+}
+/*!
+ * Start suppress timer.  The timeout has been set beforehand.
+ */
+void CStateMachine::startsuppressTimer(TInt aPointerNumber)
+{
+    m_suppressTimer[aPointerNumber]->Start();
+}
+/*!
+ * The suppress timer expiration, create a timer event and call the state machine.
+ */
+void CStateMachine::handlesuppressTimer(TInt aPointerNumber)
+{
+    // We get an event, lets kick the state machine
+    CStateEngine* engine = m_impl[aPointerNumber];
+    CreateTimerEvent(engine->initEvent(), stmUiEventEngine::ESuppressTimer) ;
+    engine->handleStateEvent() ;
+}
+/*!
+ * stop the suppress timer
+ */
+void CStateMachine::cancelsuppressTimer(TInt aPointerNumber)
+{
+    m_suppressTimer[aPointerNumber]->Cancel();
+}
+/*!
+ * start the touch timer if it is not already active.
+ */
+void CStateMachine::starttouchTimer(TInt aPointerNumber)
+{
+    if (!m_touchTimer[aPointerNumber]->IsActive())
+    {
+        m_touchTimer[aPointerNumber]->Start();
+    }
+}
+
+/*!
+ * The touch timer expiration, create timer event and call the state machine.
+ */
+void CStateMachine::handletouchTimer(TInt aPointerNumber)
+{
+    // We get an event, lets kick the state machine
+    CStateEngine* engine = m_impl[aPointerNumber];
+    CreateTimerEvent(engine->initEvent(), stmUiEventEngine::ETouchTimer) ;
+    engine->handleStateEvent() ;
+}
+/*!
+ * stop the touch timer
+ */
+void CStateMachine::canceltouchTimer(TInt aPointerNumber)
+{
+    if (m_touchTimer[aPointerNumber]->IsActive()) // we were waiting for additional events
+    {
+        m_touchTimer[aPointerNumber]->Cancel();
+    }
+}
+/*!
+ * CreateTimerEvent creates a timer event to the m_hwe variable.
+ */
+void CStateMachine::CreateTimerEvent(THwEvent& aEvent, TStateMachineEvent aEventCode)
+{
+    aEvent.iType = aEventCode ;
+    // m_hwe.iPosition = TPos(0, 0) ;      should we just leave the previous pos
+    TTime now ;
+    now.HomeTime() ;
+    aEvent.iTime = now ;
+}
+/*!
+ * Events are processed either using the MAknWsEventObserver interface
+ * or letting the view/container pass the pointer events to the state machine.
+ * The member variable m_wseventmonitoringenabled defines which method is used.
+ * If handlePoingterEventL is called, the calling CCoeCOntrol must provide itself
+ * as the target.
+ */
+void CStateMachine::HandlePointerEventL(const TPointerEvent& aPointerEvent, void *target)
+{
+    if (m_wseventmonitoringenabled) return ;    // events are handled in the event monitor
+    if (m_loggingenabled)
+    {
+#if defined(ADVANCED_POINTER_EVENTS)
+        TInt pointerNumber = PointerIndex(aPointerEvent) ;
+        LOGARG("Pointer %d event %s at (%d %d)", pointerNumber,
+                ttypeNames[aPointerEvent.iType], aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY) ;
+#else
+        LOGARG("Pointer event %s at (%d %d)",
+                ttypeNames[aPointerEvent.iType], aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY) ;
+#endif
+    }
+    TTime time = m_coeEnv->LastEvent().Time();
+    HandleStateEvent(aPointerEvent, target, time) ;   // target needs to be there to convert from window to screen coordinates
+}
+/**
+ * One possibility to implement gesture recognition is to intercept the events
+ * using the event monitoring interface.  The HandleWsEventL method will get all events
+ * passed to the application.  The aDestination parameter defines the window where the event
+ * was targeted to.  The gesture recognition should use the target information
+ * to determine how the gesture should be interpreted.
+ * In the current implementation the aDestination needs to be one of the UI event observers
+ * in order to process the message, but later when gesture recognition is added, this check
+ * needs to be removed and the gesture recognition should handle the target of the gesture.
+ */
+void CStateMachine::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination)
+{
+    // Check which processing type we have for events.
+    // If WsEvent monitoring, then process the message, otherwise return
+    if (!m_wseventmonitoringenabled) return ;
+
+    // Log the events passing trough to see what kind of stuff there goes...
+    // and could the gesture recogniser grab them from here?
+    TInt type=aEvent.Type();
+    switch (type)
+        {
+    case EEventKey:
+    case EEventKeyUp:
+    case EEventKeyDown:
+    {
+        if (m_loggingenabled)
+        {
+            TKeyEvent* tke = aEvent.Key() ;
+            LOGARG("Key event %d %d to %u", tke->iCode, tke->iScanCode, aDestination) ;
+        }
+        break;
+    }
+    case EEventPointer:
+    {
+        TPointerEvent* tpe = aEvent.Pointer() ;
+        if (m_loggingenabled)
+        {
+            TRect rcd = aDestination->Rect() ;
+            TPoint org = aDestination->PositionRelativeToScreen() ;
+            TRect rcd2 = rcd ;
+            rcd2.Move(org) ;
+            TPoint screenpos = tpe->iPosition ;
+            screenpos += org ;
+
+#if defined(ADVANCED_POINTER_EVENTS)
+            TInt pointerNumber = PointerIndex(*tpe) ;
+            LOGARG("Pointer %d event %s at (%d %d)[%d,%d] to 0x%x ((%d,%d)(%d,%d)): screen: ((%d,%d)(%d,%d))",
+                    pointerNumber,
+                    ttypeNames[tpe->iType],
+                    tpe->iPosition.iX, tpe->iPosition.iY,
+                    screenpos.iX, screenpos.iY,
+                    aDestination,
+                rcd.iTl.iX, rcd.iTl.iY, rcd.iBr.iX, rcd.iBr.iY,
+                rcd2.iTl.iX, rcd2.iTl.iY, rcd2.iBr.iX, rcd2.iBr.iY) ;
+#else
+            LOGARG("Pointer event %s at (%d %d)[%d,%d] to 0x%x ((%d,%d)(%d,%d)): screen: ((%d,%d)(%d,%d))",
+                    ttypeNames[tpe->iType], tpe->iPosition.iX, tpe->iPosition.iY,
+                    screenpos.iX, screenpos.iY,
+                    aDestination,
+                rcd.iTl.iX, rcd.iTl.iY, rcd.iBr.iX, rcd.iBr.iY,
+                rcd2.iTl.iX, rcd2.iTl.iY, rcd2.iBr.iX, rcd2.iBr.iY) ;
+#endif
+        }
+        HandleStateEvent(*tpe, aDestination, aEvent.Time()) ;
+        break;
+    }
+    case EEventPointerBufferReady:
+        if (m_loggingenabled)
+        {
+            LOGARG("Pointer buffer ready event to %u", aDestination) ;
+        }
+        break;
+    case EEventFocusLost:
+    case EEventFocusGained:
+        if (m_loggingenabled)
+        {
+            LOGARG("Focus message event to %u", aDestination) ;
+        }
+        break;
+    case EEventSwitchOn:
+        if (m_loggingenabled)
+        {
+            LOGARG("Switch On event to %u", aDestination) ;
+        }
+        break;
+    case EEventUser:
+        if (m_loggingenabled)
+        {
+            LOGARG("User event to %u", aDestination) ;
+        }
+        break;
+    case EEventPowerMgmt:
+        if (m_loggingenabled)
+        {
+            LOGARG("Power Mgmnt event to %u", aDestination) ;
+        }
+        break;
+    case EEventMessageReady:
+        if (m_loggingenabled)
+        {
+            LOGARG("Message Ready event to %u", aDestination) ;
+        }
+        break;
+    case EEventScreenDeviceChanged:
+        if (m_loggingenabled)
+        {
+            LOGARG("Screen device changed event to %u", aDestination) ;
+        }
+        break;
+
+    default:
+        if (m_loggingenabled)
+        {
+            LOGARG("default changed event %d to %u", type, aDestination) ;
+        }
+        break;
+    }
+}
+/*!
+ * Start the touch timer using a specified delay
+ */
+void CStateMachine::startTouchTimer(TInt aDelay, TInt aPointerNumber)
+{
+    m_touchTimer[aPointerNumber]->SetDelay(aDelay) ;
+    starttouchTimer(aPointerNumber) ;
+}
+/*!
+ *  Stop the touch timer.
+ */
+void CStateMachine::cancelTouchTimer(TInt aPointerNumber)
+{
+    canceltouchTimer(aPointerNumber) ;
+}
+/*!
+ * Start hold timer using specified delay
+ */
+void CStateMachine::startHoldTimer(TInt aDelay, TInt aPointerNumber)
+{
+    m_holdTimer[aPointerNumber]->SetDelay(aDelay) ;
+    startholdTimer(aPointerNumber) ;
+}
+/*!
+ * Stop the hold timer
+ */
+void CStateMachine::cancelHoldTimer(TInt aPointerNumber)
+{
+    cancelholdTimer(aPointerNumber) ;
+}
+/*!
+ * Start suppress timer using specified delay.
+ */
+void CStateMachine::startSuppressTimer(TInt aDelay, TInt aPointerNumber)
+{
+    m_suppressTimer[aPointerNumber]->SetDelay(aDelay) ;
+    startsuppressTimer(aPointerNumber) ;
+}
+/*!
+ *  Stop the suppress timer.
+ */
+void CStateMachine::cancelSuppressTimer(TInt aPointerNumber)
+{
+    cancelsuppressTimer(aPointerNumber) ;
+}
+
+/*!
+ * Method sets the m_wseventmonitoringenabled.  If it is true,
+ * then the state machine will be called from the HandleWsEventL method which
+ * sees all the events passed to the application.
+ *
+ * Otherwise the HandlePointerEventL method call will cause the call to
+ * state machine so the view/container needs to pass the pointer events to the state machine
+ * in its own HandlePointerEventL -method.
+ *
+ */
+void CStateMachine::EnableWsEventMonitoring(bool aEnable)
+{
+    if( !m_wseventmonitoringenabled && aEnable )
+    {
+        CAknAppUi* pui = (CAknAppUi*)m_coeEnv->AppUi() ;
+        TRAPD(err, pui->EventMonitor()->AddObserverL(this)) ;
+        if(!err)
+            pui->EventMonitor()->Enable(ETrue) ;
+    }
+    else if( m_wseventmonitoringenabled && !aEnable )
+    {
+        CAknAppUi* pui = (CAknAppUi*)m_coeEnv->AppUi() ;
+        pui->EventMonitor()->RemoveObserver(this) ;
+        // Should not disable since it may be not the only user
+        //pui->EventMonitor()->Enable(EFalse) ;
+    }
+
+    m_wseventmonitoringenabled = aEnable ;
+}
+TPoint CStateMachine::screenCoordinates(const TPoint& aPos, void* aGestureTarget)
+{
+    TPoint newPos = aPos ;
+    if (aGestureTarget)
+    {
+       CCoeControl* pcc = (CCoeControl*) aGestureTarget ;
+       TPoint tp(TPoint(0,0));
+        if (m_adjustYposition)
+        {
+            TSize sz = pcc->Size() ;
+
+            // If we are running in capacitive touch device,
+            // adjust the point up about 3 mm unless we are
+            // near top or bottom of the window
+
+            // Y position in the window
+            int wY = newPos.iY - tp.iY;
+            int edge = 2*m_3mminpixels;
+
+            if (Rng(0, wY, edge - 1))
+            {
+                // close to the top we adjust suitably so that immediately at the top adjust is 0
+                int adjust = wY / 2 ;
+                newPos.iY -= adjust ;
+                if (m_loggingenabled)
+                {
+                    LOGARG("adjustment: nY %d tY %d [3mm: %d  adj: %d]", 
+                            newPos.iY, tp.iY, m_3mminpixels, adjust) ;
+                }
+
+            }
+            else if (Rng(edge, wY, sz.iHeight - edge))
+            {
+                int from = newPos.iY ;
+                newPos.iY -= m_3mminpixels ;
+                if (m_loggingenabled)
+                {
+                    LOGARG("adjustment: %d to %d [3mm: %d  middle]", 
+                            from, newPos.iY, m_3mminpixels) ;
+                }
+
+            }
+            else
+            {
+                // similarly at the bottom we adjust less the closer we get to the edge
+                int adjust = (sz.iHeight - wY) / 2 ;
+                newPos.iY -= adjust ;
+                if (m_loggingenabled)
+                {
+                    LOGARG("adjustment: nY %d tY %d  sH %d [3mm: %d  adj: %d]",
+                            newPos.iY, tp.iY, sz.iHeight, m_3mminpixels, adjust) ;
+                }
+
+            }
+        }
+        else
+        {
+            // if the target does not own a window how can we adjust to the screen?
+        }
+    }
+    return newPos ;
+}
+void CStateMachine::enableCapacitiveUp(bool aEnable)
+{
+    m_capacitiveup = aEnable ;
+}
+void CStateMachine::enableYadjustment(bool aEnable)
+{
+    m_adjustYposition = aEnable ;
+}
+int CStateMachine::getNumberOfPointers()
+{
+    return KMaxNumberOfPointers ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/stmgestureinterface.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,618 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+
+// Gesture UI Engine
+#include "statemachine.h"
+
+// Gesture Library: Framework
+#include "gestureframework.h"
+#include "rt_gestureengineif.h"
+
+// Gesture Library: Recognizers
+#include "tapgesturerecogniser.h"
+#include "pangesturerecogniser.h"
+#include "edgescrollgesturerecogniser.h"
+#include "longpressgesturerecogniser.h"
+#include "pinchgesturerecogniser.h"
+#include "touchgesturerecogniser.h"
+#include "releasegesturerecogniser.h"
+#include "flickgesturerecogniser.h"
+#include "zoomgesturerecogniser.h"
+
+#include "stmgestureinterface.h"
+#include "gesturehelpereventsender.h"
+
+#ifndef ICS_DCHECK
+#define ICS_DCHECK(test)
+#endif
+
+#define LOG(args...)
+
+
+EXPORT_C CStmGestureParameters::CStmGestureParameters()
+    {
+
+    }
+
+EXPORT_C CStmGestureParameters::CStmGestureParameters(
+    const CStmGestureParameters& aParams )
+    {
+    Mem::Copy(&iParam[0], &aParams.iParam[0], sizeof(iParam));
+    Mem::Copy(&iAreaSettings[0], &aParams.iAreaSettings[0], sizeof(iAreaSettings));
+    Mem::Copy(&iEnabled[0], &aParams.iEnabled[0], sizeof(iEnabled));
+    }
+
+EXPORT_C CStmGestureEngine* CStmGestureEngine::NewL()
+    {
+    CStmGestureEngine* eng = new(ELeave) CStmGestureEngine();
+    CleanupStack::PushL(eng);
+    eng->ConstructL();
+    CleanupStack::Pop(eng);
+    return eng;
+    }
+
+CStmGestureEngine::CStmGestureEngine()
+    {
+
+    }
+
+void CStmGestureEngine::ConstructL()
+    {
+    iGf = stmGesture::CGestureFramework::NewL();
+    }
+
+CStmGestureEngine::~CStmGestureEngine()
+    {
+    // Prevent reactivation of contexts as they remove themselves
+    iDtorPhase = ETrue;
+
+    iContexts.ResetAndDestroy();
+    iCtxtStack.Reset();
+    delete iGf;
+    }
+
+EXPORT_C CStmGestureContext* CStmGestureEngine::CreateContextL(
+    TInt /*aId*/ )
+    {
+    CStmGestureContext* ctxt = new(ELeave) CStmGestureContext(*this);
+    CleanupStack::PushL(ctxt);
+    ctxt->ConstructL();
+    CleanupStack::Pop(ctxt);
+    return ctxt;
+    }
+
+EXPORT_C CStmGestureContext* CStmGestureEngine::Context(
+    TInt /*aId*/ )
+    {
+    return NULL;
+    }
+
+void CStmGestureEngine::EnableContextL(
+    CStmGestureContext& aContext )
+    {
+    // NB: enabling context puts it on top of the Context Stack
+    TInt idx = iCtxtStack.Find(&aContext);
+    if(idx >= 0)
+        {
+        iCtxtStack.Remove(idx);
+        }
+
+    SetupRecognizersL(aContext, ETrue);
+
+    iCtxtStack.AppendL(&aContext);
+    }
+
+void CStmGestureEngine::DisableContextL(
+    CStmGestureContext& aContext )
+    {
+    TInt idx = iCtxtStack.Find(&aContext);
+    ICS_DCHECK(idx >= 0);
+    if(idx == KErrNotFound)
+        {
+        return;
+        }
+
+    iCtxtStack.Remove(idx);
+
+    stmGesture::MGestureEngineIf* ge = iGf->getGestureEngine();
+
+    for(TInt i = 0; i < stmGesture::EStmGestureUid_Count; ++i)
+        {
+        MStmGestureRecogniser* rec = aContext.iRecognizers[i];
+        if(rec)
+            {
+            ge->removeGesture(rec);
+            }
+        }
+
+    // re-activate previous (new top-most) context
+    // NB: if deleted context is not top-most (active) one, no updates done
+    TInt count = iCtxtStack.Count();
+    if(idx == count && count > 0 && !iDtorPhase)
+        {
+        CStmGestureContext* previous = iCtxtStack[count - 1];
+        SetupRecognizersL(*previous, EFalse);
+        }
+    }
+
+template<class T>
+void CStmGestureEngine::InitRecognizerL(
+    T*& aGesture,
+    CStmGestureContext& aContext,
+    TBool aNewContext )
+    {
+    stmGesture::MGestureRecogniserIf*& recognizer = aContext.iRecognizers[T::KUid];
+    aGesture = static_cast<T*>(recognizer);
+    if(!aGesture && aNewContext)
+        {
+        recognizer = aGesture = T::NewL(&aContext);
+        recognizer->enableLogging((aContext.iLogging & (1<<T::KUid)) != 0);
+        }
+    else
+        {
+        ICS_DCHECK(gesture && !aNewContext); // should exist in restored top context
+        }
+
+    // TODO: Add in right place according to gesture class
+    TBool added = iGf->getGestureEngine()->addGesture(aGesture);
+    if(!added)
+        {
+        User::Leave(KErrNoMemory);
+        }
+    }
+
+void CStmGestureEngine::SetupRecognizersL(
+    CStmGestureContext& aContext,
+    TBool aNewContext )
+    {
+    LOG("Setup recognizers");
+    // Order of recognizers in the Gesture Engine (upper ones receive input before lower ones)
+    //
+    // PINCH
+    // CORNER_ZOOM
+    // EDGE_SCROLL
+    // LONGPRESS
+    // TOUCH
+    // UP_DOWN
+    // LEFT_RIGHT
+    // HOVER
+    // PAN
+    // TAP / DOUBLE_TAP
+    // FLICK
+    // RELEASE
+    // UNKNOWN
+
+    stmUiEventEngine::CStateMachine* stateMachine = iGf->getUiStateMachine();
+    stmGesture::MGestureEngineIf* gestureEngine = iGf->getGestureEngine();
+
+    MStmGestureParameters& conf = aContext.Config();
+
+    TBool filter = conf.Param(stmGesture::EEnableFiltering) != 0;
+
+    // TOUCH AREA
+    TStmGestureArea& touchArea = *conf.Area(stmGesture::ETouchArea);
+    TInt touchAreaSizeInMm = touchArea.iSize.iWidth;
+    stateMachine->setTouchAreaShape ( stmUiEventEngine::TAreaShape(touchArea.iShape) );
+    stateMachine->setTouchArea      ( !filter ? 0 : touchAreaSizeInMm );
+    stateMachine->setTouchTimeout   ( !filter ? 0 : touchArea.iTimeout * 1000);
+    CCoeControl* gestureContext = aContext.getOwner();
+    TRect ctxtRect = gestureContext->Rect();
+
+    // ===================================================== PINCH
+    using stmGesture::CPinchGestureRecogniser;
+
+    if (conf.Enabled(CPinchGestureRecogniser::KUid))
+        {
+        CPinchGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            TReal32 pspeed = conf.Param(stmGesture::EPinchSpeed) / 1000.f;
+            gesture->setPinchingSpeed(pspeed);
+            }
+        }
+
+    // ===================================================== LONG PRESS
+    using stmGesture::CLongPressGestureRecogniser;
+
+    if (conf.Enabled(CLongPressGestureRecogniser::KUid))
+        {
+        CLongPressGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            gesture->setArea(ctxtRect);
+            }
+        }
+
+    // ===================================================== TOUCH
+    using stmGesture::CTouchGestureRecogniser;
+
+    if (conf.Enabled(CTouchGestureRecogniser::KUid))
+        {
+        CTouchGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            // define empty area so that touch is reported only inside
+            // our window (touch recogniser handles either an area or the target window)
+            gesture->setArea(TRect());
+            }
+        }
+
+
+    // ===================================================== PAN
+    using stmGesture::CPanGestureRecogniser;
+
+    if (conf.Enabled(CPanGestureRecogniser::KUid))
+        {
+        CPanGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            gesture->setPanningSpeedLow ( conf.Param(stmGesture::EPanSpeedLow)  / 1000.f );
+            gesture->setPanningSpeedHigh( conf.Param(stmGesture::EPanSpeedHigh) / 1000.f );
+            }
+        }
+
+    // ===================================================== TAP / DOUBLE TAP
+    /// Add recognizer before any existing Flick, Release, Unknown
+    // Add the gesture to the gesture engine
+    // TODO: Tap recognizer is special - it can combine multiple listeners,
+    //       so no need to create new one if it already exists, just add new listeners to it
+
+    using stmGesture::CTapGestureRecogniser;
+
+    if (conf.Enabled(CTapGestureRecogniser::KUid))
+        {
+        CTapGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            gesture->setDoubleTapTimeout(conf.Param(stmGesture::EDoubleTapTimeout) * 1000);
+            gesture->setDoubleTapRange( touchAreaSizeInMm );
+            gesture->ignoreFirstTap(EFalse);
+
+            aContext.iLogging |= 1<<CTapGestureRecogniser::KUid;
+            }
+        }
+
+    // ===================================================== FLICK
+    using stmGesture::CFlickGestureRecogniser;
+
+    if (conf.Enabled(CFlickGestureRecogniser::KUid))
+        {
+        CFlickGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            TReal32 flickSpeed = conf.Param(stmGesture::EFlickSpeed) / 1000.f;
+            gesture->setFlickingSpeed(flickSpeed);
+            }
+        }
+
+    // ===================================================== RELEASE
+    using stmGesture::CReleaseGestureRecogniser;
+
+    if (conf.Enabled(CReleaseGestureRecogniser::KUid))
+        {
+        CReleaseGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            gesture->setArea(TRect());
+            }
+        }
+
+#if 0 // use in future depending upon browser requirement
+    // ===================================================== CORNER ZOOM
+    using stmGesture::CZoomGestureRecogniser;
+
+    if (conf.Enabled(CZoomGestureRecogniser::KUid))
+        {
+        CZoomGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            gesture->setArea(ctxtRect);
+            gesture->setRange(conf.Param(stmGesture::EZoomCornerSize));
+            }
+        }
+
+    // ===================================================== EDGE SCROLL
+    using stmGesture::CEdgeScrollGestureRecogniser;
+
+    if (conf.Enabled(CEdgeScrollGestureRecogniser::KUid))
+        {
+        CEdgeScrollGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+
+        if(gesture)
+            {
+            gesture->setArea(ctxtRect);
+            gesture->setScrollRange(conf.Param(stmGesture::EEdgeScrollRange)); // range is 20 pixels from the edge TODO: add this to settings...
+            }
+        }
+
+    // ===================================================== LEFT-RIGHT
+    using stmGesture::CLeftrightGestureRecogniser;
+
+    if (conf.Enabled(CLeftrightGestureRecogniser::KUid))
+        {
+        CLeftrightGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+        }
+
+    // ===================================================== UP-DOWN
+    using stmGesture::CUpdownGestureRecogniser;
+
+    if (conf.Enabled(CUpdownGestureRecogniser::KUid))
+        {
+        CUpdownGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+        }
+
+    // ===================================================== HOVER
+    using stmGesture::CHoveringGestureRecogniser;
+
+    if (conf.Enabled(CHoveringGestureRecogniser::KUid))
+        {
+        CHoveringGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+        if(gesture)
+            {
+            gesture->setHoveringSpeed(conf.Param(stmGesture::EHoverSpeed) / 1000.f);
+            }
+        }
+
+    // ===================================================== UNKNOWN
+    using stmGesture::CUnknownGestureRecogniser;
+
+    if (conf.Enabled(CUnknownGestureRecogniser::KUid))
+        {
+        CUnknownGestureRecogniser* gesture = NULL;
+        InitRecognizerL(gesture, aContext, aNewContext);
+        }
+#endif
+
+    // ===========================================================
+    if(aNewContext)
+        {
+        for(TInt i = 0; i < stmGesture::EStmGestureUid_Count; ++i)
+            {
+            MStmGestureRecogniser* rec = aContext.iRecognizers[i];
+            if(rec)
+                {
+                rec->enableLogging(aContext.iLogging & (1<<i)) ;
+                }
+            }
+        }
+
+
+    // HOLD AREA
+    TStmGestureArea& holdArea = *conf.Area(stmGesture::EHoldArea);
+    TInt holdAreaSizeInMm = holdArea.iSize.iWidth;
+    stateMachine->setHoldAreaShape  ( stmUiEventEngine::TAreaShape(holdArea.iShape) );
+    stateMachine->setHoldArea       ( !filter ? 0 : holdAreaSizeInMm );
+    stateMachine->setHoldTimeout    ( !filter ? 0 : holdArea.iTimeout * 1000);
+
+    // TOUCH-TIME AREA
+    TStmGestureArea& tTimeArea = *conf.Area(stmGesture::ETouchTimeArea);
+    TInt tTimeAreaSizeInMm = tTimeArea.iSize.iWidth;
+    // NB: shape <-- TouchAreaShape
+    stateMachine->setTouchTimeArea      ( !filter ? 0 : tTimeAreaSizeInMm );
+
+    // Timeouts, Adjustments, etc.
+    stateMachine->setTouchSuppressTimeout(!filter ? 0 :
+                                            conf.Param(stmGesture::ESuppressTimeout)*1000) ;
+    stateMachine->setMoveSuppressTimeout(!filter ? 0 :
+                                            conf.Param(stmGesture::EMoveSuppressTimeout)*1000) ;
+    stateMachine->enableCapacitiveUp    (!filter ? 0 :
+                                            conf.Param(stmGesture::ECapacitiveUpUsed));
+    stateMachine->enableYadjustment     (!filter ? 0 : conf.Param(stmGesture::EAdjustYPos));
+    stateMachine->enableLogging(false);
+
+    stateMachine->EnableWsEventMonitoring(false);
+    LOG("Setup recognizers -- DONE");
+    }
+
+EXPORT_C void CStmGestureEngine::HandlePointerEventL(
+    const TPointerEvent& aPointerEvent,
+    void* target)
+    {
+    iGf->getUiStateMachine()->HandlePointerEventL(aPointerEvent,target);
+    }
+
+// =============================================================
+
+CStmGestureContext::CStmGestureContext(
+    CStmGestureEngine& aEngine ) :
+    iEngine(aEngine),
+    iEventSender(NULL)
+    {
+
+    }
+
+void CStmGestureContext::ConstructL()
+    {
+    iEngine.iContexts.AppendL(this);
+    iConfig = new(ELeave) CStmGestureParameters();
+    }
+
+CStmGestureContext::~CStmGestureContext()
+    {
+    // Remove all gesture listeners
+    for(TInt i = iListeners.Count() - 1; i >= 0; --i)
+        {
+        MStmGestureListener* listener = iListeners[i];
+        iListeners.Remove(i);
+        }
+
+    iListeners.Reset();
+
+    // Remove all context's recognizers from the Gesture Engine
+    Deactivate();
+
+    if (iEventSender)
+        delete iEventSender;
+
+    // Destroy all recognizers
+    for(TInt r = 0; r < stmGesture::EStmGestureUid_Count; ++r)
+        {
+        MStmGestureRecogniser*& rec = iRecognizers[r];
+        if(rec)
+            {
+            delete rec;
+            rec = NULL;
+            }
+        }
+
+    // Remove context from the Gesture Engine
+    TInt idx = iEngine.iContexts.Find(this);
+    if(idx != -1)
+        {
+        iEngine.iContexts.Remove(idx);
+        }
+    delete iConfig;
+    }
+
+EXPORT_C void CStmGestureContext::AddListenerL(
+    MStmGestureListener* aListener,
+    TInt aPos )
+    {
+    iEventSender = CGestureEventSender::NewL(*aListener);
+    iListeners.InsertL(aListener, aPos);
+    }
+
+EXPORT_C TInt CStmGestureContext::RemoveListener(
+    MStmGestureListener* aListener )
+    {
+    TInt ind = iListeners.Find(aListener);
+    if(ind >= 0)
+        {
+        iListeners.Remove(ind);
+        }
+    return ind;
+    }
+
+EXPORT_C void CStmGestureContext::SetContext(
+    CCoeControl* aControl )
+    {
+    iOwnerControl = aControl;
+
+    for(TInt i = 0; i < stmGesture::EStmGestureUid_Count; ++i)
+        {
+        MStmGestureRecogniser* rec = iRecognizers[i];
+        if(rec)
+            {
+            rec->setOwner(aControl);
+            }
+        }
+    }
+
+EXPORT_C void CStmGestureContext::ActivateL()
+    {
+    if(IsActive())
+        {
+        // re-enable all recognizers
+        EnableRecognizersL();
+        return;
+        }
+    /// 1. Tell Engine to deactivate active context
+
+    /// 2. Setup all gesture recognizers
+    iEngine.EnableContextL(*this);
+
+    /// 3. Notify listeners
+
+    //
+    EnableRecognizersL();
+
+    ///
+    iActivated = ETrue;
+    }
+
+EXPORT_C void CStmGestureContext::Deactivate()
+    {
+    // NB: reactivation of previous context may leave
+    TRAP_IGNORE(iEngine.DisableContextL(*this));
+    iActivated = EFalse;
+    }
+
+void CStmGestureContext::gestureEnter(
+    MStmGesture& aGesture )
+    {
+    TRAP_IGNORE(DispatchGestureEventL(aGesture.gestureUid(), &aGesture));
+    }
+
+void CStmGestureContext::gestureExit(
+    TStmGestureUid aGestureUid )
+    {
+    TRAP_IGNORE(DispatchGestureEventL(aGestureUid, NULL));
+    }
+
+CCoeControl* CStmGestureContext::getOwner()
+    {
+    return iOwnerControl;
+    }
+
+void CStmGestureContext::DispatchGestureEventL(
+    TStmGestureUid aUid,
+    MStmGesture* aGesture )
+    {
+    iEventSender->AddEvent(aUid, aGesture);
+    }
+
+void CStmGestureContext::SuspendRecognizer(
+    TStmGestureUid aUid )
+    {
+    MStmGestureRecogniser* rec = iRecognizers[aUid];
+    if(rec && !rec->isEnabled())
+        {
+        rec->enable(EFalse);
+        // TODO: Notify listener
+        }
+    }
+
+void CStmGestureContext::EnableRecognizersL()
+    {
+    for(TInt i = 0; i < stmGesture::EStmGestureUid_Count; ++i)
+        {
+        EnableRecognizerL(TStmGestureUid(i));
+        }
+    }
+
+void CStmGestureContext::EnableRecognizerL(
+    TStmGestureUid aUid )
+    {
+    MStmGestureRecogniser* rec = iRecognizers[aUid];
+    if(rec && !rec->isEnabled())
+        {
+        rec->enable(ETrue);
+        // TODO: Notify listener
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/tapgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GenericSimpleGesture.h"
+#include "TapGestureRecogniser.h"
+#include "rt_uievent.h"
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+/* some utility functions, are these things not provided by the OS? */
+const TInt KFingerSize_mm = 8;
+const TInt KTwipsInInch = 1440;
+const TReal KTwipsInMm = 56.7;
+
+long Twips2Pixels(long twips)
+{
+    CWsScreenDevice* screen = CCoeEnv::Static()->ScreenDevice();
+    TZoomFactor deviceMap(screen);
+    deviceMap.SetZoomFactor(TZoomFactor::EZoomOneToOne);
+    long px = deviceMap.VerticalTwipsToPixels(twips); //assuming that vertical
+    return px; //the same as horizontal
+}
+
+long Mm2Pixels(long mm)
+{
+    return Twips2Pixels(mm * KTwipsInMm);
+}
+
+long Inches2Pixels(double inches)
+{
+    return Twips2Pixels(inches * KTwipsInInch);
+}
+
+TRect ToleranceRect(const TPoint& aCenterPoint, int size)
+{
+    long toleranceLength = Mm2Pixels(KFingerSize_mm) / 2;
+    TRect toleranceRect(aCenterPoint, TSize());
+    toleranceRect.Shrink(-size, -size);
+    return toleranceRect;
+}
+
+CTapGestureRecogniser* CTapGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CTapGestureRecogniser* self = new (ELeave) CTapGestureRecogniser(aListener) ;
+    CleanupStack::PushL(self);
+    self->ConstructL(); // construct base class
+    CActiveScheduler::Add(self);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CTapGestureRecogniser::CTapGestureRecogniser(MGestureListener* aListener) :
+    CTimer(EPriorityRealTime - 1)
+{
+    m_powner = aListener->getOwner() ;
+    // if a listener is given here, then it is both tap and doubletap listener
+    if (aListener)
+    {
+        addTapListener(aListener, m_powner) ;
+        addDoubleTapListener(aListener, m_powner) ;
+    }
+    m_waitingforsecondtap = false ;
+    m_gestureEnabled = true ;
+    m_ignorefirst = true ;  // by default ignore the first tap
+}
+
+CTapGestureRecogniser::~CTapGestureRecogniser()
+{
+    Cancel();
+    m_tapListeners.Reset() ;
+    m_tapListenerWindows.Reset() ;
+    m_doubleTapListeners.Reset() ;
+    m_doubleTapListenerWindows.Reset() ;
+
+}
+
+TGestureRecognitionState CTapGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like a tap or double tap
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be tap and release
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        if (!puie) return state;
+        
+        int countOfEvents = puie->countOfEvents() ;
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code() ;
+
+        if (m_loggingenabled)
+        {
+            LOGARG("CTapGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
+        }
+        if (countOfEvents == 2) // Do we have touch and release in the stream, check if there are two events
+        {
+            // Then look at the events to see if they are suitable for us
+            if (eventCode == stmUiEventEngine::ERelease) // The last one is release
+            {
+                stmUiEventEngine::MUiEvent* puieFirst = puie->previousEvent();
+                
+                if(puieFirst)
+                    eventCode = puieFirst->Code();
+                else 
+                    return state; 
+                
+                if (eventCode == stmUiEventEngine::ETouch)   // is the first one ETouch
+                {
+                    if (m_loggingenabled)
+                    {
+                        LOGARG("CTapGestureRecogniser: 0x%x TAP: num %d code %d", 
+                                this, countOfEvents, eventCode);
+                    }
+                    // It is tap gesture in our window, handle it
+                    state = EGestureActive;
+
+                    CCoeControl* target = (CCoeControl*)puie->Target();
+
+                    if (m_waitingforsecondtap)
+                    {
+                        m_waitingforsecondtap = false ;
+                        if (m_loggingenabled)
+                        {
+                            LOGARG("CTapGestureRecogniser: 0x%x second tap: num %d code %d", 
+                                    this, countOfEvents, eventCode);
+                        }
+
+                        Cancel() ;  // The timer
+
+                        const TPoint& secondPoint = puieFirst->CurrentXY() ;
+                        if (isSecondTapClose(secondPoint, m_firstTapXY))
+                        {
+                            // Taps were close enough together, so issue a doubletap
+
+                            // Call the listener of the current window to inform that a doubletap has occurred...
+                            TInt inx = m_doubleTapListenerWindows.Find(target) ;
+                            if (inx == KErrNotFound)
+                            {
+                                // the second tap hit a window with no listener,
+                                // check if the first one has a listener
+                                inx = m_doubleTapListenerWindows.Find(m_firstTapTarget) ;
+                            }
+                            // not found, check if the parent is in the listener list
+                            if (inx == KErrNotFound)
+                            {
+                                CCoeControl* pc = target ;
+                                while (pc)
+                                {
+                                    pc = pc->Parent() ;
+                                    inx = m_doubleTapListenerWindows.Find(pc) ;
+                                    if (inx != KErrNotFound) break ;
+                                }
+                            }
+                            if (inx != KErrNotFound)
+                            {
+                                // Tap gesture
+                                stmGesture::TGenericSimpleGesture pgest(
+                                    stmGesture::EGestureUidDoubleTap, 
+                                    secondPoint, stmGesture::ETapTypeDouble, puie) ;
+                                MGestureListener* plistener = m_doubleTapListeners[inx] ;
+                                plistener->gestureEnter(pgest) ;
+                            }
+                        }
+                        else
+                        {
+                            // Second tap is too far away, generate just tap
+                            // and if configured, also the fist tap is generated
+                            if (!m_ignorefirst)
+                            {
+                                // do not ignore the first tap, so issue it now using the stored location
+                                // Call the listener to inform that a Tap has occurred, if there was a listener in that window
+                                TInt inx = m_tapListenerWindows.Find(m_firstTapTarget) ;
+                                if (inx != KErrNotFound)    // check if the listener exists
+                                {
+                                    stmGesture::TGenericSimpleGesture pgest(
+                                        stmGesture::EGestureUidTap, puieFirst->CurrentXY(), 
+                                        stmGesture::ETapTypeSingle, puieFirst) ; // TODO: speed is 0?
+                                    MGestureListener* plistener = m_tapListeners[inx] ;
+                                    plistener->gestureEnter(pgest) ;
+                                }
+                            }
+                            // generate a tap at the current location, if there is a listener for it
+                            TInt inx = m_tapListenerWindows.Find(target) ;
+                            if (inx != KErrNotFound)
+                            {
+                                stmGesture::TGenericSimpleGesture pgest(
+                                    stmGesture::EGestureUidTap, puie->CurrentXY(), 
+                                    stmGesture::ETapTypeSingle, puie) ; // TODO: speed is 0?
+                                MGestureListener* plistener = m_tapListeners[inx] ;
+                                plistener->gestureEnter(pgest) ;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        m_firstTapXY = puieFirst->CurrentXY() ;
+                        m_firstTapTarget = target ;
+                        m_firstTapSpeedX = puie->speedX() ;
+                        m_firstTapSpeedY = puie->speedY() ;
+                        // This was the first tap, start the timer...
+                        m_waitingforsecondtap = true ;
+                        if (m_loggingenabled)
+                        {
+                            LOGARG("CTapGestureRecogniser: 0x%x first tap: num %d code %d", 
+                                    this, countOfEvents, eventCode);
+                        }
+                        Cancel() ;  // Just to be sure...
+                        After(m_doubleTapTimeout) ;
+                    }
+
+                }
+            }
+        }
+    }
+    return state;
+}
+
+void CTapGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    Cancel() ;  // some other gesture took hold of the thing, do not send tap gesture
+    m_waitingforsecondtap = false ;
+    if (m_loggingenabled)
+    {
+        LOGARG("CTapGestureRecogniser: 0x%x release, %d %d", 
+                this, m_firstTapXY.iX, m_firstTapXY.iY);
+    }
+}
+
+void CTapGestureRecogniser::RunL()
+{
+    m_waitingforsecondtap = false ;
+    if (m_loggingenabled)
+    {
+        LOGARG("CTapGestureRecogniser: 0x%x timer, %d %d", this, m_firstTapXY.iX, m_firstTapXY.iY);
+    }
+    // Double tap timer has been elapsed without new Touch/Release, generate the tap if there is a listener
+    TInt inx = m_tapListenerWindows.Find(m_firstTapTarget) ;
+    if (inx != KErrNotFound)
+    {
+        using stmUiEventEngine::TUiEventSpeed;
+
+        TUiEventSpeed speedIf(m_firstTapSpeedX,m_firstTapSpeedY);
+
+        stmGesture::TGenericSimpleGesture pgest(
+                stmGesture::EGestureUidTap,
+                m_firstTapXY,
+                stmGesture::ETapTypeSingle,
+                &speedIf) ;
+
+        MGestureListener* plistener = m_tapListeners[inx] ;
+        plistener->gestureEnter(pgest) ;
+    }
+}
+
+void CTapGestureRecogniser::enableLogging(bool loggingOn)
+{
+    m_loggingenabled = loggingOn;
+}
+
+void CTapGestureRecogniser::setOwner(CCoeControl* owner)
+{
+    m_powner = owner;
+}
+
+void CTapGestureRecogniser::setDoubleTapTimeout(int newtimeout)
+{
+    m_doubleTapTimeout  = newtimeout;
+}
+
+void CTapGestureRecogniser::enable(bool enabled)
+{
+    m_gestureEnabled = enabled ;
+}
+
+bool CTapGestureRecogniser::isEnabled()
+{
+    return m_gestureEnabled ;
+}
+
+void CTapGestureRecogniser::setDoubleTapRange(int rangeInMillimetres)
+{
+    m_rangesizeInPixels = Mm2Pixels(rangeInMillimetres) ;
+}
+
+void CTapGestureRecogniser::ignoreFirstTap(bool ignore)
+{
+    m_ignorefirst = ignore ;
+}
+
+/*!
+ * Check whether the two taps are close enough to each other
+ */
+bool CTapGestureRecogniser::isSecondTapClose(const TPoint& secondPoint, const TPoint& firstTapXY)
+{
+    TRect tolerance = ToleranceRect(secondPoint, m_rangesizeInPixels) ;
+    bool aretheyclose = tolerance.Contains(firstTapXY);
+    return aretheyclose ;
+}
+
+void CTapGestureRecogniser::addTapListener(MGestureListener* aListener, CCoeControl* listenerOwner)
+{
+    m_tapListeners.Append(aListener) ;
+    m_tapListenerWindows.Append(listenerOwner) ;
+}
+
+void CTapGestureRecogniser::removeTapListener(MGestureListener* aListener, 
+                                              CCoeControl* /*listenerOwner*/)
+{
+    TInt inx = m_tapListeners.Find(aListener) ;
+    if(inx != KErrNotFound)
+    {
+        m_tapListeners.Remove(inx) ;
+        m_tapListenerWindows.Remove(inx) ;
+    }
+}
+
+void CTapGestureRecogniser::addDoubleTapListener(MGestureListener* aListener, 
+                                                 CCoeControl* listenerOwner)
+{
+    m_doubleTapListeners.Append(aListener) ;
+    m_doubleTapListenerWindows.Append(listenerOwner) ;
+}
+
+void CTapGestureRecogniser::removeDoubleTapListener(MGestureListener* aListener, 
+                                                    CCoeControl* /*listenerOwner*/)
+{
+    TInt inx = m_doubleTapListeners.Find(aListener) ;
+    if(inx != KErrNotFound)
+    {
+        m_doubleTapListeners.Remove(inx) ;
+        m_doubleTapListenerWindows.Remove(inx) ;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/touchgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GenericSimpleGesture.h"
+#include "touchgesturerecogniser.h"
+#include "rt_uievent.h"
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+CTouchGestureRecogniser::CTouchGestureRecogniser(MGestureListener* aListener) :
+    CGestureRecogniser(aListener)
+{
+}
+
+CTouchGestureRecogniser* CTouchGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CTouchGestureRecogniser* self = new (ELeave) CTouchGestureRecogniser(aListener) ;
+    return self;
+}
+
+CTouchGestureRecogniser::~CTouchGestureRecogniser()
+{
+}
+
+/*!
+ * Touch gesture recogniser.  Note that this one never owns the gesture, it just calls
+ * the callback if it detects ETouch inside the area being watched.
+ * There could be also check for the target window?
+ */
+TGestureRecognitionState CTouchGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like edge scroll with one pointer
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be EHold
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        if (!puie) return state;
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code();
+
+        if (m_loggingenabled)
+        {
+            LOGARG("CTouchGestureRecogniser: 0x%x num %d code %d", this, puie->countOfEvents(), eventCode);
+
+        }
+        if (eventCode == stmUiEventEngine::ETouch)
+        {
+            const TPoint& tapPoint = puie->CurrentXY();
+            if (m_loggingenabled)
+            {
+                LOGARG("CTouchGestureRecogniser: 0x%x ETouch: num %d at %d, %d", this, puie->countOfEvents(), tapPoint.iX, tapPoint.iY);
+                LOGARG("CTouchGestureRecogniser: area, %d,%d %d,%d", m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY);
+            }
+            bool produceGesture ;
+            if(!m_area.IsEmpty())
+            {
+                produceGesture = m_area.Contains(tapPoint);
+                if(produceGesture && m_loggingenabled)
+                {
+                    LOGARG("CTouchGestureRecogniser: HIT area (%d,%d) in %d,%d %d,%d", tapPoint.iX, tapPoint.iY, m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY);
+                }
+            }
+            else
+            {
+                produceGesture = (m_powner == puie->Target()); // no area defined, touch detected in the window
+            }
+            if (produceGesture)
+            {
+                // state = EGestureActive ; do not take ownership, all gestures anyway start with ETouch
+                // issue the touch gesture
+                stmGesture::TGenericSimpleGesture pgest(KUid, tapPoint);
+                // Call the listener to inform that a touch has occurred...
+                m_listener->gestureEnter(pgest);
+            }
+        }
+    }
+    return state;
+}
+
+void CTouchGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    if (m_loggingenabled)
+    {
+        LOGARG("CTouchGestureRecogniser: 0x%x release", this);
+    }
+}
+
+void CTouchGestureRecogniser::setArea(const TRect& theArea)
+{
+    m_area = theArea ;
+    if (m_loggingenabled)
+    {
+        LOGARG("CTouchGestureRecogniser: area, %d,%d %d,%d", m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/uieventsender.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "uieventsender.h"
+#include "UiEvent.h"
+
+#include "filelogger.h"
+
+using namespace stmUiEventEngine;
+
+
+CUiEventSender* CUiEventSender::NewL()
+{
+    CUiEventSender* self = new (ELeave) CUiEventSender();
+
+    return self;
+}
+
+/*!
+ * An active object for sending the UI events to the observers.
+ * Depending on the m_directsending the asynchronous method is not
+ * used but instead the observers will be called immediately.
+ */
+CUiEventSender::CUiEventSender()
+{
+    m_loggingenabled = false ;
+    for (int i = 0; i < stmUiEventEngine::KMaxNumberOfPointers; i++)
+    {
+        iEvents[i] = NULL ;
+    }
+}
+
+CUiEventSender::~CUiEventSender()
+{
+    // remove the possible events from the buffers if release was missed
+    for (int i = 0; i < stmUiEventEngine::KMaxNumberOfPointers; i++)
+    {
+        if (iEvents[i]) delete iEvents[i] ;
+    }
+    iObserver.Reset() ;
+}
+
+/*!
+ * Add new UI event to the list or send it directly to the observers
+ * depending on the m_directsending flag.
+ * \param aUiEvent the new UI event to be sent to the observers.
+ */
+TInt CUiEventSender::AddEvent(CUiEvent* aUiEvent)
+{
+    int pointerIndex = aUiEvent->Index() ;
+    // Store the new UI event.  Check what kind of event it is and compress the set of events
+    // stored so far if possible
+    compressStack(aUiEvent) ;
+    aUiEvent->setPrevious(iEvents[pointerIndex]) ;
+    iEvents[pointerIndex] = aUiEvent ;  // Store the new event
+    TRAPD(err, EmitEventL(*aUiEvent));
+    if(err)
+        return err;
+
+    if (m_loggingenabled)
+    {
+        LOGARG("Sent event: %s: (ptr %d) (%d,%d)",
+                stmUiEventEngine::EventName(aUiEvent->Code()), pointerIndex,
+                aUiEvent->CurrentXY().iX, aUiEvent->CurrentXY().iY);
+    }
+    // If this was release event, then the chain can be removed
+    if (aUiEvent->Code() == stmUiEventEngine::ERelease)
+    {
+        delete aUiEvent;    // This will delete the whole chain
+        iEvents[pointerIndex] = NULL ;
+    }
+    return KErrNone;
+}
+/*!
+ * Call each observer with the event
+ */
+void CUiEventSender::EmitEventL(const CUiEvent& aEvent)
+{
+    for (TInt i = 0; i < iObserver.Count(); i++)
+    {
+        iObserver[i]->HandleUiEventL(aEvent);
+    }
+}
+
+/*!
+ * Add a new observer.  Note that current implementation is very rude:
+ * max 5 observers in a simple array.
+ */
+bool CUiEventSender::addObserver(MUiEventObserver* aObserver )
+{
+    iObserver.Append(aObserver) ;
+    return true ;
+}
+
+/*
+ * remove observer from list
+ */
+bool CUiEventSender::removeObserver(MUiEventObserver* aObserver )
+{
+    int x = iObserver.Find(aObserver) ;
+    if (x != -1)
+    {
+        iObserver.Remove(x) ;
+        return true ;
+
+    }
+    return EFalse ; // Could not find observer
+}
+void CUiEventSender::compressStack(CUiEvent* aUiEvent)
+{
+    int pointerIndex = aUiEvent->Index() ;
+    CUiEvent*& top = iEvents[pointerIndex] ;
+    if(!top)
+    {
+        return;
+    }
+    if (aUiEvent->Code() == stmUiEventEngine::EHold)
+    {
+        // assumption: in case of hold, we can discard all previous messages
+        delete top ;
+        top = NULL ;
+    }
+    else
+    {
+        // Check if there would too many moves
+        CUiEvent* next = dynamic_cast<CUiEvent*>(top->previousEvent()) ;
+        if (next != 0 && next->Code() == stmUiEventEngine::EMove)
+        {
+            // leave only the topmost to the stack
+            top->setPrevious(0) ;
+            delete next ;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/unknowngesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "GenericSimpleGesture.h"
+#include "unknowngesturerecogniser.h"
+#include "rt_uievent.h"
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+CUnknownGestureRecogniser::CUnknownGestureRecogniser(MGestureListener* aListener) :
+    CGestureRecogniser(aListener)
+{
+}
+
+CUnknownGestureRecogniser* CUnknownGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CUnknownGestureRecogniser* self = new (ELeave) CUnknownGestureRecogniser(aListener) ;
+    return self;
+}
+
+CUnknownGestureRecogniser::~CUnknownGestureRecogniser()
+{
+}
+
+/*!
+ * recognise the long press; basically it is just the EHold UI event
+ */
+TGestureRecognitionState CUnknownGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+
+    // Look at the events to see if it looks like long press with one pointer
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be EHold
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        int countOfEvents = puie->countOfEvents();
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code();
+
+        if (m_loggingenabled)
+        {
+            LOGARG("CUnknownGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
+        }
+        if (puie->Target() == m_powner && eventCode == stmUiEventEngine::ERelease) // The last one is ERelease
+        {
+            const TPoint& currentXY = puie->CurrentXY() ;
+            if (m_loggingenabled)
+            {
+                LOGARG("CUnknownGestureRecogniser: (%d, %d) ", currentXY.iX, currentXY.iY) ;
+            }
+            state = EGestureActive ;
+            // issue the gesture
+            stmGesture::TGenericSimpleGesture pgest(KUid, currentXY, 0, puie) ;
+            // Call the listener to inform that a gesture has occurred...
+            m_listener->gestureEnter(pgest) ;
+        }
+    }
+    return state;
+}
+
+void CUnknownGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    if (m_loggingenabled)
+    {
+        LOGARG("CUnknownGestureRecogniser: 0x%x release", this);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/updowngesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include "updowngesturerecogniser.h"
+#include "GenericSimpleGesture.h"
+#include "rt_uievent.h"
+
+#include "filelogger.h"
+
+using namespace stmGesture ;
+
+_LIT8(KUpdownName, "Updown") ;
+
+CUpdownGestureRecogniser::CUpdownGestureRecogniser(MGestureListener* aListener) : 
+        CGestureRecogniser(aListener)
+{
+}
+
+CUpdownGestureRecogniser* CUpdownGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CUpdownGestureRecogniser* self = new (ELeave) CUpdownGestureRecogniser(aListener) ;
+    return self;
+}
+
+CUpdownGestureRecogniser::~CUpdownGestureRecogniser()
+{
+}
+
+TGestureRecognitionState CUpdownGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like a tap or double tap
+    if (numOfActiveStreams == 1)
+    {
+        // Then look at the event stream, it has to be tap and release
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        int countOfEvents = puie->countOfEvents() ;
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code() ;
+        if (countOfEvents > 1) // do we have more than one event in the stream?
+        {
+            // Then look at the events to see if they are suitable for us
+            // should we check that all of the events are targeted to our window?
+            // currently we only check if the last one is for us and is EMove, then check if |x| > |y|
+            if (puie->Target() == m_powner &&
+                    eventCode == stmUiEventEngine::EMove) // The last one is move in our window
+
+            {
+                if (m_loggingenabled)
+                {
+                    LOGARG("CUpdownGestureRecogniser: UpDown: num %d code %d", 
+                            countOfEvents, eventCode);
+                }
+                // Is it leftright gesture in our window?
+                const TPoint& p = puie->CurrentXY() ;
+                TPoint dp = p - puie->PreviousXY() ;
+                // check that the Y movement is bigger
+                if (Abs(dp.iX) < Abs(dp.iY))
+                {
+                    state = EGestureActive;
+                    stmGesture::TGenericSimpleGesture pgest(KUid, p, dp.iY, puie) ;
+                    // Give the gesture a name
+                    pgest.setName(KUpdownName) ;
+                    // Call the listener to inform that a UpDown has occurred...
+                    m_listener->gestureEnter(pgest) ;
+                }
+            }
+        }
+    }
+    return state;
+}
+
+void CUpdownGestureRecogniser::release(MGestureEngineIf* /*ge*/)
+{
+    m_listener->gestureExit(KUid) ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/utils.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#include "utils.h"
+
+#include <coemain.h> // for CCoeEnv
+#include <eikappui.h>  // for CEikAppUi
+
+#include "gesturedefs.h"
+
+namespace stmUiEventEngine
+{
+    /** @return the longer edge of the size */
+    inline TInt LongerEdge( const TSize& aSize )
+        {
+        return Max( aSize.iHeight, aSize.iWidth );
+        }
+
+    // for documentation, see header file
+    TRect ToleranceRect( const TPoint& aCenterPoint )
+        {
+        long toleranceLength = Mm2Pixels(KFingerSize_mm) / 2;
+        TRect toleranceRect( aCenterPoint, TSize() );
+        // grow by the tolerance length, while keeping the center point
+        toleranceRect.Grow( toleranceLength, toleranceLength );
+        return toleranceRect;
+        }
+
+    long Twips2Pixels(long twips)
+        {
+        CWsScreenDevice* screen = CCoeEnv::Static()->ScreenDevice();
+        TZoomFactor deviceMap(screen);
+        deviceMap.SetZoomFactor(TZoomFactor::EZoomOneToOne);
+        long px = deviceMap.VerticalTwipsToPixels(twips); //assuming that vertical
+        return px;                                        //the same as horizontal
+
+        }
+
+    long Mm2Pixels(long mm)
+        {
+        return Twips2Pixels(mm * KTwipsInMm);
+        }
+
+    long Inches2Pixels(float inches)
+        {
+        return Twips2Pixels(inches * KTwipsInInch);
+        }
+
+
+} // namespace
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/webkitutils/stmgesturefw/src/zoomgesturerecogniser.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Gesture helper implementation
+*
+*/
+
+#include <e32math.h>
+#include <rt_uievent.h>
+#include "filelogger.h"
+#include "zoomgesturerecogniser.h"
+#include "GenericSimpleGesture.h"
+
+using namespace stmGesture ;
+
+_LIT8(KZoomInName, "ZoomIn") ;
+_LIT8(KZoomOutName, "ZoomOut") ;
+
+CZoomGestureRecogniser* CZoomGestureRecogniser::NewL(MGestureListener* aListener)
+{
+    CZoomGestureRecogniser* self = new (ELeave) CZoomGestureRecogniser(aListener) ;
+    return self;
+}
+
+CZoomGestureRecogniser::CZoomGestureRecogniser(MGestureListener* aListener) :
+    CGestureRecogniser(aListener), m_area(TRect::EUninitialized)
+{
+    m_rangesizeInPixels = 20 ;  // by default 20 pixels from the edges is the area
+    m_zooming = false ;
+}
+
+CZoomGestureRecogniser::~CZoomGestureRecogniser()
+{
+}
+
+TGestureRecognitionState CZoomGestureRecogniser::recognise(int numOfActiveStreams,
+        MGestureEngineIf* pge)
+{
+    TGestureRecognitionState state = ENotMyGesture;
+    // Check if we are enabled or not
+    if (!m_gestureEnabled) return state ;
+
+    // Look at the events to see if it looks like zoom with one pointer
+    if (numOfActiveStreams == 1)
+    {
+        const stmUiEventEngine::MUiEvent* puie = pge->getUiEvents(0);
+        int countOfEvents = puie->countOfEvents();
+        stmUiEventEngine::TUiEventCode eventCode = puie->Code();
+
+        if (m_loggingenabled)
+        {
+            LOGARG("CZoomGestureRecogniser: %d num %d code %d",
+                    eventCode, countOfEvents, eventCode);
+
+        }
+        if (!m_zooming)
+        {
+            // We are not yet zoomin, check if we should start, i.e. whether we are
+            // inside the zoom trigger areas near the corners when touch is done...
+            if (eventCode == stmUiEventEngine::ETouch) // It must be ETouch inside the corner
+            {
+                if (m_loggingenabled)
+                {
+                    LOGARG("CZoomGestureRecogniser: 0x%x ETouch: num %d code %d, %d",
+                            this, countOfEvents, puie->CurrentXY().iX, puie->CurrentXY().iY);
+                    LOGARG("CZoomGestureRecogniser: area, %d,%d %d,%d, range: %d", m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY, m_rangesizeInPixels);
+                }
+
+                // the lower left rectangle is m_rangesizeIPixels from the corner
+                TRect lowerleft(m_area.iTl.iX, m_area.iBr.iY-m_rangesizeInPixels,
+                        m_area.iTl.iX+m_rangesizeInPixels, m_area.iBr.iY) ;
+                TRect upperright(m_area.iBr.iX-m_rangesizeInPixels, m_area.iTl.iY,
+                        m_area.iBr.iX, m_area.iTl.iY+m_rangesizeInPixels) ;
+
+                m_previoustouch = m_startingtouch = puie->CurrentXY() ;
+                m_delta = 0 ;
+                if (lowerleft.Contains(m_startingtouch) || upperright.Contains(m_startingtouch))
+                {
+                    if (m_loggingenabled)
+                    {
+                        LOGARG("CZoomGestureRecogniser: ZOOM IN/OUT, (%d,%d) in %d,%d %d,%d, range: %d",
+                            m_startingtouch.iX, m_startingtouch.iY,
+                            m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY,
+                            m_rangesizeInPixels);
+                    }
+                    m_zooming = true ;
+                    if (lowerleft.Contains(m_startingtouch))
+                    {
+                        m_zoomtype = EZoomIn ;
+                    }
+                    else
+                    {
+                        m_zoomtype = EZoomOut ;
+                    }
+                    state = ELockToThisGesture ;    // keep zooming until release
+                    TTwoPointGesture pgest(KUid, m_startingtouch, m_startingtouch);
+                    pgest.setLogging(m_loggingenabled) ;
+                    pgest.setDetails(m_delta) ;
+                    pgest.setName(m_zoomtype == EZoomIn ? KZoomInName() : KZoomOutName()) ;
+                    pgest.setType(m_zoomtype);
+
+                    // Call the listener to inform that a gesture has happened
+                    m_listener->gestureEnter(pgest) ;
+                }
+                else
+                {
+                    // It is not our gesture so do nothing...
+                }
+            }
+            else
+            {
+                // It is not touch, so not our initiating UI event.. do nothing
+            }
+        }
+        else
+        {
+            // We are already zooming, calculate the changes in zooming factor if it looks we are still zooming
+            if (eventCode == stmUiEventEngine::ERelease) // ERelease stops zooming
+            {
+                // We were zooming, but if there are multiple touches we are not any more
+                m_listener->gestureExit(KUid) ; // should we call this or not?
+            }
+            else    // all other UI events will keep on zooming
+            {
+                state = ELockToThisGesture ;    // Keep the gesture
+                const TPoint& p = puie->CurrentXY() ;
+                float newdist = calculateDistance(p) ;
+                float olddist = calculateDistance(m_previoustouch) ;
+                m_previoustouch = p ;
+                m_delta = adjustZoom(olddist, newdist) ;
+                state = EGestureActive ;
+
+                // Inform listener only if there is something to say
+                if (m_delta != 0)
+                {
+                    TTwoPointGesture pgest = TTwoPointGesture(KUid, p, m_startingtouch);
+                    pgest.setLogging(m_loggingenabled) ;
+                    pgest.setDetails(m_delta) ;
+                    pgest.setName(m_zoomtype == EZoomIn ? KZoomInName() : KZoomOutName()) ;
+                    pgest.setType(m_zoomtype);
+
+                    // Call the listener to inform that a gesture has happened
+                    m_listener->gestureEnter(pgest) ;
+                }
+            }
+        }
+    }
+    else
+    {
+        if (m_zooming)
+        {
+            // We were zooming, but if there are multiple touches we are not any more
+            m_listener->gestureExit(KUid) ; // should we call this or not?
+        }
+        m_zooming = false ;
+    }
+    return state;
+}
+
+void CZoomGestureRecogniser::release(MGestureEngineIf*)
+{
+    if (m_zooming)
+    {
+        m_zooming = false ;
+        m_listener->gestureExit(KUid) ; // should we call this or not?
+    }
+    if (m_loggingenabled)
+    {
+        LOGARG("CZoomGestureRecogniser: 0x%x release", this);
+    }
+}
+
+void CZoomGestureRecogniser::setRange(int rangeInPixels)
+{
+    m_rangesizeInPixels = rangeInPixels ;
+}
+
+void CZoomGestureRecogniser::setArea(const TRect& theArea)
+{
+    m_area = theArea ;
+    if (m_loggingenabled)
+    {
+        LOGARG("CZoomGestureRecogniser: set area, %d,%d %d,%d",
+                m_area.iTl.iX, m_area.iTl.iY, m_area.iBr.iX, m_area.iBr.iY);
+    }
+}
+
+/*!
+ * calculate the distance, return as as float
+ */
+float CZoomGestureRecogniser::calculateDistance(const TPoint& tp)
+{
+    double x = ((m_startingtouch.iX-tp.iX)*(m_startingtouch.iX-tp.iX)) +
+                ((m_startingtouch.iY-tp.iY)*(m_startingtouch.iY-tp.iY)) ;
+    double ddist ;
+    Math::Sqrt(ddist, x) ;
+    return ddist ;
+}
+
+int CZoomGestureRecogniser::adjustZoom(float& aPreviousDistance, float aNewDistance)
+{
+    float diff = aNewDistance - aPreviousDistance ;
+    float logdiff = diff ;
+    if (diff < 0) diff = -diff ;
+    float changePercentage = (diff/aPreviousDistance)*100.f ;
+    if (changePercentage > 10.f)
+    {
+        // change more than 10%, make at most 10%
+        float newdiff = aPreviousDistance*0.1f;
+        if (aPreviousDistance > aNewDistance) newdiff = -newdiff ;
+        if (m_loggingenabled)
+        {
+            LOGARG("CZoomGestureRecogniser: adjust zoom from %f to %f : was, now %f %f",
+                double(logdiff), double(newdiff), double(aPreviousDistance), double(aNewDistance));
+        }
+
+        aPreviousDistance = aPreviousDistance + newdiff ;
+        diff = newdiff ;
+
+    }
+    else
+    {
+        if (m_loggingenabled)
+        {
+            LOGARG("CZoomGestureRecogniser: adjust zoom from %f to %f : was, now %f %f",
+                double(logdiff), double(diff), double(aPreviousDistance), double(aNewDistance));
+        }
+        aPreviousDistance = aNewDistance ;  // accept the new value and update the new length
+        diff = logdiff ;    // put the original back
+    }
+    return (int)diff ;
+}
--- a/webengine/widgetinstaller/Inc/WidgetBackupRegistryXml.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/widgetinstaller/Inc/WidgetBackupRegistryXml.h	Tue Feb 02 00:56:45 2010 +0200
@@ -1,25 +1,23 @@
 /*
-* ==============================================================================
-*  Name        : WidgetRegistryXml.h
-*  Part of     : Widget Registry
-*  Interface   : Widget Registry API
-*  Description : This file contains the header file of the CWidgetBackupRegistryXml class.
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains the header file of the CWidgetBackupRegistryXml class.
 *
 *                This class processes persistent registry data in XML.
-*  Version     : %version: %
 *
-*  Copyright © 2008 Nokia Corporation.
-*  This material, including documentation and any related
-*  computer programs, is protected by copyright controlled by
-*  Nokia Corporation. All rights are reserved. Copying,
-*  including reproducing, storing, adapting or translating, any
-*  or all of this material requires the prior written consent of
-*  Nokia Corporation. This material also contains confidential
-*  information which may not be disclosed to others without the
-*  prior written consent of Nokia Corporation.
-* ==============================================================================
 */
 
+
 #ifndef WIDGETBACKUPREGISTRYXML_H
 #define WIDGETBACKUPREGISTRYXML_H
 
--- a/webengine/widgetinstaller/Src/WidgetBackupRegistryXml.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/widgetinstaller/Src/WidgetBackupRegistryXml.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -1,24 +1,20 @@
-//
-// ==============================================================================
-//  Name        : WidgetBackupRegistryXml.cpp
-//  Part of     : WidgetRegistry
-//  Interface   :
-//  Description : Processes registry persistent data in XML.
-//  Version     : 5.0
-//
-//  Copyright © 2008 Nokia Corporation.
-//  This material, including documentation and any related
-//  computer programs, is protected by copyright controlled by
-//  Nokia Corporation. All rights are reserved. Copying,
-//  including reproducing, storing, adapting or translating, any
-//  or all of this material requires the prior written consent of
-//  Nokia Corporation. This material also contains confidential
-//  information which may not be disclosed to others without the
-//  prior written consent of Nokia Corporation.
-// ==============================================================================
-///
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Processes registry persistent data in XML.
+*
+*/
 
-// INCLUDE FILES
 
 #include <e32base.h>
 #include <f32file.h>
--- a/webengine/widgetregistry/Server/inc/WidgetMMCHandler.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/widgetregistry/Server/inc/WidgetMMCHandler.h	Tue Feb 02 00:56:45 2010 +0200
@@ -1,22 +1,21 @@
 /*
-* ============================================================================
-*  Name        : WidgetMMCHandler.h
-*  Part of     : Widget Registry
-*  Description : Acts on MMC card insertion/removal
-*  Version     : 3.1
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright © 2008 Nokia Corporation.
-*  This material, including documentation and any related
-*  computer programs, is protected by copyright controlled by
-*  Nokia Corporation. All rights are reserved. Copying,
-*  including reproducing, storing, adapting or translating, any
-*  or all of this material requires the prior written consent of
-*  Nokia Corporation. This material also contains confidential
-*  information which may not be disclosed to others without the
-*  prior written consent of Nokia Corporation.
-* =============================================================================
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Acts on MMC card insertion/removal
+*
 */
 
+
 #ifndef WIDGETMMCHANDLER_H
 #define WIDGETMMCHANDLER_H
 
--- a/webengine/widgetregistry/Server/src/WidgetMMCHandler.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/widgetregistry/Server/src/WidgetMMCHandler.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -1,26 +1,22 @@
-//
-// ============================================================================
-//  Name     : WidgetMMCHandler.cpp
-//  Part of  : SW Installer UIs / WidgetInstallerUI
-//
-//  Description: Handle notifications of MMC events.
-//
-//
-//  Version     : 3.1
-//
-//  Copyright © 2006 Nokia Corporation.
-//  This material, including documentation and any related
-//  computer programs, is protected by copyright controlled by
-//  Nokia Corporation. All rights are reserved. Copying,
-//  including reproducing, storing, adapting or translating, any
-//  or all of this material requires the prior written consent of
-//  Nokia Corporation. This material also contains confidential
-//  information which may not be disclosed to others without the
-//  prior written consent of Nokia Corporation.
-// ==============================================================================
-///
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handle notifications of MMC events.
+*
+*
+*
+*/
 
-// INCLUDE FILES
 #include "WidgetMMCHandler.h"
 #include "WidgetRegistry.h"
 
@@ -134,7 +130,7 @@
             LOG1( " iDriveFlags 0x%x", iDriveFlags );
             LOG1( "  driveFlags 0x%x", driveFlags );
             deltaDriveFlags = iDriveFlags ^ driveFlags;
-            iDeltaDriveFlags = deltaDriveFlags;
+            iDeltaDriveFlags |= deltaDriveFlags;
             LOG1( " deltaDriveFlags 0x%x", deltaDriveFlags );
             iDriveFlags = driveFlags;
           }
--- a/webengine/wmlengine/src/xhtml/src/Image/ImageMapPopup.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/wmlengine/src/xhtml/src/Image/ImageMapPopup.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -19,7 +19,7 @@
 
 
 #include "ImageMapPopup.h"
-
+#include <browser_platform_variant.hrh>
 #include <e32math.h>
 #include <apmstd.h>
 #include <bitdev.h>
@@ -317,8 +317,13 @@
 //
 void CImageMapPopup::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
   {
+#ifdef BRDO_SINGLE_CLICK_ENABLED_FF  	
   if(aEventType == MEikListBoxObserver::EEventItemDoubleClicked || 
+     aEventType == MEikListBoxObserver::EEventEnterKeyPressed || aEventType == EEventItemSingleClicked)
+#else
+	if(aEventType == MEikListBoxObserver::EEventItemDoubleClicked || 
      aEventType == MEikListBoxObserver::EEventEnterKeyPressed)
+#endif     	
     {
     AttemptExitL( ETrue );
     }
--- a/webengine/wrtharvester/inc/wrtusbhandler.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/wrtharvester/inc/wrtusbhandler.h	Tue Feb 02 00:56:45 2010 +0200
@@ -1,22 +1,21 @@
 /*
-* ============================================================================
-*  Name        : WrtUsbHandler.h
-*  Part of     : Widget Registry
-*  Description : Acts on MMC card insertion/removal
-*  Version     : 3.1
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright © 2008 Nokia Corporation.
-*  This material, including documentation and any related
-*  computer programs, is protected by copyright controlled by
-*  Nokia Corporation. All rights are reserved. Copying,
-*  including reproducing, storing, adapting or translating, any
-*  or all of this material requires the prior written consent of
-*  Nokia Corporation. This material also contains confidential
-*  information which may not be disclosed to others without the
-*  prior written consent of Nokia Corporation.
-* =============================================================================
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Acts on MMC card insertion/removal
+*
 */
 
+
 #ifndef WIDGETMMCHANDLER_H
 #define WIDGETMMCHANDLER_H
 
--- a/webengine/wrtharvester/rom/wrtharvesterResources.iby	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/wrtharvester/rom/wrtharvesterResources.iby	Tue Feb 02 00:56:45 2010 +0200
@@ -1,22 +1,22 @@
 /*
-* =============================================================================
-*  Name        : wrtharvesterResources.iby
-*  Part of     :  
-*  Description : The resource iby file contains resource that needs to be  
-*                localized for wrtharvester
-*  Version     : %version: 1 % 
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright (c) 2009 Nokia.  All rights reserved.
-*  This material, including documentation and any related computer
-*  programs, is protected by copyright controlled by Nokia.  All
-*  rights are reserved.  Copying, including reproducing, storing,
-*  adapting or translating, any or all of this material requires the
-*  prior written consent of Nokia.  This material also contains
-*  confidential information which may not be disclosed to others
-*  without the prior written consent of Nokia.
-* ============================================================================
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The resource iby file contains resource that needs to be  
+*                localized for wrtharvester
+*
 */
 
+
 #ifndef WRTHARVESTERRESOURCES_IBY
 #define WRTHARVESTERRESOURCES_IBY
 
--- a/webengine/wrtharvester/src/wrtharvesterpsnotifier.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/wrtharvester/src/wrtharvesterpsnotifier.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -154,12 +154,15 @@
             }        
         else if( iKey == EWidgetRegAltered && value == 1 )
             {
-            if(!iHarvester->CanAccessRegistry())
-                {                
-                iHarvester->SetMSMode(0);
-                iHarvester->SetRegistryAccess(ETrue);
+            if(iHarvester->IsInMSMode())
+                {
+                iHarvester->SetRegistryAccess(EFalse);
                 }
-             iHarvester->UpdateL();
+            else
+            	{
+            	iHarvester->SetRegistryAccess(ETrue);
+                } 	
+            iHarvester->UpdateL();
             }
         }
     }
--- a/webengine/wrtharvester/src/wrtusbhandler.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/webengine/wrtharvester/src/wrtusbhandler.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -1,26 +1,22 @@
-//
-// ============================================================================
-//  Name     : WidgetMMCHandler.cpp
-//  Part of  : SW Installer UIs / WidgetInstallerUI
-//
-//  Description: Handle notifications of MMC events.
-//
-//
-//  Version     : 3.1
-//
-//  Copyright © 2006 Nokia Corporation.
-//  This material, including documentation and any related
-//  computer programs, is protected by copyright controlled by
-//  Nokia Corporation. All rights are reserved. Copying,
-//  including reproducing, storing, adapting or translating, any
-//  or all of this material requires the prior written consent of
-//  Nokia Corporation. This material also contains confidential
-//  information which may not be disclosed to others without the
-//  prior written consent of Nokia Corporation.
-// ==============================================================================
-///
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handle notifications of MMC events.
+*
+*
+*
+*/
 
-// INCLUDE FILES
 #include "wrtusbhandler.h"
 #include "wrtharvester.h"
 #include "wrtusbhandler.h"
@@ -170,9 +166,9 @@
                 {
                 // Mass storage was unplugged
                 if(iHarvester->IsInMSMode() == 1)
-                  {            
-                  iHarvester->ClearAllOperations();
-                  iHarvester->SetRegistryAccess(EFalse);
+                  {
+                  iHarvester->SetMSMode(0);	            
+                  iHarvester->ClearAllOperations();                  
                   }
                 }
               }
--- a/widgets/widgetapp/group/WidgetUi.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ b/widgets/widgetapp/group/WidgetUi.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -134,4 +134,9 @@
 #if defined( RD_PF_SEC_APPARC )
 LIBRARY         ServiceHandler.lib
 #endif 
+
+#ifdef BRDO_OCC_ENABLED_FF
+LIBRARY    extendedconnpref.lib
+LIBRARY    netmeta.lib
+#endif
 // End of File
--- a/widgets/widgetapp/inc/WidgetUiNetworkListener.h	Mon Jan 18 21:20:18 2010 +0200
+++ b/widgets/widgetapp/inc/WidgetUiNetworkListener.h	Tue Feb 02 00:56:45 2010 +0200
@@ -1,22 +1,20 @@
-//
-//==============================================================================
-// Name        : WidgetUiNetworkListener.h
-// Part of     : WidgetUI
-// Interface   :
-// Description :
-// Version      : %version: 5.1.1.3.3 %
-//
-// Copyright  2008, 2009 Nokia Corporation.
-// This material, including documentation and any related
-// computer programs, is protected by copyright controlled by
-// Nokia Corporation. All rights are reserved. Copying,
-// including reproducing, storing, adapting or translating, any
-// or all of this material requires the prior written consent of
-// Nokia Corporation. This material also contains confidential
-// information which may not be disclosed to others without the
-// prior written consent of Nokia Corporation.
-//==============================================================================
-//
+/*
+* Copyright (c) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
 
 #ifndef WIDGETUINETWORKLISTENER_H_
 #define WIDGETUINETWORKLISTENER_H_
--- a/widgets/widgetapp/src/WidgetUiNetworkListener.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/widgets/widgetapp/src/WidgetUiNetworkListener.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -1,22 +1,20 @@
-//
-//==============================================================================
-// Name        : WidgetUiNetworkListener.cpp
-// Part of     : WidgetUI
-// Interface   :
-// Description :
-// Version      : %version: 5.1.1.3.3 %
-//
-// Copyright  2008, 2009 Nokia Corporation.
-// This material, including documentation and any related
-// computer programs, is protected by copyright controlled by
-// Nokia Corporation. All rights are reserved. Copying,
-// including reproducing, storing, adapting or translating, any
-// or all of this material requires the prior written consent of
-// Nokia Corporation. This material also contains confidential
-// information which may not be disclosed to others without the
-// prior written consent of Nokia Corporation.
-//==============================================================================
-//
+/*
+* Copyright (c) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
 
 #include "WidgetUiNetworkListener.h"
 
--- a/widgets/widgetapp/src/WidgetUiWindowManager.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/widgets/widgetapp/src/WidgetUiWindowManager.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -46,6 +46,10 @@
 #include <oommonitorsession.h>
 #include <aknglobalnote.h>
 
+#ifdef BRDO_OCC_ENABLED_FF
+#include <extendedconnpref.h>
+#endif
+
 // LOCAL FUNCTION PROTOTYPES
 TInt doDestructOOMNotifyTimer( TAny* ptr );
 TInt doNotifyHarvester( TAny* ptr );
@@ -169,7 +173,12 @@
     iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process());
 
     iDb = CActiveApDb::NewL( EDatabaseTypeIAP );
+    #ifdef BRDO_OCC_ENABLED_FF
+    iConnection = CInternetConnectionManager::NewL( iDb->Database(), ETrue );
+    #else
     iConnection = CInternetConnectionManager::NewL( iDb->Database(), EFalse );
+    #endif
+    
 #ifdef BRDO_WRT_HS_FF    
     iCpsPublisher = CCpsPublisher::NewL();
 #endif
@@ -248,7 +257,7 @@
     wdgt_window->SetWindowStateMiniViewL( EMiniViewEnabled );
 
     // TODO also other states are possible when we should react?
-
+    
     // Removing . Miniview, shall remove full view as well. For blanket permissions
     // will be revoked for miniview
 
--- a/widgets/widgetsidchecker/data/10281FC0.rss	Mon Jan 18 21:20:18 2010 +0200
+++ b/widgets/widgetsidchecker/data/10281FC0.rss	Tue Feb 02 00:56:45 2010 +0200
@@ -15,7 +15,7 @@
 *
 */
 
-#include "registryinfo.rh"
+#include <ecom/registryinfo.rh>
 
 RESOURCE REGISTRY_INFO r_registry
 	{
--- a/widgets/widgetsidchecker/group/widgetsidchecker.mmp	Mon Jan 18 21:20:18 2010 +0200
+++ b/widgets/widgetsidchecker/group/widgetsidchecker.mmp	Tue Feb 02 00:56:45 2010 +0200
@@ -14,6 +14,9 @@
 * Description:  build for widgetsidchecker
 *
 */
+
+#include <platform_paths.hrh>
+
 TARGET widgetsidchecker.dll
 CAPABILITY All -Tcb
 TARGETTYPE plugin
@@ -26,7 +29,8 @@
 
 USERINCLUDE     ../inc
 
-SYSTEMINCLUDE /epoc32/include /epoc32/include/ecom /epoc32/include/platform/mw 
+MW_LAYER_SYSTEMINCLUDE
+
 START RESOURCE ../data/10281FC0.rss
 target widgetsidchecker.rsc
 end
--- a/widgets/widgetsidchecker/src/widgetsidchecker.cpp	Mon Jan 18 21:20:18 2010 +0200
+++ b/widgets/widgetsidchecker/src/widgetsidchecker.cpp	Tue Feb 02 00:56:45 2010 +0200
@@ -18,7 +18,7 @@
 
 #include <e32std.h>
 #include <e32const.h>
-#include <implementationproxy.h>
+#include <ecom/implementationproxy.h>
 #include <f32file.h>
 #include <w32std.h>
 #include <apgtask.h>