X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Finput%2Fwindows%2Finput-method-context-impl-win.cpp;h=a26c90a5adc489d72fee72081e9a05ff13f21408;hb=00a21a001e1769942321c0f823f0b4347b99dad4;hp=16df1a5a41e9155f888c2b3bb476ec561146e3e2;hpb=3b72fa2068656331f469979747fac6493d5f9c87;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/input/windows/input-method-context-impl-win.cpp b/dali/internal/input/windows/input-method-context-impl-win.cpp index 16df1a5..a26c90a 100755 --- a/dali/internal/input/windows/input-method-context-impl-win.cpp +++ b/dali/internal/input/windows/input-method-context-impl-win.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,17 +20,17 @@ // EXTERNAL INCLUDES #include -#include #include +#include #include // INTERNAL INCLUDES -#include +#include +#include #include -#include -#include -#include #include +#include +#include namespace Dali { @@ -41,27 +41,20 @@ namespace Internal namespace Adaptor { -InputMethodContextPtr InputMethodContextWin::New() +namespace +{ +#if defined(DEBUG_ENABLED) +Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT" ); +#endif +} + +InputMethodContextPtr InputMethodContextWin::New( Dali::Actor actor ) { InputMethodContextPtr manager; - if ( Adaptor::IsAvailable() ) + if ( actor && Adaptor::IsAvailable() ) { - // Create instance and register singleton only if the adaptor is available - Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) ); - Any nativeWindow = adaptorImpl.GetNativeWindowHandle(); - - // The Win_Window_Handle needs to use the InputMethodContext. - // Only when the render surface is window, we can get the Win_Window_Handle. - WinWindowHandle winWindow( AnyCast(nativeWindow) ); - if ( winWindow ) - { - manager = new InputMethodContextWin( winWindow ); - } - else - { - DALI_LOG_ERROR("Failed to get native window handle\n"); - } + manager = new InputMethodContextWin( actor ); } return manager; @@ -71,13 +64,15 @@ void InputMethodContextWin::Finalize() { } -InputMethodContextWin::InputMethodContextWin( WinWindowHandle winWindow ) -: mWin32Window( winWindow ), +InputMethodContextWin::InputMethodContextWin( Dali::Actor actor ) +: mWin32Window( 0 ), mIMFCursorPosition( 0 ), mSurroundingText(), mRestoreAfterFocusLost( false ), mIdleCallbackConnected( false ) { + + actor.OnSceneSignal().Connect( this, &InputMethodContextWin::OnStaged ); } InputMethodContextWin::~InputMethodContextWin() @@ -148,18 +143,18 @@ void InputMethodContextWin::SetRestoreAfterFocusLost( bool toggle ) * We are still predicting what the user is typing. The latest string is what the InputMethodContext module thinks * the user wants to type. */ -void InputMethodContextWin::PreEditChanged( void*, ImfContext* imfContext, void* event_info ) +void InputMethodContextWin::PreEditChanged( void*, ImfContext* imfContext, void* eventInfo ) { DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::PreEditChanged\n" ); } -void InputMethodContextWin::CommitReceived( void*, ImfContext* imfContext, void* event_info ) +void InputMethodContextWin::CommitReceived( void*, ImfContext* imfContext, void* eventInfo ) { DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::CommitReceived\n" ); if ( Dali::Adaptor::IsAvailable() ) { - const std::string keyString( static_cast( event_info ) ); + const std::string keyString( static_cast( eventInfo ) ); Dali::InputMethodContext handle( this ); Dali::InputMethodContext::EventData eventData( Dali::InputMethodContext::COMMIT, keyString, 0, 0 ); @@ -208,7 +203,7 @@ bool InputMethodContextWin::RetrieveSurrounding( void* data, ImfContext* imfCont * Called when an InputMethodContext delete surrounding event is received. * Here we tell the application that it should delete a certain range. */ -void InputMethodContextWin::DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info ) +void InputMethodContextWin::DeleteSurrounding( void* data, ImfContext* imfContext, void* eventInfo ) { DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::DeleteSurrounding\n" ); } @@ -252,7 +247,7 @@ void InputMethodContextWin::NotifyTextInputMultiLine( bool multiLine ) Dali::InputMethodContext::TextDirection InputMethodContextWin::GetTextDirection() { - Dali::InputMethodContext::TextDirection direction ( Dali::InputMethodContext::LeftToRight ); + Dali::InputMethodContext::TextDirection direction ( Dali::InputMethodContext::LEFT_TO_RIGHT ); return direction; } @@ -335,18 +330,23 @@ std::string InputMethodContextWin::GetInputPanelLocale() return locale; } +void InputMethodContextWin::SetContentMIMETypes( const std::string& mimeTypes ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetContentMIMETypes\n" ); +} + bool InputMethodContextWin::FilterEventKey( const Dali::KeyEvent& keyEvent ) { bool eventHandled( false ); - if ( ! KeyLookup::IsDeviceButton( keyEvent.keyPressedName.c_str() )) + if ( ! KeyLookup::IsDeviceButton( keyEvent.GetKeyName().c_str() )) { //check whether it's key down or key up event - if ( keyEvent.state == KeyEvent::Down ) + if ( keyEvent.GetState() == Dali::KeyEvent::DOWN ) { eventHandled = ProcessEventKeyDown( keyEvent ); } - else if ( keyEvent.state == KeyEvent::Up ) + else if ( keyEvent.GetState() == Dali::KeyEvent::UP ) { eventHandled = ProcessEventKeyUp( keyEvent ); } @@ -355,18 +355,54 @@ bool InputMethodContextWin::FilterEventKey( const Dali::KeyEvent& keyEvent ) return eventHandled; } -bool InputMethodContextWin::ProcessEventKeyDown( const KeyEvent& keyEvent ) +void InputMethodContextWin::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelLanguage\n" ); +} + +Dali::InputMethodContext::InputPanelLanguage InputMethodContextWin::GetInputPanelLanguage() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelLanguage\n" ); + return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC; +} + +void InputMethodContextWin::SetInputPanelPosition( unsigned int x, unsigned int y ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelPosition\n" ); +} + +void InputMethodContextWin::GetPreeditStyle( Dali::InputMethodContext::PreEditAttributeDataContainer& attrs ) const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetPreeditStyle\n" ); + attrs = mPreeditAttrs; +} + +bool InputMethodContextWin::ProcessEventKeyDown( const Dali::KeyEvent& keyEvent ) { bool eventHandled( false ); return eventHandled; } -bool InputMethodContextWin::ProcessEventKeyUp( const KeyEvent& keyEvent ) +bool InputMethodContextWin::ProcessEventKeyUp( const Dali::KeyEvent& keyEvent ) { bool eventHandled( false ); return eventHandled; } +void InputMethodContextWin::OnStaged( Dali::Actor actor ) +{ + WinWindowHandle winWindow( AnyCast< WinWindowHandle >( Dali::Integration::SceneHolder::Get( actor ).GetNativeHandle() ) ); + + if( mWin32Window != winWindow ) + { + mWin32Window = winWindow; + + // Reset + Finalize(); + Initialize(); + } +} + } // Adaptor } // Internal