fix touch event problem [P130724-4173]
authorjungmin76.park <jungmin76.park@samsung.com>
Wed, 24 Jul 2013 14:12:36 +0000 (23:12 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 25 Jul 2013 00:53:49 +0000 (00:53 +0000)
Change-Id: I56b6ed2704dd5e8676b2e508294c347601781fc5
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
inc/FShell_AppWidgetContext.h
src/FShell_AppWidgetContext.cpp
src/OspAppWidgetService.cpp

index 2d8ef01..3dc6758 100644 (file)
@@ -182,7 +182,7 @@ private:
                Tizen::Base::Collection::HashMap* pArg;
        };
 
-       mutable bool __isTouchAvailable;
+       mutable bool __isRemoteBufferProxyCreated;
        bool __hasPendingRequest;
        bool __isForeground;
        int __width;
index 35e07ff..06294bb 100644 (file)
@@ -124,7 +124,7 @@ _AppContext::GetWaitingStatus(void) const
 // _AppWidgetContext class
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 _AppWidgetContext::_AppWidgetContext(_AppContext* pAppContext, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int period, int priority)
-       :__isTouchAvailable(false)
+       :__isRemoteBufferProxyCreated(false)
        ,__hasPendingRequest(false)
        ,__isForeground(true)
        ,__width(width)
@@ -436,7 +436,7 @@ _AppWidgetContext::SendPendingTouchEvent(void)
 void
 _AppWidgetContext::OnTouchEventReceived(buffer_event event, double timestamp, double x, double y)
 {
-       if (__pAppContext->GetConnectionState() == CONNECTION_STATE_CONNECTED && __isTouchAvailable)
+       if (__pAppContext->GetConnectionState() == CONNECTION_STATE_CONNECTED && __isRemoteBufferProxyCreated)
        {
                SysLog(NID_SHELL, "%d, %f, %f", event, x, y);
                AppWidgetManagerService::GetInstance()->SendTouchEvent(GetClientId(), GetInstanceId(), event, timestamp, x, y);
@@ -445,7 +445,8 @@ _AppWidgetContext::OnTouchEventReceived(buffer_event event, double timestamp, do
        {
                __pPendingTouchEventList->Add(new (nothrow) PendingTouchEvent(event, timestamp, x, y));
 
-               if( AppManager::GetInstance()->IsRunning(this->GetAppId() ) == false)
+               if( AppManager::GetInstance()->IsRunning(this->GetAppId() ) == false ||
+                       ( __pAppContext->GetConnectionState() == CONNECTION_STATE_CONNECTED && __isRemoteBufferProxyCreated == false))
                {
                        SysLog(NID_SHELL, "request to start AppControl");
                        std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN() );
@@ -456,7 +457,7 @@ _AppWidgetContext::OnTouchEventReceived(buffer_event event, double timestamp, do
                        pArgs->Add(new (nothrow) String(ARG_KEY_X), new (nothrow) String(Double::ToString(x)));
                        pArgs->Add(new (nothrow) String(ARG_KEY_Y), new (nothrow) String(Double::ToString(y)));
 
-                       SendRequestToApp(GetAppId(), APPWIDGET_ON_TOUCH, pArgs.get());
+                       _AppWidgetRequestHelper::SendAppControlRequest(GetAppId(), APPWIDGET_ON_TOUCH, pArgs.get());
                }
        }
 }
@@ -667,7 +668,7 @@ _AppWidgetContext::OnDisconnected(void)
 {
        SysSecureLog(NID_SHELL, "%ls, %ls", GetInstanceId().GetPointer(), GetProviderId().GetPointer());
 
-       __isTouchAvailable = false;
+       __isRemoteBufferProxyCreated = false;
        if (GetAppWidgetPopup())
        {
                OnPopupDestoyed();
@@ -680,7 +681,7 @@ _AppWidgetContext::AcquireRemoteBuffer(int w, int h) const
        int id = __pAppWidgetRemoteBuffer->Acquire(w, h);
        if (id != -1)
        {
-               __isTouchAvailable = true;
+               __isRemoteBufferProxyCreated = true;
        }
        return id;
 }
index 286b3e3..1cafb22 100644 (file)
@@ -90,25 +90,27 @@ OspAppWidgetService::OnAppControlRequestReceived(RequestId reqId, const Tizen::B
        {
                static bool isServiceCreated = false;
 
-               if (isServiceCreated == false)
+               if (isServiceCreated == true)
+               {
+                       return;
+               }
+
+               AppWidgetManagerService* pSvc = null;
+               String coreDaemonId = "osp-appwidget-service";
+               if (pExtraData)
                {
                        String key(KEY_NAME);
                        const String* pValue = dynamic_cast<const String*>(pExtraData->GetValue(key));
 
-                       AppWidgetManagerService* pSvc = null;
-
                        if (pValue)
                        {
-                               std::unique_ptr<char[]> pIdForCoreDaemon(_StringConverter::CopyToCharArrayN(*pValue));
-                               pSvc = AppWidgetManagerService::CreateInstance(pIdForCoreDaemon.get());
+                               coreDaemonId = *pValue;
                        }
-                       else
-                       {
-                               pSvc = AppWidgetManagerService::CreateInstance("osp-appwidget-service");
-                       }
-                       AppAssertf(pSvc != null, "AppWidgetManagerService::GetInstance() failed.");
-
-                       isServiceCreated = true;
                }
+
+               std::unique_ptr<char[]> pIdForCoreDaemon(_StringConverter::CopyToCharArrayN(coreDaemonId));
+               pSvc = AppWidgetManagerService::CreateInstance(pIdForCoreDaemon.get());
+               AppAssertf(pSvc != null, "AppWidgetManagerService::GetInstance() failed.");
+               isServiceCreated = true;
        }
 }