From: jungmin76.park Date: Wed, 24 Jul 2013 14:12:36 +0000 (+0900) Subject: fix touch event problem [P130724-4173] X-Git-Tag: submit/tizen/20130912.075546~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f957bc7e107fad515507fad69f680bf752d6478c;p=platform%2Fframework%2Fnative%2Fappwidget-service.git fix touch event problem [P130724-4173] Change-Id: I56b6ed2704dd5e8676b2e508294c347601781fc5 Signed-off-by: jungmin76.park --- diff --git a/inc/FShell_AppWidgetContext.h b/inc/FShell_AppWidgetContext.h index 2d8ef01..3dc6758 100644 --- a/inc/FShell_AppWidgetContext.h +++ b/inc/FShell_AppWidgetContext.h @@ -182,7 +182,7 @@ private: Tizen::Base::Collection::HashMap* pArg; }; - mutable bool __isTouchAvailable; + mutable bool __isRemoteBufferProxyCreated; bool __hasPendingRequest; bool __isForeground; int __width; diff --git a/src/FShell_AppWidgetContext.cpp b/src/FShell_AppWidgetContext.cpp index 35e07ff..06294bb 100644 --- a/src/FShell_AppWidgetContext.cpp +++ b/src/FShell_AppWidgetContext.cpp @@ -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 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; } diff --git a/src/OspAppWidgetService.cpp b/src/OspAppWidgetService.cpp index 286b3e3..1cafb22 100644 --- a/src/OspAppWidgetService.cpp +++ b/src/OspAppWidgetService.cpp @@ -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(pExtraData->GetValue(key)); - AppWidgetManagerService* pSvc = null; - if (pValue) { - std::unique_ptr 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 pIdForCoreDaemon(_StringConverter::CopyToCharArrayN(coreDaemonId)); + pSvc = AppWidgetManagerService::CreateInstance(pIdForCoreDaemon.get()); + AppAssertf(pSvc != null, "AppWidgetManagerService::GetInstance() failed."); + isServiceCreated = true; } }