From 5a8ff5dbaf7ba99789aac1350387267f2dde5d2f Mon Sep 17 00:00:00 2001 From: woojin nam Date: Fri, 28 Jun 2013 13:33:30 +0000 Subject: [PATCH] Revert "Revert "[N_SE-40957] Set 'transient_for' from the keyboard settings to the target window." This reverts commit 8d91bd8cf6477c6a6028fe72b3c25b45bce6ddc7" This reverts commit e4005345e929ce83b99b60ac6b8512ef6de9ea9b Change-Id: I852c4242bc9de64fa672b0c8bb8deabfe1a03642 --- src/app/FApp_UiAppImpl.cpp | 72 ++++++++++++++++++++++++++++++++++++++++++-- src/app/inc/FApp_UiAppImpl.h | 2 ++ 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/src/app/FApp_UiAppImpl.cpp b/src/app/FApp_UiAppImpl.cpp index 9097615..0ab942b 100755 --- a/src/app/FApp_UiAppImpl.cpp +++ b/src/app/FApp_UiAppImpl.cpp @@ -20,9 +20,12 @@ * @brief This is the implementation for the _UiAppImpl class. */ -#include #include +#include +#include #include +#include +#include #include #include @@ -119,6 +122,57 @@ _UiAppImpl::RaiseFrame(Frame& frame) } +long +_UiAppImpl::GetTargetWindowHandle(void) const +{ + result r = E_SUCCESS; + + _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr(); + r = GetLastResult(); + SysTryReturn(NID_APP, pEcoreEvasMgr, -1, r, "Propagating."); + + _EcoreEvas* pEcoreEvas = pEcoreEvasMgr->GetEcoreEvas(); + r = GetLastResult(); + SysTryReturn(NID_APP, pEcoreEvas, -1, r, "Propagating."); + + Atom actualTypeReturn; + int actualFormatReturn; + unsigned long nItemsReturn; + unsigned long bytesAfterReturn; + unsigned char* pPropReturn = null; + + gint ret = 0; + ret = XGetWindowProperty(static_cast(ecore_x_display_get()), + ecore_x_window_root_get(pEcoreEvas->GetXWindow()), + ecore_x_atom_get("_ISF_ACTIVE_WINDOW"), + 0, + G_MAXLONG, + false, + XA_WINDOW, + &actualTypeReturn, + &actualFormatReturn, + &nItemsReturn, + &bytesAfterReturn, + &pPropReturn); + SysTryReturn(NID_APP, ret == Success, -1, E_SYSTEM, "A failure occurs from the underlying system."); + + Ecore_X_Window targetWindow = 0; + + if (pPropReturn) + { + if (actualTypeReturn == XA_WINDOW) + { + targetWindow = *(reinterpret_cast(pPropReturn)); + SysLog(NID_APP, "The handle of the target window is %x.", targetWindow); + } + + XFree(pPropReturn); + } + + return targetWindow? targetWindow: -1; +} + + static int TransientResponseCb(void* pData) { @@ -285,8 +339,20 @@ _UiAppImpl::OnFrameRaiseRequested(void) long _UiAppImpl::OnWindowHandleRequest(void) { - const _EcoreEvas* const pEvas = GetEcoreEvasMgr()->GetEcoreEvas(); - return (pEvas) ? static_cast(pEvas->GetXWindow()) : -1; + long handle = -1; + int type = _AppInfo::GetAppType(); + + if (type & _APP_TYPE_IME_APP) + { + handle = GetTargetWindowHandle(); + } + else + { + const _EcoreEvas* const pEvas = GetEcoreEvasMgr()->GetEcoreEvas(); + handle = (pEvas) ? static_cast(pEvas->GetXWindow()) : -1; + } + + return handle; } diff --git a/src/app/inc/FApp_UiAppImpl.h b/src/app/inc/FApp_UiAppImpl.h index 5c6c7c9..0546e1d 100755 --- a/src/app/inc/FApp_UiAppImpl.h +++ b/src/app/inc/FApp_UiAppImpl.h @@ -311,6 +311,8 @@ private: */ void RaiseFrame(Tizen::Ui::Controls::Frame& frame); + long GetTargetWindowHandle(void) const; + private: static _UiAppImpl* __pUiAppImpl; -- 2.7.4