From: Richard Huang Date: Wed, 26 Feb 2020 17:40:38 +0000 (+0000) Subject: Revert "Support multiple scenes in EvasPlugin" X-Git-Tag: dali_1.9.3~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F91%2F226091%2F1;p=platform%2Fcore%2Fuifw%2Fdali-extension.git Revert "Support multiple scenes in EvasPlugin" This reverts commit 2905e7aa90b829d08a2e4aedcc2a69e5bd529b87. Change-Id: I596cb973f201911580ce6ead150a0a6cedd1f5fb --- diff --git a/dali-extension/dali-extension.h b/dali-extension/dali-extension.h index 3d634aa..762dd96 100644 --- a/dali-extension/dali-extension.h +++ b/dali-extension/dali-extension.h @@ -1,5 +1,5 @@ -#ifndef DALI_EXTENSION_H -#define DALI_EXTENSION_H +#ifndef __DALI_EXTENSION_H__ +#define __DALI_EXTENSION_H__ /* * Copyright (c) 2019 Samsung Electronics Co., Ltd. @@ -19,6 +19,5 @@ */ #include -#include -#endif // DALI_EXTENSION_H +#endif // __DALI_EXTENSION_H__ diff --git a/dali-extension/devel-api/evas-plugin/evas-plugin.cpp b/dali-extension/devel-api/evas-plugin/evas-plugin.cpp index 59dc322..30219a5 100755 --- a/dali-extension/devel-api/evas-plugin/evas-plugin.cpp +++ b/dali-extension/devel-api/evas-plugin/evas-plugin.cpp @@ -31,8 +31,13 @@ EvasPlugin EvasPlugin::New( Evas_Object* parentEvasObject, int width, int height { IntrusivePtr< Internal::EvasPlugin > impl = Internal::EvasPlugin::New( parentEvasObject, width, height, isTranslucent ); + // When Initialize(), EvasPlugin creates Adaptor which needs BaseHandle of Internal::EvasPlugin. + // In that process, EvasPlugin can be deleted when destroying BaseHandle + // so it is needed to count reference before calling Initialize() EvasPlugin evasPlugin = EvasPlugin( impl.Get() ); + impl->Initialize(); + return evasPlugin; } @@ -41,7 +46,7 @@ EvasPlugin::EvasPlugin() } EvasPlugin::EvasPlugin( const EvasPlugin& evasPlugin ) -: BaseHandle( evasPlugin ) +: SceneHolder( evasPlugin ) { } @@ -78,11 +83,6 @@ void EvasPlugin::Stop() Internal::GetImplementation( *this ).Stop(); } -Scene EvasPlugin::GetDefaultScene() -{ - return Internal::GetImplementation( *this ).GetDefaultScene(); -} - Evas_Object* EvasPlugin::GetAccessEvasObject() { return Internal::GetImplementation( *this ).GetAccessEvasObject(); @@ -129,7 +129,7 @@ EvasPlugin::EvasPluginSignalType& EvasPlugin::UnFocusedSignal() } EvasPlugin::EvasPlugin( Internal::EvasPlugin* evasPlugin ) -: BaseHandle( evasPlugin ) +: SceneHolder( evasPlugin ) { } diff --git a/dali-extension/devel-api/evas-plugin/evas-plugin.h b/dali-extension/devel-api/evas-plugin/evas-plugin.h index d07f5df..bdd964e 100644 --- a/dali-extension/devel-api/evas-plugin/evas-plugin.h +++ b/dali-extension/devel-api/evas-plugin/evas-plugin.h @@ -1,8 +1,8 @@ -#ifndef DALI_EXTENSION_EVAS_PLUGIN_H -#define DALI_EXTENSION_EVAS_PLUGIN_H +#ifndef __DALI_EXTENSION_EVAS_PLUGIN_H__ +#define __DALI_EXTENSION_EVAS_PLUGIN_H__ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -27,6 +27,7 @@ #include #include +#include namespace Dali { @@ -34,8 +35,6 @@ namespace Dali namespace Extension { -class Scene; - namespace Internal { class EvasPlugin; @@ -91,8 +90,8 @@ class EvasPlugin; * * void OnInitialize() * { - * Scene scene = mEvasPlugin.GetDefaultScene(); - * scene.SetBackgroundColor( Color::WHITE ); + * Stage stage = Stage::GetCurrent(); + * stage.SetBackgroundColor( Color::WHITE ); * * TextLabel textLabel = TextLabel::New( "Hello World" ); * textLabel.SetParentOrigin( ParentOrigin::CENTER ); @@ -100,7 +99,7 @@ class EvasPlugin; * textLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::CENTER ); * textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 40 ); * textLabel.SetName( "helloWorldLabel" ); - * scene.Add( textLabel ); + * stage.Add( textLabel ); * * Animation anim = Animation::New( 3.f ); * anim.SetLooping( true ); @@ -195,7 +194,7 @@ class EvasPlugin; * * @endcode */ -class DALI_IMPORT_API EvasPlugin : public Dali::BaseHandle +class DALI_IMPORT_API EvasPlugin : public Dali::Integration::SceneHolder { public: @@ -204,11 +203,11 @@ public: public: /** - * @brief This is the constructor of EvasPlugin for Tizen EFL applications + * @brief This is the constructor for Tizen EFL applications * - * @param[in] parentEvasObject Parent Evas object of the default scene - * @param[in] width The initial width of the default scene - * @param[in] height The initial height of the default scene + * @param[in] parentEvasObject Parent of the new Evas object + * @param[in] width The initial width of the Dali view port + * @param[in] height The initial height of the Dali view port * @param[in] isTranslucent Whether the Evas object is translucent or not */ static EvasPlugin New( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ); @@ -241,13 +240,11 @@ public: void Run(); /** - * @note DEPRECATED. Instead, hide corresponding Evas object. * @brief Pauses the Evas plugin */ void Pause(); /** - * @note DEPRECATED. Instead, show corresponding Evas object. * @brief Resumes the Evas plugin */ void Resume(); @@ -257,17 +254,8 @@ public: */ void Stop(); - - /** - * @brief Get the default Scene handle - * @return The default Scene - */ - Scene GetDefaultScene(); - /** - * @note DEPRECATED. This is same as evasPlugin.GetDefaultScene().GetAccessEvasObject() - * - * @brief This returns the Evas_Object* for accessibility which is created internally + * @brief This returns the Evas_Object* which is created internally * * Applications should append this access object to custom focus chain for accessibility * @@ -278,8 +266,6 @@ public: Evas_Object* GetAccessEvasObject(); /** - * @note DEPRECATED. This is same as evasPlugin.GetDefaultScene().GetDaliEvasObject() - * * @brief This returns the Evas_Object* which is created internally * * @return Evas_Object* Evas object which is rendered by Dali @@ -291,8 +277,6 @@ public: // Signals /** * @brief Signal to notify the client when the application is ready to be initialized * - * @note EvasPlugin::Run() should be called to be initialized - * * @return The signal */ EvasPluginSignalType& InitSignal(); @@ -305,7 +289,6 @@ public: // Signals EvasPluginSignalType& TerminateSignal(); /** - * @note DEPRECATED * @brief Signal to notify the client when the EvasPlugin is about to be paused * * The user should connect to this signal if the user needs to perform any special @@ -315,7 +298,6 @@ public: // Signals EvasPluginSignalType& PauseSignal(); /** - * @note DEPRECATED * @brief Signal to notify the client when the adpator has resumed * * The user should connect to this signal if the user needs to perform any special @@ -325,8 +307,6 @@ public: // Signals EvasPluginSignalType& ResumeSignal(); /** - * @note DEPRECATED. Use Scene::ResizedSignal() - * * @brief Signal to notify the client when the Evas object is resized * * @return The signal @@ -334,8 +314,6 @@ public: // Signals EvasPluginSignalType& ResizeSignal(); /** - * @note DEPRECATED. Use Scene::FocusChangedSignal() - * * @brief Signal to notify the client when the Evas object gets the keyboard focus * * @return The signal @@ -343,8 +321,6 @@ public: // Signals EvasPluginSignalType& FocusedSignal(); /** - * @note DEPRECATED. Use Scene::FocusChangedSignal() - * * @brief Signal to notify the client when the Evas object loses the keyboard focus * * @return The signal @@ -367,4 +343,4 @@ public: // Not intended for application developers } // namespace Dali -#endif // DALI_EXTENSION_EVAS_PLUGIN_H +#endif // __DALI_EXTENSION_EVAS_PLUGIN_H__ diff --git a/dali-extension/devel-api/evas-plugin/file.list b/dali-extension/devel-api/evas-plugin/file.list index 24958c9..7796046 100644 --- a/dali-extension/devel-api/evas-plugin/file.list +++ b/dali-extension/devel-api/evas-plugin/file.list @@ -1,7 +1,5 @@ evas_plugin_devel_header_files = \ - $(extension_src_dir)/devel-api/evas-plugin/evas-plugin.h \ - $(extension_src_dir)/devel-api/evas-plugin/scene.h + $(extension_src_dir)/devel-api/evas-plugin/evas-plugin.h evas_plugin_devel_src_files = \ - $(extension_src_dir)/devel-api/evas-plugin/evas-plugin.cpp \ - $(extension_src_dir)/devel-api/evas-plugin/scene.cpp + $(extension_src_dir)/devel-api/evas-plugin/evas-plugin.cpp diff --git a/dali-extension/devel-api/evas-plugin/scene.cpp b/dali-extension/devel-api/evas-plugin/scene.cpp deleted file mode 100644 index ba64246..0000000 --- a/dali-extension/devel-api/evas-plugin/scene.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTENRAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include - -// CLASS HEADER -#include - -namespace Dali -{ - -namespace Extension -{ - -Scene Scene::New( EvasPlugin evasPlugin, Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ) -{ - IntrusivePtr< Internal::Scene > impl = Internal::Scene::New( parentEvasObject, width, height, isTranslucent ); - - Scene scene = Scene( impl.Get() ); - - impl->Initialize( &Internal::GetImplementation( evasPlugin ), false ); - - return scene; -} - -Scene::Scene() -{ -} - -Scene::Scene( const Scene& scene ) -: BaseHandle( scene ) -{ -} - -Scene& Scene::operator=( const Scene& scene ) -{ - if( *this != scene ) - { - BaseHandle::operator=( scene ); - } - return *this; -} - -Scene::~Scene() -{ -} - -void Scene::Add( Actor actor ) -{ - Internal::GetImplementation( *this ).Add( actor ); -} - -void Scene::Remove( Actor actor ) -{ - Internal::GetImplementation( *this ).Remove( actor ); -} - -void Scene::SetBackgroundColor( const Vector4& color ) -{ - Internal::GetImplementation( *this ).SetBackgroundColor( color ); -} - -Vector4 Scene::GetBackgroundColor() const -{ - return Internal::GetImplementation( *this ).GetBackgroundColor(); -} - -Layer Scene::GetRootLayer() const -{ - return Internal::GetImplementation( *this ).GetRootLayer(); -} - -uint32_t Scene::GetLayerCount() const -{ - return Internal::GetImplementation( *this ).GetLayerCount(); -} - -Layer Scene::GetLayer( uint32_t depth ) const -{ - return Internal::GetImplementation( *this ).GetLayer( depth ); -} - -Size Scene::GetSize() const -{ - return Internal::GetImplementation( *this ).GetSize(); -} - -Evas_Object* Scene::GetAccessEvasObject() -{ - return Internal::GetImplementation( *this ).GetAccessEvasObject(); -} - -Evas_Object* Scene::GetDaliEvasObject() -{ - return Internal::GetImplementation( *this ).GetDaliEvasObject(); -} - -Scene::ResizedSignalType& Scene::ResizedSignal() -{ - return Internal::GetImplementation( *this ).ResizedSignal(); -} - -Scene::VisibilityChangedSignalType& Scene::VisibilityChangedSignal() -{ - return Internal::GetImplementation( *this ).VisibilityChangedSignal(); -} - -Scene::FocusChangedSignalType& Scene::FocusChangedSignal() -{ - return Internal::GetImplementation( *this ).FocusChangedSignal(); -} - -Scene::Scene( Internal::Scene* scene ) -: BaseHandle( scene ) -{ -} - -} // namespace Extension - -} // namespace Dali diff --git a/dali-extension/devel-api/evas-plugin/scene.h b/dali-extension/devel-api/evas-plugin/scene.h deleted file mode 100644 index fd02dc6..0000000 --- a/dali-extension/devel-api/evas-plugin/scene.h +++ /dev/null @@ -1,237 +0,0 @@ -#ifndef DALI_EXTENSION_SCENE_H -#define DALI_EXTENSION_SCENE_H - -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/** - * @addtogroup CAPI_DALI_EXTENSION_FRAMEWORK_MODULE - * @{ - */ - -// EXTERNAL INCLUDES -#include - -#include -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -class Layer; - -namespace Extension -{ - -namespace Internal -{ -class Scene; -} - -/** - * @brief Like EvasPlugin is an Application class used by EFL applications, - * the Scene corresponds to the Window class. - * - * | DALi | EFL with DALi | - * |---------------|-------------------| - * | Application | EvasPlugin | - * | Window | Scene | - * - * When the EvasPlugin is created, a Scene is generated by default, it is called "default scene". - * You can get it by calling EvasPlugin::GetDefaultScene(). - * - * Also, the EvasPlugin can have multiple scenes. - * You can create a new Scene by calling Scene::New(...); - */ -class DALI_IMPORT_API Scene : public Dali::BaseHandle -{ -public: - - typedef Signal VisibilityChangedSignalType; - - typedef Signal FocusChangedSignalType; - - typedef Signal ResizedSignalType; - -public: - - /** - * @brief Creates an initialized handle to a new Scene - * @note You should hold the returned handle. If you missed the handle, the scene will be released - * - * @param[in] evasPlugin The EvasPlugin handle - * @param[in] parentEvasObject Parent Evas object of the new scene - * @param[in] width The initial width of the scene - * @param[in] height The initial height of the scene - * @param[in] isTranslucent Whether the Evas object is translucent or not - */ - static Scene New( EvasPlugin evasPlugin, Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ); - - /** - * @brief Constructs an empty handle - */ - Scene(); - - /** - * @brief Copy constructor - */ - Scene( const Scene& scene ); - - /** - * @brief Assignment operator - */ - Scene& operator=( const Scene& scene ); - - /** - * @brief Destructor - */ - ~Scene(); - -public: - /** - * @brief Adds a child Actor to the Scene. - * - * The child will be referenced. - * - * @param[in] actor The child - * @pre The actor has been initialized. - * @pre The actor does not have a parent. - */ - void Add( Actor actor ); - - /** - * @brief Removes a child Actor from the Scene. - * - * The child will be unreferenced. - * - * @param[in] actor The child - * @pre The actor has been added to the Scene. - */ - void Remove( Actor actor ); - - /** - * @brief Sets the background color of the Scene. - * - * @param[in] color The new background color - */ - void SetBackgroundColor( const Vector4& color ); - - /** - * @brief Gets the background color of the Scene. - * - * @return The background color - */ - Vector4 GetBackgroundColor() const; - - /** - * @brief Returns the root Layer of the Scene. - * - * @return The root layer - */ - Layer GetRootLayer() const; - - /** - * @brief Queries the number of on-scene layers. - * - * Note that a default layer is always provided (count >= 1). - * - * @return The number of layers - */ - uint32_t GetLayerCount() const; - - /** - * @brief Retrieves the layer at a specified depth in the Scene. - * - * @SINCE_1_4.19 - * @param[in] depth The depth - * @return The layer found at the given depth - * @pre Depth is less than layer count; see GetLayerCount(). - */ - Layer GetLayer( uint32_t depth ) const; - - /** - * @brief Returns the size of the Scene in pixels as a Vector. - * - * The x component will be the width of the Scene in pixels. - * The y component will be the height of the Scene in pixels. - * - * @return The size of the Scene as a Vector - */ - Size GetSize() const; - - /** - * @brief This returns the Evas_Object* for accessibility which is created internally - * - * Applications should append this access object to custom focus chain for accessibility - * - * e.g., elm_object_focus_custom_chain_append(layout, dali_access_object, NULL); - * - * @return Evas_Object* Elm access object which Dali image Evas object is registered - */ - Evas_Object* GetAccessEvasObject(); - - /** - * @brief This returns the Evas_Object* which is created internally - * - * @return Evas_Object* Evas object which is rendered by Dali - */ - Evas_Object* GetDaliEvasObject(); - -public: // Signals - - /** - * @brief Signal to notify the client when the Evas object's visibility is changed - * - * @return The signal - */ - VisibilityChangedSignalType& VisibilityChangedSignal(); - - /** - * @brief Signal to notify the client when the Evas object is resized - * - * @return The signal - */ - ResizedSignalType& ResizedSignal(); - - /** - * @brief Signal to notify the client when the Evas object gets/loses the keyboard focus - * - * @return The signal - */ - FocusChangedSignalType& FocusChangedSignal(); - -public: // Not intended for application developers - - /** - * @brief Internal constructor - */ - explicit DALI_INTERNAL Scene( Internal::Scene* scene ); - -}; - -/** - * @} - */ - -} // namespace Extension - -} // namespace Dali - -#endif // DALI_EXTENSION_SCENE_H diff --git a/dali-extension/internal/evas-plugin/evas-event-handler.cpp b/dali-extension/internal/evas-plugin/evas-event-handler.cpp index 1909df5..6445a25 100644 --- a/dali-extension/internal/evas-plugin/evas-event-handler.cpp +++ b/dali-extension/internal/evas-plugin/evas-event-handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright ( c ) 2020 Samsung Electronics Co., Ltd. + * Copyright ( c ) 2019 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. @@ -440,66 +440,60 @@ void FillIntegrationKeyEvent( Type keyEvent, Integration::KeyEvent& result ) } // anonymous namespace -EvasEventHandler::EvasEventHandler( EvasEventInterface& evasEventInterface ) -: mEvasEventInterface( evasEventInterface ) +EvasPluginEventHandler::EvasPluginEventHandler( EvasPluginEventInterface& evasPluginEventInterface ) +: mEvasPluginEventInterface( evasPluginEventInterface ) { - EvasWrapper* evasWrapper = mEvasEventInterface.GetEvasWrapper(); + EvasWrapper* evasWrapper = mEvasPluginEventInterface.GetEvasWrapper(); Evas_Object* renderTarget = evasWrapper->GetRenderTarget(); Evas_Object* accessibilityTarget = evasWrapper->GetAccessibilityTarget(); Evas_Object* focusTarget = evasWrapper->GetFocusTarget(); Evas* renderTargetAsEvas = evas_object_evas_get( renderTarget ); // Register the evas event callbacks - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_DOWN, OnEvasObjectMouseDown, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_UP, OnEvasObjectMouseUp, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_MOVE, OnEvasObjectMouseMove, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_WHEEL, OnEvasObjectMouseWheel, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_DOWN, OnEvasObjectMultiTouchDown, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_UP, OnEvasObjectMultiTouchUp, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_MOVE, OnEvasObjectMultiTouchMove, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_KEY_DOWN, OnEvasObjectKeyDown, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_KEY_UP, OnEvasObjectKeyUp, &evasEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_DOWN, OnEvasObjectMouseDown, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_UP, OnEvasObjectMouseUp, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_MOVE, OnEvasObjectMouseMove, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_WHEEL, OnEvasObjectMouseWheel, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_DOWN, OnEvasObjectMultiTouchDown, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_UP, OnEvasObjectMultiTouchUp, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_MOVE, OnEvasObjectMultiTouchMove, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_KEY_DOWN, OnEvasObjectKeyDown, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_KEY_UP, OnEvasObjectKeyUp, &evasPluginEventInterface ); // Register the evas geometry callbacks - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOVE, OnEvasObjectMove, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_RESIZE, OnEvasObjectResize, &evasEventInterface ); - - // Register the evas visibility callbacks - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_SHOW, OnEvasObjectShow, &evasEventInterface ); - evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_HIDE, OnEvasObjectHide, &evasEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOVE, OnEvasObjectMove, &evasPluginEventInterface ); + evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_RESIZE, OnEvasObjectResize, &evasPluginEventInterface ); // Register the evas focus callbacks evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_FOCUS_IN, OnEvasObjectFocusIn, this ); evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_FOCUS_OUT, OnEvasObjectFocusOut, this ); - evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_CANVAS_FOCUS_IN, OnEvasFocusIn, &evasEventInterface ); - evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, OnEvasFocusOut, &evasEventInterface ); + evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_CANVAS_FOCUS_IN, OnEvasFocusIn, &evasPluginEventInterface ); + evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, OnEvasFocusOut, &evasPluginEventInterface ); // Register the evas render callbacks - evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_RENDER_POST, OnEvasRenderPost, &evasEventInterface ); + evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_RENDER_POST, OnEvasRenderPost, &evasPluginEventInterface ); // Register the elm access action callbacks and these callbacks are disconnected when mElmAccessEvasObject is unregistred - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT, OnElmAccessActionHighlight, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_UNHIGHLIGHT, OnElmAccessActionUnhighlight, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, OnElmAccessActionHighlightNext, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, OnElmAccessActionHighlightPrev, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_ACTIVATE, OnElmAccessActionActivate, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_UP, OnElmAccessActionUp, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_DOWN, OnElmAccessActionDown, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_SCROLL, OnElmAccessActionScroll, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_BACK, OnElmAccessActionBack, &evasEventInterface ); - elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_READ, OnElmAccessActionRead, &evasEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT, OnElmAccessActionHighlight, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_UNHIGHLIGHT, OnElmAccessActionUnhighlight, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, OnElmAccessActionHighlightNext, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, OnElmAccessActionHighlightPrev, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_ACTIVATE, OnElmAccessActionActivate, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_UP, OnElmAccessActionUp, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_DOWN, OnElmAccessActionDown, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_SCROLL, OnElmAccessActionScroll, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_BACK, OnElmAccessActionBack, &evasPluginEventInterface ); + elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_READ, OnElmAccessActionRead, &evasPluginEventInterface ); // Register the elm focus callbacks evas_object_smart_callback_add( focusTarget, EVAS_OBJECT_FOCUSED_EVENT_NAME, OnEvasObjectSmartFocused, this ); evas_object_smart_callback_add( focusTarget, EVAS_OBJECT_UNFOCUSED_EVENT_NAME, OnEvasObjectSmartUnfocused, this ); - - EnableEcoreWl2Events(); } -EvasEventHandler::~EvasEventHandler() +EvasPluginEventHandler::~EvasPluginEventHandler() { - EvasWrapper* evasWrapper = mEvasEventInterface.GetEvasWrapper(); + EvasWrapper* evasWrapper = mEvasPluginEventInterface.GetEvasWrapper(); Evas_Object* renderTarget = evasWrapper->GetRenderTarget(); Evas_Object* focusTarget = evasWrapper->GetFocusTarget(); Evas* renderTargetAsEvas = evas_object_evas_get( renderTarget ); @@ -519,10 +513,6 @@ EvasEventHandler::~EvasEventHandler() evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_MOVE, OnEvasObjectMove ); evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_RESIZE, OnEvasObjectResize ); - // Unregister the evas visibility callbacks - evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_SHOW, OnEvasObjectShow ); - evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_HIDE, OnEvasObjectHide ); - // Unregister the evas focus callbacks evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_FOCUS_IN, OnEvasObjectFocusIn ); evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_FOCUS_OUT, OnEvasObjectFocusOut ); @@ -536,20 +526,18 @@ EvasEventHandler::~EvasEventHandler() // Unregister the elm focus callbacks evas_object_smart_callback_del( focusTarget, EVAS_OBJECT_FOCUSED_EVENT_NAME, OnEvasObjectSmartFocused ); evas_object_smart_callback_del( focusTarget, EVAS_OBJECT_UNFOCUSED_EVENT_NAME, OnEvasObjectSmartUnfocused ); - - DisableEcoreWl2Events(); } -void EvasEventHandler::EnableEcoreWl2Events() +void EvasPluginEventHandler::EnableEcoreWl2Events() { if( !mEcoreEventHandlers.size() ) { // Register Window visibility change events - mEcoreEventHandlers.push_back( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, OnEcoreWl2EventWindowVisibilityChange, &mEvasEventInterface ) ); + mEcoreEventHandlers.push_back( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, OnEcoreWl2EventWindowVisibilityChange, &mEvasPluginEventInterface ) ); } } -void EvasEventHandler::DisableEcoreWl2Events() +void EvasPluginEventHandler::DisableEcoreWl2Events() { if( mEcoreEventHandlers.size() ) { @@ -566,7 +554,7 @@ void EvasEventHandler::DisableEcoreWl2Events() // Event callbacks ///////////////////////////////////////////////////////////////////////////////////////////////////// -void EvasEventHandler::OnEvasObjectMouseDown( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectMouseDown( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Mouse_Down* eventMouseDown = static_cast( event ); @@ -580,11 +568,11 @@ void EvasEventHandler::OnEvasObjectMouseDown( void *data, Evas* evas, Evas_Objec timeStamp = GetCurrentMilliSeconds(); } - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectTouchEvent( point, timeStamp ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp ); } -void EvasEventHandler::OnEvasObjectMouseUp( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectMouseUp( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Mouse_Up* eventMouseUp = static_cast( event ); @@ -598,11 +586,11 @@ void EvasEventHandler::OnEvasObjectMouseUp( void *data, Evas* evas, Evas_Object* timeStamp = GetCurrentMilliSeconds(); } - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectTouchEvent( point, timeStamp ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp ); } -void EvasEventHandler::OnEvasObjectMouseMove( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectMouseMove( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Mouse_Move* eventMouseMove = static_cast( event ); @@ -616,11 +604,11 @@ void EvasEventHandler::OnEvasObjectMouseMove( void *data, Evas* evas, Evas_Objec timeStamp = GetCurrentMilliSeconds(); } - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectTouchEvent( point, timeStamp ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp ); } -void EvasEventHandler::OnEvasObjectMouseWheel( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectMouseWheel( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Mouse_Wheel* eventMouseWheel = static_cast( event ); @@ -639,11 +627,11 @@ void EvasEventHandler::OnEvasObjectMouseWheel( void *data, Evas* evas, Evas_Obje Dali::Integration::WheelEvent wheelEvent( Dali::Integration::WheelEvent::MOUSE_WHEEL, direction, modifiers, point, z, timeStamp ); - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectWheelEvent( wheelEvent ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectWheelEvent( wheelEvent ); } -void EvasEventHandler::OnEvasObjectMultiTouchDown( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectMultiTouchDown( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Multi_Down* eventMultiDown = static_cast( event ); @@ -657,11 +645,11 @@ void EvasEventHandler::OnEvasObjectMultiTouchDown( void *data, Evas* evas, Evas_ timeStamp = GetCurrentMilliSeconds(); } - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectTouchEvent( point, timeStamp ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp ); } -void EvasEventHandler::OnEvasObjectMultiTouchUp( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectMultiTouchUp( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Multi_Up* eventMultiUp = static_cast( event ); @@ -675,11 +663,11 @@ void EvasEventHandler::OnEvasObjectMultiTouchUp( void *data, Evas* evas, Evas_Ob timeStamp = GetCurrentMilliSeconds(); } - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectTouchEvent( point, timeStamp ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp ); } -void EvasEventHandler::OnEvasObjectMultiTouchMove( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectMultiTouchMove( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Multi_Move* eventMultiMove = static_cast( event ); @@ -693,11 +681,11 @@ void EvasEventHandler::OnEvasObjectMultiTouchMove( void *data, Evas* evas, Evas_ timeStamp = GetCurrentMilliSeconds(); } - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectTouchEvent( point, timeStamp ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp ); } -void EvasEventHandler::OnEvasObjectKeyDown( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectKeyDown( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Key_Down* keyEvent = static_cast( event ); @@ -709,10 +697,10 @@ void EvasEventHandler::OnEvasObjectKeyDown( void *data, Evas* evas, Evas_Object* FillIntegrationKeyEvent( keyEvent, integKeyEvent ); // Feed to EvasPlugin - ( static_cast( data ) )->OnEvasObjectKeyEvent( integKeyEvent ); + ( static_cast( data ) )->OnEvasObjectKeyEvent( integKeyEvent ); } -void EvasEventHandler::OnEvasObjectKeyUp( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectKeyUp( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Evas_Event_Key_Up* keyEvent = static_cast( event ); @@ -724,70 +712,56 @@ void EvasEventHandler::OnEvasObjectKeyUp( void *data, Evas* evas, Evas_Object* e FillIntegrationKeyEvent( keyEvent, integKeyEvent ); // Feed to EvasPlugin - ( static_cast( data ) )->OnEvasObjectKeyEvent( integKeyEvent ); + ( static_cast( data ) )->OnEvasObjectKeyEvent( integKeyEvent ); } ///////////////////////////////////////////////////////////////////////////////////////////////////// // Geometry callbacks ///////////////////////////////////////////////////////////////////////////////////////////////////// -void EvasEventHandler::OnEvasObjectMove( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectMove( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Rect geometry; evas_object_geometry_get( evasObject, &geometry.x, &geometry.y, &geometry.width, &geometry.height ); - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectMove( geometry ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectMove( geometry ); } -void EvasEventHandler::OnEvasObjectResize( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectResize( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { Rect geometry; evas_object_geometry_get( evasObject, &geometry.x, &geometry.y, &geometry.width, &geometry.height ); - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectResize( geometry ); -} - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// Visibility callbacks -///////////////////////////////////////////////////////////////////////////////////////////////////// - -void EvasEventHandler::OnEvasObjectShow( void *data, Evas* evas, Evas_Object* evasObject, void* event ) -{ - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectVisiblityChanged( true ); -} - -void EvasEventHandler::OnEvasObjectHide( void *data, Evas* evas, Evas_Object* evasObject, void* event ) -{ - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasObjectVisiblityChanged( false ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasObjectResize( geometry ); } ///////////////////////////////////////////////////////////////////////////////////////////////////// // Focus callbacks ///////////////////////////////////////////////////////////////////////////////////////////////////// -void EvasEventHandler::OnEvasObjectFocusIn( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectFocusIn( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { - EvasEventHandler* eventHandler = static_cast( data ); + EvasPluginEventHandler* eventHandler = static_cast( data ); - eventHandler->GetEvasEventInterface().OnEvasObjectFocusIn(); + eventHandler->EnableEcoreWl2Events(); + eventHandler->GetEvasPluginInterface().OnEvasObjectFocusIn(); } -void EvasEventHandler::OnEvasObjectFocusOut( void *data, Evas* evas, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectFocusOut( void *data, Evas* evas, Evas_Object* evasObject, void* event ) { - EvasEventHandler* eventHandler = static_cast( data ); + EvasPluginEventHandler* eventHandler = static_cast( data ); - eventHandler->GetEvasEventInterface().OnEvasObjectFocusOut(); + eventHandler->DisableEcoreWl2Events(); + eventHandler->GetEvasPluginInterface().OnEvasObjectFocusOut(); } -void EvasEventHandler::OnEvasFocusIn( void *data, Evas* evas, void* event ) +void EvasPluginEventHandler::OnEvasFocusIn( void *data, Evas* evas, void* event ) { } -void EvasEventHandler::OnEvasFocusOut( void *data, Evas* evas, void* event ) +void EvasPluginEventHandler::OnEvasFocusOut( void *data, Evas* evas, void* event ) { } @@ -795,116 +769,116 @@ void EvasEventHandler::OnEvasFocusOut( void *data, Evas* evas, void* event ) // Render callbacks ///////////////////////////////////////////////////////////////////////////////////////////////////// -void EvasEventHandler::OnEvasRenderPost( void *data, Evas* evas, void* event ) +void EvasPluginEventHandler::OnEvasRenderPost( void *data, Evas* evas, void* event ) { - EvasEventInterface* eventInterface = static_cast( data ); - eventInterface->OnEvasPostRender(); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); + pEvasPlugin->OnEvasPostRender(); } ///////////////////////////////////////////////////////////////////////////////////////////////////// // Elm Access callbacks ///////////////////////////////////////////////////////////////////////////////////////////////////// -Eina_Bool EvasEventHandler::OnElmAccessActionHighlight( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionHighlight( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionUnhighlight( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionUnhighlight( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionHighlightNext( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionHighlightNext( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionHighlightPrev( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionHighlightPrev( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionActivate( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionActivate( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionScroll( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionScroll( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionUp( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionUp( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionDown( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionDown( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionBack( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionBack( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } -Eina_Bool EvasEventHandler::OnElmAccessActionRead( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) +Eina_Bool EvasPluginEventHandler::OnElmAccessActionRead( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo ) { - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); Dali::Extension::Internal::AccessActionInfo daliActionInfo; ConvertActionInfo( actionInfo, daliActionInfo ); - return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo ); + return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo ); } ///////////////////////////////////////////////////////////////////////////////////////////////////// // Elm Focus callbacks ///////////////////////////////////////////////////////////////////////////////////////////////////// -void EvasEventHandler::OnEvasObjectSmartFocused( void *data, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectSmartFocused( void *data, Evas_Object* evasObject, void* event ) { - EvasEventHandler* eventHandler = static_cast( data ); - EvasEventInterface& evasPlugin = eventHandler->GetEvasEventInterface(); + EvasPluginEventHandler* eventHandler = static_cast( data ); + EvasPluginEventInterface& evasPlugin = eventHandler->GetEvasPluginInterface(); - if( eventHandler->mEvasEventInterface.GetEvasWrapper()->GetFocusTarget() == evasObject ) + if( eventHandler->mEvasPluginEventInterface.GetEvasWrapper()->GetFocusTarget() == evasObject ) { Evas_Object* topWidget = elm_object_top_widget_get( evasObject ); @@ -919,16 +893,16 @@ void EvasEventHandler::OnEvasObjectSmartFocused( void *data, Evas_Object* evasOb } } - evas_object_focus_set( eventHandler->mEvasEventInterface.GetEvasWrapper()->GetRenderTarget(), EINA_TRUE ); + evas_object_focus_set( eventHandler->mEvasPluginEventInterface.GetEvasWrapper()->GetRenderTarget(), EINA_TRUE ); } } -void EvasEventHandler::OnEvasObjectSmartUnfocused( void *data, Evas_Object* evasObject, void* event ) +void EvasPluginEventHandler::OnEvasObjectSmartUnfocused( void *data, Evas_Object* evasObject, void* event ) { - EvasEventHandler* eventHandler = static_cast( data ); - if( eventHandler->mEvasEventInterface.GetEvasWrapper()->GetFocusTarget() == evasObject ) + EvasPluginEventHandler* eventHandler = static_cast( data ); + if( eventHandler->mEvasPluginEventInterface.GetEvasWrapper()->GetFocusTarget() == evasObject ) { - evas_object_focus_set( eventHandler->mEvasEventInterface.GetEvasWrapper()->GetRenderTarget(), EINA_FALSE ); + evas_object_focus_set( eventHandler->mEvasPluginEventInterface.GetEvasWrapper()->GetRenderTarget(), EINA_FALSE ); } } @@ -936,14 +910,14 @@ void EvasEventHandler::OnEvasObjectSmartUnfocused( void *data, Evas_Object* evas // Ecore Wl2 callbacks ///////////////////////////////////////////////////////////////////////////////////////////////////// -Eina_Bool EvasEventHandler::OnEcoreWl2EventWindowVisibilityChange( void* data, int type, void* event ) +Eina_Bool EvasPluginEventHandler::OnEcoreWl2EventWindowVisibilityChange( void* data, int type, void* event ) { Ecore_Wl2_Event_Window_Visibility_Change* eventWindowVisibilityChange = static_cast( event ); - EvasEventInterface* eventInterface = static_cast( data ); + EvasPluginEventInterface* pEvasPlugin = static_cast( data ); // 0 is visible and 1 is invisible - eventInterface->OnEcoreWl2VisibilityChange( !eventWindowVisibilityChange->fully_obscured ); + pEvasPlugin->OnEcoreWl2VisibilityChange( !eventWindowVisibilityChange->fully_obscured ); return ECORE_CALLBACK_PASS_ON; } diff --git a/dali-extension/internal/evas-plugin/evas-event-handler.h b/dali-extension/internal/evas-plugin/evas-event-handler.h index 7041f49..8b12772 100644 --- a/dali-extension/internal/evas-plugin/evas-event-handler.h +++ b/dali-extension/internal/evas-plugin/evas-event-handler.h @@ -1,8 +1,8 @@ -#ifndef DALI_EXTENSION_INTERNAL_EVAS_EVENT_HANDLER -#define DALI_EXTENSION_INTERNAL_EVAS_EVENT_HANDLER +#ifndef __DALI_EXTENSION_INTERNAL_EVAS_EVENT_HANDLER__ +#define __DALI_EXTENSION_INTERNAL_EVAS_EVENT_HANDLER__ /* - * Copyright ( c ) 2020 Samsung Electronics Co., Ltd. + * Copyright ( c ) 2019 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. @@ -40,28 +40,28 @@ namespace Extension namespace Internal { -class EvasEventInterface; +class EvasPluginEventInterface; -class EvasEventHandler +class EvasPluginEventHandler { public: /** * @brief Constructor * - * @param[in] evasEventInterface Used to send event to evas plugin + * @param[in] evasPluginEventInterface Used to send event to evas plugin */ - EvasEventHandler( EvasEventInterface& evasEventInterface ); + EvasPluginEventHandler( EvasPluginEventInterface& evasPluginEventInterface ); /** * Destructor. */ - ~EvasEventHandler(); + ~EvasPluginEventHandler(); public: - EvasEventInterface& GetEvasEventInterface() + EvasPluginEventInterface& GetEvasPluginInterface() { - return mEvasEventInterface; + return mEvasPluginEventInterface; } private: @@ -134,20 +134,6 @@ private: static void OnEvasObjectResize( void *data, Evas* evas, Evas_Object* evasObject, void* event ); ///////////////////////////////////////////////////////////////////////////////////////////////////// - // Visibility callbacks - ///////////////////////////////////////////////////////////////////////////////////////////////////// - - /** - * @brief Called when show is received - */ - static void OnEvasObjectShow( void *data, Evas* evas, Evas_Object* evasObject, void* event ); - - /** - * @brief Called when hide is received - */ - static void OnEvasObjectHide( void *data, Evas* evas, Evas_Object* evasObject, void* event ); - - ///////////////////////////////////////////////////////////////////////////////////////////////////// // Focus callbacks ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -220,7 +206,7 @@ private: private: - EvasEventInterface& mEvasEventInterface; + EvasPluginEventInterface& mEvasPluginEventInterface; std::vector mEcoreEventHandlers; }; diff --git a/dali-extension/internal/evas-plugin/evas-event-interface.h b/dali-extension/internal/evas-plugin/evas-event-interface.h index 1b38999..9a736d1 100644 --- a/dali-extension/internal/evas-plugin/evas-event-interface.h +++ b/dali-extension/internal/evas-plugin/evas-event-interface.h @@ -1,8 +1,8 @@ -#ifndef DALI_EXTENSION_INTERNAL_EVAS_EVENT_INTERFACE_H -#define DALI_EXTENSION_INTERNAL_EVAS_EVENT_INTERFACE_H +#ifndef __DALI_EXTENSION_INTERNAL_EVAS_EVENT_INTERFACE_H__ +#define __DALI_EXTENSION_INTERNAL_EVAS_EVENT_INTERFACE_H__ /* - * Copyright ( c ) 2020 Samsung Electronics Co., Ltd. + * Copyright ( c ) 2019 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. @@ -81,7 +81,7 @@ struct AccessActionInfo unsigned int timeStamp; }; -class EvasEventInterface +class EvasPluginEventInterface { public: /** @@ -128,13 +128,6 @@ public: virtual void OnEvasObjectResize( const Rect& geometry ) = 0; /** - * @brief Handle evas object visibility - * - * @param visible is the visibility information of evas object - */ - virtual void OnEvasObjectVisiblityChanged( bool visible ) = 0; - - /** * @brief Handle evas object focus in */ virtual void OnEvasObjectFocusIn() = 0; @@ -159,9 +152,9 @@ public: /** * @brief Process the ecore wayland visibility. * - * @param[in] visible True is that ecore wayland window is show up and false is not + * @param[in] visibility True is that ecore wayland window is show up and false is not */ - virtual void OnEcoreWl2VisibilityChange( bool visible ) = 0; + virtual void OnEcoreWl2VisibilityChange( bool visibility ) = 0; }; } // namespace Internal diff --git a/dali-extension/internal/evas-plugin/evas-plugin-impl.cpp b/dali-extension/internal/evas-plugin/evas-plugin-impl.cpp index c176430..13959c2 100755 --- a/dali-extension/internal/evas-plugin/evas-plugin-impl.cpp +++ b/dali-extension/internal/evas-plugin/evas-plugin-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -16,11 +16,21 @@ */ // EXTERNAL INCLUDES +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include // INTERNAL INCLUDES -#include +#include +#include // CLASS HEADER #include @@ -34,6 +44,15 @@ namespace Extension namespace Internal { +// Initialize static members + +Adaptor* EvasPlugin::mAdaptor = nullptr; + +uint32_t EvasPlugin::mEvasPluginCount = 0; + +SingletonService EvasPlugin::mSingletonService = SingletonService(); + + IntrusivePtr< EvasPlugin > EvasPlugin::New( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ) { IntrusivePtr< EvasPlugin > evasPlugin = new EvasPlugin( parentEvasObject, width, height, isTranslucent ); @@ -41,57 +60,78 @@ IntrusivePtr< EvasPlugin > EvasPlugin::New( Evas_Object* parentEvasObject, int w } EvasPlugin::EvasPlugin( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ) -: mSingletonService( SingletonService::New() ), - mState( READY ) +: mEvasWrapper( new EvasWrapper( parentEvasObject, width, height, isTranslucent ) ), + mRenderNotification(), + mEvasPluginEventHandler(), + mState( READY ), + mIsFocus( false ), + mIsTranslucent( isTranslucent ) { - DALI_ASSERT_ALWAYS( parentEvasObject && "No parent object for the EvasPlugin." ); + DALI_ASSERT_ALWAYS( parentEvasObject && "No parent object for the evas plugin." ); - // Generate a default scene - IntrusivePtr< Internal::Scene > scenePtr = Internal::Scene::New( parentEvasObject, width, height, isTranslucent ); + // Increase plugin count. + mEvasPluginCount++; - mDefaultScene = Extension::Scene( scenePtr.Get() ); + // Create surface + mSurface = std::unique_ptr< RenderSurfaceInterface >( CreateNativeSurface( PositionSize( 0, 0, width, height ), isTranslucent ) ); +} - // Generate DALi adaptor - NativeRenderSurface* surface = static_cast( scenePtr->GetSurface() ); +void EvasPlugin::Initialize() +{ + NativeRenderSurface* surface = static_cast( mSurface.get() ); - mAdaptor = &Adaptor::New( Dali::Integration::SceneHolder( scenePtr.Get() ), *surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ); + Dali::Integration::SceneHolder sceneHolderHandler = Dali::Extension::EvasPlugin( this ); - // Initialize default scene - scenePtr->Initialize( this, true ); + if( !mAdaptor ) + { + // Create the singleton service + mSingletonService = SingletonService::New(); - scenePtr->ResizedSignal().Connect( this, &EvasPlugin::OnDefaultSceneResized ); + // Create an adaptor or add new scene holder to the adaptor + mAdaptor = &Adaptor::New( sceneHolderHandler, *surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ); + } + else + { + mAdaptor->AddWindow( sceneHolderHandler, "", "", mIsTranslucent ); + } - scenePtr->FocusChangedSignal().Connect( this, &EvasPlugin::OnDefaultSceneFocusChanged ); + // Connect callback to be notified when the surface is rendered + TriggerEventFactory triggerEventFactory; + + mRenderNotification = std::unique_ptr< TriggerEventInterface >( triggerEventFactory.CreateTriggerEvent( MakeCallback( this, &EvasPlugin::OnPostRender ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ) ); + + surface->SetRenderNotification( mRenderNotification.get() ); } EvasPlugin::~EvasPlugin() { - delete mAdaptor; - mAdaptor = nullptr; + mEvasPluginCount--; - mSingletonService.UnregisterAll(); - mSingletonService.Reset(); -} + if( !mEvasPluginCount ) + { + delete mAdaptor; -Adaptor* EvasPlugin::GetAdaptor() -{ - return mAdaptor; + mSingletonService.UnregisterAll(); + } } void EvasPlugin::Run() { if( READY == mState ) { + if( !mEvasPluginEventHandler ) + { + mEvasPluginEventHandler = std::unique_ptr< EvasPluginEventHandler >( new EvasPluginEventHandler( *this ) ); + } + // Start the adaptor mAdaptor->Start(); - mState = RUNNING; - - mPreInitSignal.Emit(); - mInitSignal.Emit(); mAdaptor->NotifySceneCreated(); + + mState = RUNNING; } } @@ -101,7 +141,7 @@ void EvasPlugin::Pause() { mState = SUSPENDED; - mAdaptor->Pause(); + Hide(); mPauseSignal.Emit(); } @@ -111,7 +151,7 @@ void EvasPlugin::Resume() { if( mState == SUSPENDED ) { - mAdaptor->Resume(); + Show(); mResumeSignal.Emit(); @@ -131,38 +171,300 @@ void EvasPlugin::Stop() } } -Extension::Scene EvasPlugin::GetDefaultScene() +Dali::Any EvasPlugin::GetNativeHandle() const { - return mDefaultScene; + return mEvasWrapper->GetNativeWindow(); +} + +NativeRenderSurface* EvasPlugin::GetNativeRenderSurface() const +{ + return dynamic_cast< NativeRenderSurface* >( mSurface.get() ); } Evas_Object* EvasPlugin::GetAccessEvasObject() { - return mDefaultScene.GetAccessEvasObject(); + return mEvasWrapper->GetAccessibilityTarget(); } Evas_Object* EvasPlugin::GetDaliEvasObject() { - return mDefaultScene.GetDaliEvasObject(); + return mEvasWrapper->GetFocusTarget(); } -void EvasPlugin::OnDefaultSceneResized( Extension::Scene defaultScene, int width, int height ) +void EvasPlugin::ResizeSurface( int width, int height ) { + if( !mSurface || !mAdaptor || width <= 1 || height <= 1 ) + { + return; + } + + PositionSize currentSize = mSurface->GetPositionSize(); + if( currentSize.width == width && currentSize.height == height ) + { + return; + } + + mSurface->MoveResize( PositionSize( 0, 0, width, height ) ); + + SurfaceResized(); + + Adaptor::SurfaceSize newSize( width, height ); + + // When surface size is updated, inform adaptor of resizing and emit ResizeSignal + mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize ); + mResizeSignal.Emit(); + + mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize ); } -void EvasPlugin::OnDefaultSceneFocusChanged( Extension::Scene defaultScene, bool focused ) +void EvasPlugin::OnPostRender() { - if( focused ) + // Bind offscreen surface to the evas object + NativeRenderSurface* surface = GetNativeRenderSurface(); + + DALI_ASSERT_DEBUG( surface && "Surface is null in EvasPlugin" ); + + tbm_surface_h tbmSurface = AnyCast( surface->GetDrawable() ); + + if( !tbmSurface ) + { + return; + } + + mEvasWrapper->BindTBMSurface( tbmSurface ); + + mEvasWrapper->RequestRender(); + + surface->ReleaseLock(); +} + +EvasWrapper* EvasPlugin::GetEvasWrapper() const +{ + return mEvasWrapper.get(); +} + +void EvasPlugin::OnEvasObjectTouchEvent( Dali::Integration::Point& touchPoint, unsigned long timeStamp ) +{ + FeedTouchPoint( touchPoint, timeStamp ); +} + +void EvasPlugin::OnEvasObjectWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) +{ + FeedWheelEvent( wheelEvent ); +} + +void EvasPlugin::OnEvasObjectKeyEvent( Dali::Integration::KeyEvent& keyEvent ) +{ + FeedKeyEvent( keyEvent ); +} + +void EvasPlugin::OnEvasObjectMove( const Rect& geometry ) +{ +} + +void EvasPlugin::OnEvasObjectResize( const Rect& geometry ) +{ + ResizeSurface( geometry.width, geometry.height ); +} + +void EvasPlugin::OnEvasObjectFocusIn() +{ + if( !mIsFocus ) { mFocusedSignal.Emit(); + + mIsFocus = true; } - else +} + +void EvasPlugin::OnEvasObjectFocusOut() +{ + if( mIsFocus ) { + mIsFocus = false; + + Toolkit::KeyInputFocusManager focusManager = Toolkit::KeyInputFocusManager::Get(); + Toolkit::Control currentFocused = focusManager.GetCurrentFocusControl(); + if( currentFocused ) + { + focusManager.RemoveFocus( currentFocused ); + } + + Clipboard::Get().HideClipboard(); + mUnFocusedSignal.Emit(); } } +void EvasPlugin::OnEvasPostRender() +{ +} + +bool EvasPlugin::OnElmAccessibilityActionEvent( AccessActionInfo& accessActionInfo ) +{ + bool ret = false; + + if( mAdaptor == nullptr ) + { + return ret; + } + + Dali::AccessibilityAdaptor accessibilityAdaptor = Dali::AccessibilityAdaptor::Get(); + if( accessibilityAdaptor ) + { + switch( accessActionInfo.actionBy ) + { + case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT: + case Dali::Extension::Internal::ACCESS_ACTION_READ: + { + ret = accessibilityAdaptor.HandleActionReadEvent( (unsigned int)accessActionInfo.x, (unsigned int)accessActionInfo.y, true ); + } + break; + + case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT_PREV: + { + // if accessActionInfo.highlight_end is true, need to handle end_of_list sound feedback + ret = accessibilityAdaptor.HandleActionPreviousEvent( accessActionInfo.highlightCycle ); + if(!ret) + { + // when focus moving was failed, clear the focus + accessibilityAdaptor.HandleActionClearFocusEvent(); + } + } + break; + + case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT_NEXT: + { + // if accessActionInfo.highlight_cycle is true, need to handle end_of_list sound feedback + ret = accessibilityAdaptor.HandleActionNextEvent( accessActionInfo.highlightCycle ); + if(!ret) + { + // when focus moving was failed, clear the focus + accessibilityAdaptor.HandleActionClearFocusEvent(); + } + } + break; + + case Dali::Extension::Internal::ACCESS_ACTION_ACTIVATE: + { + ret = accessibilityAdaptor.HandleActionActivateEvent(); + } + break; + + case Dali::Extension::Internal::ACCESS_ACTION_UNHIGHLIGHT: + { + ret = accessibilityAdaptor.HandleActionClearFocusEvent(); + } + break; + + case Dali::Extension::Internal::ACCESS_ACTION_SCROLL: + { + Evas_Object* eo = mEvasWrapper->GetAccessibilityTarget(); + + if( eo ) + { + int touchType = accessActionInfo.mouseType; + + TouchPoint::State state( TouchPoint::Down ); + + if( touchType == 0 ) + { + state = TouchPoint::Down; // mouse down + } + else if( touchType == 1 ) + { + state = TouchPoint::Motion; // mouse move + } + else if( touchType == 2 ) + { + state = TouchPoint::Up; // mouse up + } + else + { + state = TouchPoint::Interrupted; // error + } + + // Send touch event to accessibility manager. + Evas_Coord rel_x, rel_y, obj_x, obj_y, obj_w, obj_h; + + evas_object_geometry_get( eo, &obj_x, &obj_y, &obj_w, &obj_h ); + + rel_x = accessActionInfo.x - obj_x; + rel_y = accessActionInfo.y - obj_y; + + TouchPoint point( 0, state, (float)rel_x, (float)rel_y ); + + ret = accessibilityAdaptor.HandleActionScrollEvent( point, accessActionInfo.timeStamp ); + } + } + break; + + case Dali::Extension::Internal::ACCESS_ACTION_UP: + { + ret = accessibilityAdaptor.HandleActionUpEvent(); + } + break; + + case Dali::Extension::Internal::ACCESS_ACTION_DOWN: + { + ret = accessibilityAdaptor.HandleActionDownEvent(); + } + break; + + case Dali::Extension::Internal::ACCESS_ACTION_BACK: + default: + { + DALI_LOG_WARNING( "[%s:%d]\n", __FUNCTION__, __LINE__ ); + } + + break; + } + } + else + { + DALI_LOG_WARNING( "[%s:%d]\n", __FUNCTION__, __LINE__ ); + } + + return ret; +} + +void EvasPlugin::OnEcoreWl2VisibilityChange( bool visibility ) +{ + DALI_LOG_RELEASE_INFO( "EvasPlugin::OnEcoreWl2VisibilityChange( %s )", visibility ? "T" : "F" ); + + if( visibility ) + { + Show(); + } + else + { + Hide(); + + mAdaptor->ReleaseSurfaceLock(); + } +} + +void EvasPlugin::Show() +{ + if( !mVisible ) + { + mVisible = true; + + mAdaptor->OnWindowShown(); + } +} + +void EvasPlugin::Hide() +{ + if( mVisible ) + { + mVisible = false; + + mAdaptor->OnWindowHidden(); + } +} + } // namespace Internal } // namespace Extension diff --git a/dali-extension/internal/evas-plugin/evas-plugin-impl.h b/dali-extension/internal/evas-plugin/evas-plugin-impl.h index 1fdff54..103f956 100755 --- a/dali-extension/internal/evas-plugin/evas-plugin-impl.h +++ b/dali-extension/internal/evas-plugin/evas-plugin-impl.h @@ -1,5 +1,5 @@ -#ifndef DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H -#define DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H +#ifndef __DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H__ +#define __DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H__ /* * Copyright (c) 2019 Samsung Electronics Co., Ltd. @@ -23,17 +23,20 @@ #include #include +#include #include -#include +#include #include // INTERNAL INCLUDES +#include #include -#include namespace Dali { class Adaptor; +class NativeRenderSurface; +class TriggerEventInterface; namespace Extension { @@ -41,11 +44,15 @@ namespace Extension namespace Internal { +class EvasPluginEventHandler; +class EvasWrapper; + /** * Implementation of the EvasPlugin class. */ -class EvasPlugin : public BaseObject, - public ConnectionTracker +class EvasPlugin : public Dali::Internal::Adaptor::SceneHolder, + public ConnectionTracker, + public Extension::Internal::EvasPluginEventInterface { public: @@ -83,9 +90,17 @@ public: void Stop(); /** - * @copydoc Dali::Extension::EvasPlugin::GetDefaultScene() + * @brief Gets the native handle. + * @note When users call this function, it wraps the actual type used by the underlying system. + * @return The native handle or an empty handle */ - Extension::Scene GetDefaultScene(); + Dali::Any GetNativeHandle() const override; + + /** + * @brief Get the native render surface + * @return The render surface + */ + NativeRenderSurface* GetNativeRenderSurface() const; /** * @copydoc Dali::Extension::EvasPlugin::GetAccessEvasObject() @@ -153,41 +168,89 @@ public: return mUnFocusedSignal; } -public: + /* + * @bried Initialize EvasPlugin + */ + void Initialize(); + +private: + /** - * All methods here are for the internal use + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::GetEvasWrapper */ + EvasWrapper* GetEvasWrapper() const override; - enum State - { - READY, - RUNNING, - SUSPENDED, - STOPPED, - }; + /** + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectTouchEvent + */ + void OnEvasObjectTouchEvent( Dali::Integration::Point& touchPoint, unsigned long timeStamp ) override; /** - * @brief This is for internal use to get notified before InitSignal() emits + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectWheelEvent */ - EvasPluginSignalType& PreInitSignal() - { - return mPreInitSignal; - } + void OnEvasObjectWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) override; /** - * @brief Get EvasPlugin's current state - * - * @return The state + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectKeyEvent */ - const State GetState() const - { - return mState; - } + void OnEvasObjectKeyEvent( Dali::Integration::KeyEvent& keyEvent ) override; - /* - * @bried Get currently working Adaptor. It can be null. + /** + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectMove + */ + void OnEvasObjectMove( const Rect& geometry ) override; + + /** + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectResize + */ + void OnEvasObjectResize( const Rect& geometry ) override; + + /** + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectFocusIn + */ + void OnEvasObjectFocusIn() override; + + /** + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectFocusOut */ - Adaptor* GetAdaptor(); + void OnEvasObjectFocusOut() override; + + /** + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasRenderPost + */ + void OnEvasPostRender() override; + + /** + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnElmAccessibilityActionEvent + */ + bool OnElmAccessibilityActionEvent( AccessActionInfo& actionInfo ) override; + + /** + * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEcoreWl2VisibilityChange + */ + void OnEcoreWl2VisibilityChange( bool visibility ) override; + + /** + * @brief Resize the surface + * @param[in] width The width value + * @param[in] height The height value + */ + void ResizeSurface( int width, int height ); + + /** + * This function is called after drawing by dali. + */ + void OnPostRender(); + + /** + * @brief Shows the EvasPlugin if it is hidden. + */ + void Show(); + + /** + * @brief Hides the EvasPlugin if it is showing. + */ + void Hide(); private: /** @@ -208,37 +271,40 @@ private: EvasPlugin( const EvasPlugin& ); EvasPlugin& operator=( EvasPlugin& ); - /** - * This callback is for supporting legacy API EvasPlugin::ResizeSignal - */ - void OnDefaultSceneResized( Extension::Scene defaultScene, int width, int height ); +private: - /** - * This callback is for supporting legacy API EvasPlugin::FocusedSignal, EvasPlugin::UnFocusedSignal - */ - void OnDefaultSceneFocusChanged( Extension::Scene defaultScene, bool focused ); + enum State + { + READY, + RUNNING, + SUSPENDED, + STOPPED, + }; -private: + static Adaptor* mAdaptor; + static uint32_t mEvasPluginCount; + static SingletonService mSingletonService; - Adaptor* mAdaptor; - SingletonService mSingletonService; - Extension::Scene mDefaultScene; + std::unique_ptr< EvasWrapper > mEvasWrapper; + std::unique_ptr< TriggerEventInterface > mRenderNotification; + std::unique_ptr< EvasPluginEventHandler > mEvasPluginEventHandler; - EvasPluginSignalType mPreInitSignal; EvasPluginSignalType mInitSignal; EvasPluginSignalType mTerminateSignal; EvasPluginSignalType mPauseSignal; EvasPluginSignalType mResumeSignal; - EvasPluginSignalType mResizeSignal; // Connect to DefaultScene.ResizedSignal - EvasPluginSignalType mFocusedSignal; // Connect to DefaultScene.FocusChangedSignal - EvasPluginSignalType mUnFocusedSignal; // Connect to DefaultScene.FocusChangedSignal + EvasPluginSignalType mResizeSignal; + EvasPluginSignalType mFocusedSignal; + EvasPluginSignalType mUnFocusedSignal; State mState; + bool mIsFocus; + bool mIsTranslucent; }; inline EvasPlugin& GetImplementation( Extension::EvasPlugin& evasPlugin ) { - DALI_ASSERT_ALWAYS( evasPlugin && "EvasPlugin handle is empty" ); + DALI_ASSERT_ALWAYS( evasPlugin && "evasPluing handle is empty" ); BaseObject& handle = evasPlugin.GetBaseObject(); @@ -247,7 +313,7 @@ inline EvasPlugin& GetImplementation( Extension::EvasPlugin& evasPlugin ) inline const EvasPlugin& GetImplementation( const Extension::EvasPlugin& evasPlugin ) { - DALI_ASSERT_ALWAYS( evasPlugin && "EvasPlugin handle is empty" ); + DALI_ASSERT_ALWAYS( evasPlugin && "evasPlugin handle is empty" ); const BaseObject& handle = evasPlugin.GetBaseObject(); @@ -260,4 +326,4 @@ inline const EvasPlugin& GetImplementation( const Extension::EvasPlugin& evasPlu } // namespace Dali -#endif // DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H +#endif // __DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H__ diff --git a/dali-extension/internal/evas-plugin/evas-wrapper.h b/dali-extension/internal/evas-plugin/evas-wrapper.h index 4258c9f..0728602 100644 --- a/dali-extension/internal/evas-plugin/evas-wrapper.h +++ b/dali-extension/internal/evas-plugin/evas-wrapper.h @@ -1,5 +1,5 @@ -#ifndef DALI_EXTENSION_INTERNAL_EVAS_WRAPPER -#define DALI_EXTENSION_INTERNAL_EVAS_WRAPPER +#ifndef __DALI_EXTENSION_INTERNAL_EVAS_WRAPPER__ +#define __DALI_EXTENSION_INTERNAL_EVAS_WRAPPER__ /* * Copyright ( c ) 2019 Samsung Electronics Co., Ltd. @@ -122,4 +122,4 @@ private: } // namespace Dali -#endif // DALI_EXTENSION_INTERNAL_EVAS_WRAPPER +#endif // __DALI_EXTENSION_INTERNAL_EVAS_WRAPPER__ diff --git a/dali-extension/internal/evas-plugin/file.list b/dali-extension/internal/evas-plugin/file.list index 1330896..d94bbca 100644 --- a/dali-extension/internal/evas-plugin/file.list +++ b/dali-extension/internal/evas-plugin/file.list @@ -2,11 +2,9 @@ evas_plugin_internal_header_files = \ $(extension_src_dir)/internal/evas-plugin/evas-event-handler.h \ $(extension_src_dir)/internal/evas-plugin/evas-event-interface.h \ $(extension_src_dir)/internal/evas-plugin/evas-plugin-impl.h \ - $(extension_src_dir)/internal/evas-plugin/evas-wrapper.h \ - $(extension_src_dir)/internal/evas-plugin/scene-impl.h + $(extension_src_dir)/internal/evas-plugin/evas-wrapper.h evas_plugin_internal_src_files = \ $(extension_src_dir)/internal/evas-plugin/evas-event-handler.cpp \ $(extension_src_dir)/internal/evas-plugin/evas-plugin-impl.cpp \ - $(extension_src_dir)/internal/evas-plugin/evas-wrapper.cpp \ - $(extension_src_dir)/internal/evas-plugin/scene-impl.cpp + $(extension_src_dir)/internal/evas-plugin/evas-wrapper.cpp diff --git a/dali-extension/internal/evas-plugin/scene-impl.cpp b/dali-extension/internal/evas-plugin/scene-impl.cpp deleted file mode 100644 index 8f84457..0000000 --- a/dali-extension/internal/evas-plugin/scene-impl.cpp +++ /dev/null @@ -1,446 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include -#include - -// CLASS HEADER -#include - -namespace Dali -{ - -namespace Extension -{ - -namespace Internal -{ - -IntrusivePtr< Scene > Scene::New( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ) -{ - IntrusivePtr< Scene > scene = new Scene( parentEvasObject, width, height, isTranslucent ); - return scene; -} - -Scene::Scene( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ) -: mAdaptor( nullptr ), - mEvasWrapper( new EvasWrapper( parentEvasObject, width, height, isTranslucent ) ), - mEvasEventHandler(), - mRenderNotification(), - mIsFocus( false ), - mIsTranslucent( isTranslucent ) -{ - DALI_ASSERT_ALWAYS( parentEvasObject && "No parent object for the scene" ); - - // Create surface - mSurface = std::unique_ptr< RenderSurfaceInterface >( CreateNativeSurface( PositionSize( 0, 0, width, height ), isTranslucent ) ); -} - -void Scene::Initialize( EvasPlugin* evasPlugin, bool isDefaultScene ) -{ - mAdaptor = evasPlugin->GetAdaptor(); - - DALI_ASSERT_ALWAYS( mAdaptor && "Scene can not be created when the Adaptor is null" ); - - if( isDefaultScene ) - { - Initialize(); - return; - } - - if( evasPlugin->GetState() != EvasPlugin::RUNNING ) - { - evasPlugin->PreInitSignal().Connect( this, &Scene::OnPreInitEvasPlugin ); - - return; - } - - Dali::Integration::SceneHolder sceneHolderHandler = Dali::Integration::SceneHolder( this ); - mAdaptor->AddWindow( sceneHolderHandler, "", "", mIsTranslucent ); - - Initialize(); -} - -void Scene::Initialize() -{ - // Connect callback to be notified when the surface is rendered - TriggerEventFactory triggerEventFactory; - - mRenderNotification = std::unique_ptr< TriggerEventInterface >( triggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Scene::OnPostRender ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ) ); - - NativeRenderSurface* surface = GetNativeRenderSurface(); - - surface->SetRenderNotification( mRenderNotification.get() ); - - if( !mEvasEventHandler ) - { - mEvasEventHandler = std::unique_ptr< EvasEventHandler >( new EvasEventHandler( *this ) ); - } -} - -void Scene::OnPreInitEvasPlugin() -{ - Dali::Integration::SceneHolder sceneHolderHandler = Dali::Integration::SceneHolder( this ); - mAdaptor->AddWindow( sceneHolderHandler, "", "", mIsTranslucent ); - - Initialize(); -} - -Scene::~Scene() -{ - // To prevent notification triggering in NativeRenderSurface::PostRender while deleting SceneHolder - GetNativeRenderSurface()->SetRenderNotification( nullptr ); -} - -uint32_t Scene::GetLayerCount() const -{ - return mScene.GetLayerCount(); -} - -Layer Scene::GetLayer( uint32_t depth ) const -{ - return mScene.GetLayer( depth ); -} - -Size Scene::GetSize() const -{ - return mScene.GetSize(); -} - -Dali::Any Scene::GetNativeHandle() const -{ - return mEvasWrapper->GetNativeWindow(); -} - -NativeRenderSurface* Scene::GetNativeRenderSurface() const -{ - return dynamic_cast< NativeRenderSurface* >( mSurface.get() ); -} - -Evas_Object* Scene::GetAccessEvasObject() -{ - return mEvasWrapper->GetAccessibilityTarget(); -} - -Evas_Object* Scene::GetDaliEvasObject() -{ - return mEvasWrapper->GetFocusTarget(); -} - -void Scene::ResizeSurface( int width, int height ) -{ - if( !mSurface || !mAdaptor || width <= 1 || height <= 1 ) - { - return; - } - - PositionSize currentSize = mSurface->GetPositionSize(); - if( currentSize.width == width && currentSize.height == height ) - { - return; - } - - mSurface->MoveResize( PositionSize( 0, 0, width, height ) ); - - SurfaceResized( true ); - - Adaptor::SurfaceSize newSize( width, height ); - - // When surface size is updated, inform adaptor of resizing and emit ResizedSignal - mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize ); - - mResizedSignal.Emit( Extension::Scene( this ), width, height ); - - mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize ); -} - -void Scene::OnPostRender() -{ - // Bind offscreen surface to the evas object - NativeRenderSurface* surface = GetNativeRenderSurface(); - - DALI_ASSERT_DEBUG( surface && "Surface is null in the Scene" ); - - tbm_surface_h tbmSurface = AnyCast( surface->GetDrawable() ); - - if( !tbmSurface ) - { - return; - } - - mEvasWrapper->BindTBMSurface( tbmSurface ); - - mEvasWrapper->RequestRender(); - - surface->ReleaseLock(); -} - -EvasWrapper* Scene::GetEvasWrapper() const -{ - return mEvasWrapper.get(); -} - -void Scene::OnEvasObjectTouchEvent( Dali::Integration::Point& touchPoint, unsigned long timeStamp ) -{ - FeedTouchPoint( touchPoint, timeStamp ); -} - -void Scene::OnEvasObjectWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) -{ - FeedWheelEvent( wheelEvent ); -} - -void Scene::OnEvasObjectKeyEvent( Dali::Integration::KeyEvent& keyEvent ) -{ - FeedKeyEvent( keyEvent ); -} - -void Scene::OnEvasObjectMove( const Rect& geometry ) -{ -} - -void Scene::OnEvasObjectResize( const Rect& geometry ) -{ - ResizeSurface( geometry.width, geometry.height ); -} - -void Scene::OnEvasObjectVisiblityChanged( bool visible ) -{ - if( mVisible == visible ) - { - return; - } - DALI_LOG_RELEASE_INFO( "Scene::OnEvasObjectVisiblityChanged( %s )", visible ? "T" : "F" ); - - SetVisibility( visible ); -} - -void Scene::OnEvasObjectFocusIn() -{ - if( !mIsFocus ) - { - mFocusChangedSignal.Emit( Extension::Scene( this ), true ); - - mIsFocus = true; - } -} - -void Scene::OnEvasObjectFocusOut() -{ - if( mIsFocus ) - { - mIsFocus = false; - - Toolkit::KeyInputFocusManager focusManager = Toolkit::KeyInputFocusManager::Get(); - Toolkit::Control currentFocused = focusManager.GetCurrentFocusControl(); - if( currentFocused ) - { - focusManager.RemoveFocus( currentFocused ); - } - - Clipboard::Get().HideClipboard(); - - mFocusChangedSignal.Emit( Extension::Scene( this ), false ); - } -} - -void Scene::OnEvasPostRender() -{ -} - -bool Scene::OnElmAccessibilityActionEvent( AccessActionInfo& accessActionInfo ) -{ - bool ret = false; - - if( mAdaptor == nullptr ) - { - return ret; - } - - Dali::AccessibilityAdaptor accessibilityAdaptor = Dali::AccessibilityAdaptor::Get(); - if( accessibilityAdaptor ) - { - switch( accessActionInfo.actionBy ) - { - case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT: - case Dali::Extension::Internal::ACCESS_ACTION_READ: - { - ret = accessibilityAdaptor.HandleActionReadEvent( (unsigned int)accessActionInfo.x, (unsigned int)accessActionInfo.y, true ); - } - break; - - case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT_PREV: - { - // if accessActionInfo.highlight_end is true, need to handle end_of_list sound feedback - ret = accessibilityAdaptor.HandleActionPreviousEvent( accessActionInfo.highlightCycle ); - if(!ret) - { - // when focus moving was failed, clear the focus - accessibilityAdaptor.HandleActionClearFocusEvent(); - } - } - break; - - case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT_NEXT: - { - // if accessActionInfo.highlight_cycle is true, need to handle end_of_list sound feedback - ret = accessibilityAdaptor.HandleActionNextEvent( accessActionInfo.highlightCycle ); - if(!ret) - { - // when focus moving was failed, clear the focus - accessibilityAdaptor.HandleActionClearFocusEvent(); - } - } - break; - - case Dali::Extension::Internal::ACCESS_ACTION_ACTIVATE: - { - ret = accessibilityAdaptor.HandleActionActivateEvent(); - } - break; - - case Dali::Extension::Internal::ACCESS_ACTION_UNHIGHLIGHT: - { - ret = accessibilityAdaptor.HandleActionClearFocusEvent(); - } - break; - - case Dali::Extension::Internal::ACCESS_ACTION_SCROLL: - { - Evas_Object* eo = mEvasWrapper->GetAccessibilityTarget(); - - if( eo ) - { - int touchType = accessActionInfo.mouseType; - - TouchPoint::State state( TouchPoint::Down ); - - if( touchType == 0 ) - { - state = TouchPoint::Down; // mouse down - } - else if( touchType == 1 ) - { - state = TouchPoint::Motion; // mouse move - } - else if( touchType == 2 ) - { - state = TouchPoint::Up; // mouse up - } - else - { - state = TouchPoint::Interrupted; // error - } - - // Send touch event to accessibility manager. - Evas_Coord rel_x, rel_y, obj_x, obj_y, obj_w, obj_h; - - evas_object_geometry_get( eo, &obj_x, &obj_y, &obj_w, &obj_h ); - - rel_x = accessActionInfo.x - obj_x; - rel_y = accessActionInfo.y - obj_y; - - TouchPoint point( 0, state, (float)rel_x, (float)rel_y ); - - ret = accessibilityAdaptor.HandleActionScrollEvent( point, accessActionInfo.timeStamp ); - } - } - break; - - case Dali::Extension::Internal::ACCESS_ACTION_UP: - { - ret = accessibilityAdaptor.HandleActionUpEvent(); - } - break; - - case Dali::Extension::Internal::ACCESS_ACTION_DOWN: - { - ret = accessibilityAdaptor.HandleActionDownEvent(); - } - break; - - case Dali::Extension::Internal::ACCESS_ACTION_BACK: - default: - { - DALI_LOG_WARNING( "[%s:%d]\n", __FUNCTION__, __LINE__ ); - } - - break; - } - } - else - { - DALI_LOG_WARNING( "[%s:%d]\n", __FUNCTION__, __LINE__ ); - } - - return ret; -} - -void Scene::OnEcoreWl2VisibilityChange( bool visible ) -{ - DALI_LOG_RELEASE_INFO( "Scene::OnEcoreWl2VisibilityChange( %s )", visible ? "T" : "F" ); - - SetVisibility( visible ); -} - -void Scene::SetVisibility( bool visible ) -{ - if( mVisible == visible ) - { - return; - } - - mVisible = visible; - - if( !mAdaptor ) - { - return; - } - - if( mVisible ) - { - mAdaptor->OnWindowShown(); - } - else - { - mAdaptor->OnWindowHidden(); - - mSurface->ReleaseLock(); - } - - mVisibilityChangedSignal.Emit( Extension::Scene( this ), mVisible ); -} - -} // namespace Internal - -} // namespace Extension - -} // namespace Dali diff --git a/dali-extension/internal/evas-plugin/scene-impl.h b/dali-extension/internal/evas-plugin/scene-impl.h deleted file mode 100644 index 2da040f..0000000 --- a/dali-extension/internal/evas-plugin/scene-impl.h +++ /dev/null @@ -1,298 +0,0 @@ -#ifndef DALI_EXTENSION_INTERNAL_SCENE_IMPL_H -#define DALI_EXTENSION_INTERNAL_SCENE_IMPL_H - -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include - -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ -class Adaptor; -class Layer; -class NativeRenderSurface; -class TriggerEventInterface; - -namespace Extension -{ - -namespace Internal -{ - -class EvasEventHandler; -class EvasWrapper; - -/** - * Implementation of the Scene class. - */ -class Scene : public Dali::Internal::Adaptor::SceneHolder, - public ConnectionTracker, - public Extension::Internal::EvasEventInterface -{ -public: - - typedef Dali::Extension::Scene::VisibilityChangedSignalType VisibilityChangedSignalType; - - typedef Dali::Extension::Scene::FocusChangedSignalType FocusChangedSignalType; - - typedef Dali::Extension::Scene::ResizedSignalType ResizedSignalType; - - /** - * @brief Create a new scene - * - * @param[in] parentEvasObject Parent Evas object of the new scene - * @param[in] width The initial width of the scene - * @param[in] height The initial height of the scene - * @param[in] isTranslucent Whether the Evas object is translucent or not - */ - static IntrusivePtr New( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ); - -public: - - /** - * @copydoc Dali::Extension::Scene::GetLayerCount - */ - uint32_t GetLayerCount() const; - - /** - * @copydoc Dali::Extension::Scene::GetLayer - */ - Layer GetLayer( uint32_t depth ) const; - - /** - * @copydoc Dali::Extension::Scene::GetSize - */ - Size GetSize() const; - - /** - * @brief Gets the native handle. - * @note When users call this function, it wraps the actual type used by the underlying system. - * @return The native handle or an empty handle - */ - Dali::Any GetNativeHandle() const override; - - /** - * @copydoc Dali::Extension::Scene::GetAccessEvasObject - */ - Evas_Object* GetAccessEvasObject(); - - /** - * @copydoc Dali::Extension::Scene::GetDaliEvasObject - */ - Evas_Object* GetDaliEvasObject(); - - /** - * @copydoc Dali::Extension::Scene::VisibilityChangedSignal - */ - VisibilityChangedSignalType& VisibilityChangedSignal() - { - return mVisibilityChangedSignal; - } - - /** - * @copydoc Dali::Extension::Scene::ResizedSignal - */ - ResizedSignalType& ResizedSignal() - { - return mResizedSignal; - } - - /** - * @copydoc Dali::Extension::Scene::FocusChangedSignal - */ - FocusChangedSignalType& FocusChangedSignal() - { - return mFocusChangedSignal; - } - - /* - * @brief Initialize the Scene - * @param[in] evasPlugin The EvasPlugin instance to be used to intialize the new scene - * @param[in] isDefaultScene Whether the Scene is a default one or not - */ - void Initialize( EvasPlugin* evasPlugin, bool isDefaultScene ); - -private: - - /** - * @brief Resize the surface - * @param[in] width The width value - * @param[in] height The height value - */ - void ResizeSurface( int width, int height ); - - /** - * This function is called after drawing by dali. - */ - void OnPostRender(); - - /** - * @brief Set visibility of the Scene - * @param[in] visible The visibility - */ - void SetVisibility( bool visible ); - - /** - * @brief Get the native render surface - * @return The render surface - */ - NativeRenderSurface* GetNativeRenderSurface() const; - -private: - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::GetEvasWrapper - */ - EvasWrapper* GetEvasWrapper() const override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectTouchEvent - */ - void OnEvasObjectTouchEvent( Dali::Integration::Point& touchPoint, unsigned long timeStamp ) override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectWheelEvent - */ - void OnEvasObjectWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectKeyEvent - */ - void OnEvasObjectKeyEvent( Dali::Integration::KeyEvent& keyEvent ) override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectMove - */ - void OnEvasObjectMove( const Rect& geometry ) override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectResize - */ - void OnEvasObjectResize( const Rect& geometry ) override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectVisiblityChanged - */ - void OnEvasObjectVisiblityChanged( bool visible ) override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectFocusIn - */ - void OnEvasObjectFocusIn() override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectFocusOut - */ - void OnEvasObjectFocusOut() override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasRenderPost - */ - void OnEvasPostRender() override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnElmAccessibilityActionEvent - */ - bool OnElmAccessibilityActionEvent( AccessActionInfo& actionInfo ) override; - - /** - * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEcoreWl2VisibilityChange - */ - void OnEcoreWl2VisibilityChange( bool visible ) override; - -private: - - /** - * Private constructor - * - * @param[in] parentEvasObject Parent Evas object of the new scene - * @param[in] width The initial width of the scene - * @param[in] height The initial height of the scene - * @param[in] isTranslucent Whether the Evas object is translucent or not - */ - Scene( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent ); - - /** - * Destructor - */ - virtual ~Scene(); - - // Undefined - Scene( const Scene& ); - Scene& operator=( Scene& ); - - /** - * This is for initialization of this Scene in case it is created before adaptor is running. - */ - void OnPreInitEvasPlugin(); - - /* - * @brief Initialize the Scene (for internal use) - */ - void Initialize(); - -private: - - Adaptor* mAdaptor; - - std::unique_ptr< EvasWrapper > mEvasWrapper; - std::unique_ptr< EvasEventHandler > mEvasEventHandler; - std::unique_ptr< TriggerEventInterface > mRenderNotification; - - ResizedSignalType mResizedSignal; - VisibilityChangedSignalType mVisibilityChangedSignal; - FocusChangedSignalType mFocusChangedSignal; - - bool mIsFocus; - bool mIsTranslucent; -}; - -inline Scene& GetImplementation( Extension::Scene& scene ) -{ - DALI_ASSERT_ALWAYS( scene && "Extension::Scene handle is empty" ); - - BaseObject& handle = scene.GetBaseObject(); - - return static_cast( handle ); -} - -inline const Scene& GetImplementation( const Extension::Scene& scene ) -{ - DALI_ASSERT_ALWAYS( scene && "Extension::Scene handle is empty" ); - - const BaseObject& handle = scene.GetBaseObject(); - - return static_cast( handle ); -} - -} // namespace Internal - -} // namespace Extension - -} // namespace Dali - -#endif // DALI_EXTENSION_INTERNAL_SCENE_IMPL_H