X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Finput%2Ftizen-wayland%2Finput-method-context-impl-ecore-wl.cpp;h=212c0c928ee3b438a0af41ea02b615cffa05dba4;hb=44ac6b074a4d7d2f9474331a364e4629c0bce11a;hp=b4f71ea87b3d0c553ff64049b060515af37f7f8c;hpb=d82260d6e853c837e430373470ed4a576a2cadc2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp index b4f71ea..212c0c9 100755 --- a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp +++ b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp @@ -23,8 +23,14 @@ #include // EXTERNAL INCLUDES -#include #include + +#ifdef ECORE_WAYLAND2 +#include +#else +#include +#endif + #include #include #include @@ -271,15 +277,11 @@ InputMethodContextPtr InputMethodContextEcoreWl::New() Adaptor &adaptorImpl(Adaptor::GetImplementation(Adaptor::Get())); Any nativeWindow = adaptorImpl.GetNativeWindowHandle(); - // The Ecore_Wl_Window needs to use the InputMethodContext. - // Only when the render surface is window, we can get the Ecore_Wl_Window. - Ecore_Wl_Window *ecoreWwin(AnyCast(nativeWindow)); - if (ecoreWwin) + // The window needs to use the InputMethodContext. + // Only when the render surface is window, we can get the window. + if( !nativeWindow.Empty() ) { - // If we fail to get Ecore_Wl_Window, we can't use the InputMethodContext correctly. - // Thus you have to call "ecore_imf_context_client_window_set" somewhere. - // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent(). - inputMethodContext = new InputMethodContextEcoreWl(ecoreWwin); + inputMethodContext = new InputMethodContextEcoreWl(); } else { @@ -297,9 +299,8 @@ void InputMethodContextEcoreWl::Finalize() DeleteContext(); } -InputMethodContextEcoreWl::InputMethodContextEcoreWl( Ecore_Wl_Window *ecoreWlwin ) +InputMethodContextEcoreWl::InputMethodContextEcoreWl() : mIMFContext(), - mEcoreWlwin( ecoreWlwin ), mIMFCursorPosition( 0 ), mSurroundingText(), mRestoreAfterFocusLost( false ), @@ -316,11 +317,11 @@ InputMethodContextEcoreWl::~InputMethodContextEcoreWl() void InputMethodContextEcoreWl::Initialize() { - CreateContext( mEcoreWlwin ); + CreateContext(); ConnectCallbacks(); } -void InputMethodContextEcoreWl::CreateContext( Ecore_Wl_Window *ecoreWlwin ) +void InputMethodContextEcoreWl::CreateContext() { DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContext::CreateContext\n" ); @@ -331,10 +332,22 @@ void InputMethodContextEcoreWl::CreateContext( Ecore_Wl_Window *ecoreWlwin ) if( mIMFContext ) { + // If we fail to get Ecore_Wl_Window, we can't use the InputMethodContext correctly. + // Thus you have to call "ecore_imf_context_client_window_set" somewhere. + // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent(). + Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) ); + Any nativeWindow = adaptorImpl.GetNativeWindowHandle(); + +#ifdef ECORE_WAYLAND2 + Ecore_Wl2_Window* ecoreWlwin( AnyCast< Ecore_Wl2_Window* >( nativeWindow ) ); + int windowId = ecore_wl2_window_id_get( ecoreWlwin ); +#else + Ecore_Wl_Window* ecoreWlwin( AnyCast< Ecore_Wl_Window* >( nativeWindow ) ); + int windowId = ecore_wl_window_id_get( ecoreWlwin ); +#endif if( ecoreWlwin ) { - ecore_imf_context_client_window_set( mIMFContext, - reinterpret_cast( ecore_wl_window_id_get(ecoreWlwin)) ); + ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast< void* >( windowId ) ); } } else