--- /dev/null
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/input/common/key-impl.h>
+
+namespace Dali
+{
+
+namespace DevelKey
+{
+
+int GetDaliKeyCode( const char* keyName )
+{
+ return Internal::Adaptor::KeyLookup::GetDaliKeyCode( keyName );
+}
+
+} // namespace DevelKey
+
+} // namespace Dali
};
+/**
+ * @brief Get the key code from a key name.
+ * @param[in] keyName The key name
+ * @return The key code. -1 if the daliKey does not exist in the supported key lookup table.
+ */
+DALI_ADAPTOR_API int GetDaliKeyCode( const char* keyName );
+
} // namespace DevelKey
} // namespace Dali
$(adaptor_devel_api_dir)/adaptor-framework/orientation.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/performance-logger.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/physical-keyboard.cpp \
+ $(adaptor_devel_api_dir)/adaptor-framework/key-devel.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/pixel-buffer.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/singleton-service.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/sound-player.cpp \
// EXTERNAL INCLUDES
#include <dali/public-api/signals/callback.h>
#include <dali/public-api/signals/dali-signal.h>
+#include <dali/public-api/math/uint-16-pair.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/common/view-mode.h>
typedef Signal< void (Adaptor&) > AdaptorSignalType; ///< Generic Type for adaptor signals
typedef Signal< void (Window&) > WindowCreatedSignalType; ///< Window created signal type
+ using SurfaceSize = Uint16Pair; ///< Surface size type
+
public:
/**
* @brief Create a new adaptor using the window.
bool AddIdle( CallbackBase* callback, bool hasReturnValue );
/**
+ * @brief Adds a new Window instance to the Adaptor
+ *
+ * @param[in] childWindow The child window instance
+ * @param[in] childWindowName The child window title/name
+ * @param[in] childWindowClassName The class name that the child window belongs to
+ * @param[in] childWindowMode The mode of the child window
+ */
+ bool AddWindow( Dali::Integration::SceneHolder childWindow,
+ const std::string& childWindowName,
+ const std::string& childWindowClassName,
+ bool childWindowMode );
+
+ /**
* @brief Removes a previously added @p callback.
* @note Function must be called from the main event thread only.
*
void SceneCreated();
/**
+ * @brief Informs core the surface size has changed.
+ *
+ * @param[in] surface The current render surface
+ * @param[in] surfaceSize The new surface size
+ */
+ void SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize );
+
+ /**
+ * @brief Informs ThreadController the surface size has changed.
+ *
+ * @param[in] surface The current render surface
+ * @param[in] surfaceSize The new surface size
+ */
+ void SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize );
+
+ /**
* @brief Renders once more even if we're paused
* @note Will not work if the window is hidden.
*/
*/
Dali::WindowContainer GetWindows() const;
+ /**
+ * @brief Called when the window becomes fully or partially visible.
+ */
+ void OnWindowShown();
+
+ /**
+ * @brief Called when the window is fully hidden.
+ */
+ void OnWindowHidden();
+
public: // Signals
/**
mThreadController->SetPreRenderCallback( callback );
}
-bool Adaptor::AddWindow( Dali::Integration::SceneHolder* childWindow, const std::string& childWindowName, const std::string& childWindowClassName, const bool& childWindowMode )
+bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
{
- Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( *childWindow );
+ Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( childWindow );
windowImpl.SetAdaptor( Get() );
// Add the new Window to the container - the order is not important
* @param[in] childWindowClassName The class name that the child window belongs to
* @param[in] childWindowMode The mode of the child window
*/
- virtual bool AddWindow( Dali::Integration::SceneHolder* childWindow,
+ virtual bool AddWindow( Dali::Integration::SceneHolder childWindow,
const std::string& childWindowName,
const std::string& childWindowClassName,
- const bool& childWindowMode );
+ bool childWindowMode );
/**
* Removes an existing Window instance from the Adaptor
void GetAppId( std::string& appId );
/**
- * Informs core the surface size has changed
+ * @copydoc Dali::Adaptor::SurfaceResizePrepare
*/
void SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize );
/**
- * Informs ThreadController the surface size has changed
+ * @copydoc Dali::Adaptor::SurfaceResizeComplete
*/
void SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize );
*/
virtual void RequestProcessEventsOnIdle( bool forceProcess );
-private: // From Dali::Internal::Adaptor::WindowVisibilityObserver
+public: // From Dali::Internal::Adaptor::WindowVisibilityObserver
/**
* Called when the window becomes fully or partially visible.
return mImpl->AddIdle( callback, hasReturnValue, false );
}
+bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
+{
+ return mImpl->AddWindow( childWindow, childWindowName, childWindowClassName, childWindowMode );
+}
+
void Adaptor::RemoveIdle( CallbackBase* callback )
{
mImpl->RemoveIdle( callback );
mImpl->SceneCreated();
}
+void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
+{
+ mImpl->SurfaceResizePrepare( surface, surfaceSize );
+}
+
+void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
+{
+ mImpl->SurfaceResizeComplete( surface, surfaceSize );
+}
+
void Adaptor::RenderOnce()
{
mImpl->RenderOnce();
return mImpl->GetWindows();
}
+void Adaptor::OnWindowShown()
+{
+ mImpl->OnWindowShown();
+}
+
+void Adaptor::OnWindowHidden()
+{
+ mImpl->OnWindowHidden();
+}
+
Adaptor::Adaptor()
: mImpl( NULL )
{
DestroySurface( eglSurface );
// create the EGL surface
- CreateSurfaceWindow( window, mColorDepth );
+ EGLSurface newEglSurface = CreateSurfaceWindow( window, mColorDepth );
// set the context to be current with the new surface
- MakeContextCurrent( eglSurface, eglContext );
+ MakeContextCurrent( newEglSurface, eglContext );
return contextLost;
}
const char* GetKeyName( Dali::KEY daliKey );
/**
- * @brief Get the key code from a key name.
- * @param[in] keyName The key name
- * @return The key code. -1 if the daliKey does not exist in the supported key lookup table.
+ * @copydoc Dali::DevelKey::GetDaliKeyCode()
*/
int GetDaliKeyCode( const char* keyName );
// EXTERNAL INCLUDES
#include <Ecore_Input.h>
+#ifdef ECORE_WAYLAND2
+#include <Ecore_Wl2.h>
+#else
+#include <Ecore_Wayland.h>
+#endif
+
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/adaptor-framework/key.h>
#include <dali/public-api/object/type-registry.h>
Any nativeWindow = Dali::Adaptor::Get().GetNativeWindowHandle();
// The window needs to use the InputMethodContext.
- // Only when the render surface is window, we can get the window.
if( !nativeWindow.Empty() )
{
inputMethodContext = new InputMethodContextEcoreWl();
{
// If we fail to get window id, we can't use the InputMethodContext correctly.
// Thus you have to call "ecore_imf_context_client_window_set" somewhere.
- // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().
- Dali::RenderSurfaceInterface& renderSurface = Dali::Adaptor::Get().GetSurface();
- WindowRenderSurface& windowRenderSurface = static_cast< WindowRenderSurface& >( renderSurface );
- int windowId = windowRenderSurface.GetNativeWindowId();
+ Any nativeWindowHandle = Dali::Adaptor::Get().GetNativeWindowHandle();
+
+#ifdef ECORE_WAYLAND2
+ int windowId = ecore_wl2_window_id_get( AnyCast< Ecore_Wl2_Window* >( nativeWindowHandle ) );
+#else
+ int windowId = ecore_wl_window_id_get( AnyCast< Ecore_Wl_Window* >( nativeWindowHandle ) );
+#endif
+
if( windowId != 0 )
{
ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast< void* >( windowId ) );
Debug::Filter* gNativeSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_NATIVE_RENDER_SURFACE");
#endif
+inline void PrintTBMSurfaceQueueError( int errorCode )
+{
+ switch( errorCode )
+ {
+ case TBM_SURFACE_QUEUE_ERROR_EMPTY:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_EMPTY" );
+ break;
+ case TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE" );
+ break;
+ case TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE" );
+ break;
+ case TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED" );
+ break;
+ case TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST" );
+ break;
+ case TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE" );
+ break;
+ case TBM_SURFACE_QUEUE_ERROR_INVALID_SEQUENCE:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_INVALID_SEQUENCE" );
+ break;
+ case TBM_SURFACE_QUEUE_ERROR_TIMEOUT:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_TIMEOUT" );
+ break;
+ default:
+ DALI_LOG_ERROR( "TBM_SURFACE_QUEUE_ERROR_UNKNOWN" );
+ break;
+ }
+}
+
} // unnamed namespace
NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize, bool isTransparent )
void NativeRenderSurfaceEcoreWl::MoveResize( Dali::PositionSize positionSize )
{
+ tbm_surface_queue_error_e error = TBM_SURFACE_QUEUE_ERROR_NONE;
+
+ error = tbm_surface_queue_reset( mTbmQueue, positionSize.width, positionSize.height, mTbmFormat );
+
+ if( error != TBM_SURFACE_QUEUE_ERROR_NONE )
+ {
+ DALI_LOG_ERROR( "Failed to resize tbm_surface_queue" );
+
+ PrintTBMSurfaceQueueError( error );
+ }
+
+ mPosition = positionSize;
}
void NativeRenderSurfaceEcoreWl::StartRender()
Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
- Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, "", isTransparent );
+ Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, "", isTransparent );
return Window(window);
}
Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
Integration::SceneHolder sceneHolder = Integration::SceneHolder( window );
- Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &sceneHolder, name, className, isTransparent );
+ Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( sceneHolder, name, className, isTransparent );
return Window(window);
}