*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/events/key-event.h>
+#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/wheel-event.h>
+
// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/internal/window-system/common/window-impl.h>
return GetImplementation( window ).GetLayer( depth );
}
+EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
+{
+ return GetImplementation( window ).EventProcessingFinishedSignal();
+}
+
+KeyEventSignalType& KeyEventSignal( Window window )
+{
+ return GetImplementation( window ).KeyEventSignal();
+}
+
+TouchSignalType& TouchSignal( Window window )
+{
+ return GetImplementation( window ).TouchSignal();
+}
+
+WheelEventSignalType& WheelEventSignal( Window window )
+{
+ return GetImplementation( window ).WheelEventSignal();
+}
+
} // namespace DevelWindow
} // namespace Dali
namespace Dali
{
+class KeyEvent;
+class TouchData;
+class WheelEvent;
namespace DevelWindow
{
+typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type
+
+typedef Signal< void (const KeyEvent&) > KeyEventSignalType; ///< Key event signal type
+
+typedef Signal< void (const TouchData&) > TouchSignalType; ///< Touch signal type
+
+typedef Signal< void (const WheelEvent&) > WheelEventSignalType; ///< Touched signal type
+
/**
* @brief Sets position and size of the window. This API guarantees that both moving and resizing of window will appear on the screen at once.
*
*/
DALI_ADAPTOR_API Dali::Layer GetLayer( Window window, uint32_t depth );
+/**
+ * @brief This signal is emitted just after the event processing is finished.
+ *
+ * @param[in] window The window instance
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
+
+/**
+ * @brief This signal is emitted when key event is received.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(const KeyEvent& event);
+ * @endcode
+ * @param[in] window The window instance
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API KeyEventSignalType& KeyEventSignal( Window window );
+
+/**
+ * @brief This signal is emitted when the screen is touched and when the touch ends
+ * (i.e. the down & up touch events only).
+ *
+ * If there are multiple touch points, then this will be emitted when the first touch occurs and
+ * then when the last finger is lifted.
+ * An interrupted event will also be emitted (if it occurs).
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( TouchData event );
+ * @endcode
+ *
+ * @param[in] window The window instance
+ * @return The touch signal to connect to
+ * @note Motion events are not emitted.
+ */
+DALI_ADAPTOR_API TouchSignalType& TouchSignal( Window window );
+
+/**
+ * @brief This signal is emitted when wheel event is received.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(const WheelEvent& event);
+ * @endcode
+ * @param[in] window The window instance
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal( Window window );
} // namespace DevelWindow
/**
* @brief Create a new adaptor using render surface.
*
- * @param[in] nativeWindow native window handle
+ * @param[in] window The window to draw onto
* @param[in] surface The surface to draw onto
* @return a reference to the adaptor handle
*/
- static Adaptor& New( Any nativeWindow, const Dali::RenderSurfaceInterface& surface );
+ static Adaptor& New( Window window, const Dali::RenderSurfaceInterface& surface );
/**
* @brief Create a new adaptor using render surface.
*
- * @param[in] nativeWindow native window handle
+ * @param[in] window The window to draw onto
* @param[in] surface The surface to draw onto
* @param[in] configuration The context loss configuration.
* @return a reference to the adaptor handle
*/
- static Adaptor& New( Any nativeWindow, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration = Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
+ static Adaptor& New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration = Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
/**
* @brief Virtual Destructor.
/**
* @brief Replaces the rendering surface
*
- * @param[in] nativeWindow native window handle
+ * @param[in] window The window to replace the surface for
* @param[in] surface to use
*/
- void ReplaceSurface( Any nativeWindow, Dali::RenderSurfaceInterface& surface );
+ void ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface );
/**
* @brief Get the render surface the adaptor is using to render to.
#include <dali/integration-api/events/gesture-requests.h>
// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/internal/system/common/system-settings.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/internal/input/common/pan-gesture-detector-base.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
namespace Dali
bool mPanning; ///< Keep track of panning state, when panning is occuring, this is true.
};
-typedef IntrusivePtr<AccessibilityGestureDetector> AccessibilityGestureDetectorPtr;
+using AccessibilityGestureDetectorPtr = Dali::IntrusivePtr<AccessibilityGestureDetector>;
} // namespace Adaptor
thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
} // unnamed namespace
-
-Dali::Adaptor* Adaptor::New( Any nativeWindow, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
Dali::Adaptor* adaptor = new Dali::Adaptor;
- Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
+ Adaptor* impl = new Adaptor( window, *adaptor, surface, environmentOptions );
adaptor->mImpl = impl;
Dali::Internal::Adaptor::AdaptorBuilder* mAdaptorBuilder = new AdaptorBuilder();
Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
- Any winId = window.GetNativeHandle();
-
Window& windowImpl = Dali::GetImplementation( window );
- Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
+ Dali::Adaptor* adaptor = New( window, windowImpl.GetSurface(), configuration, environmentOptions );
windowImpl.SetAdaptor( *adaptor );
return adaptor;
}
-Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Any nativeWindow, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Window window, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
Dali::Adaptor* adaptor = new Dali::Adaptor; // Public adaptor
- Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions ); // Impl adaptor
+ Adaptor* impl = new Adaptor( window, *adaptor, surface, environmentOptions ); // Impl adaptor
adaptor->mImpl = impl;
impl->Initialize( graphicsFactory, configuration );
Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
- Any winId = window.GetNativeHandle();
-
Window& windowImpl = Dali::GetImplementation( window );
- Dali::Adaptor* adaptor = New( graphicsFactory, winId, windowImpl.GetSurface(), configuration, environmentOptions );
+ Dali::Adaptor* adaptor = New( graphicsFactory, window, windowImpl.GetSurface(), configuration, environmentOptions );
windowImpl.SetAdaptor( *adaptor );
return adaptor;
} // Called first
mCallbackManager = CallbackManager::New();
- WindowPane defaultWindow = mWindowFrame.front();
+ WindowPtr defaultWindow = mWindows.front();
- DALI_ASSERT_DEBUG( defaultWindow.surface && "Surface not initialized" );
+ DALI_ASSERT_DEBUG( defaultWindow->GetSurface() && "Surface not initialized" );
- PositionSize size = defaultWindow.surface->GetPositionSize();
-
- defaultWindow.surface->SetAdaptor(*this);
+ PositionSize size = defaultWindow->GetSurface()->GetPositionSize();
mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
mGraphics->GetDepthBufferRequired(),
mGraphics->GetStencilBufferRequired() );
+ defaultWindow->SetAdaptor( *this );
+
const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
if( 0u < timeInterval )
{
mVSyncMonitor = new VSyncMonitor;
- mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow.surface->GetSurfaceType() );
+ mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow->GetSurface()->GetSurfaceType() );
mThreadController = new ThreadController( *this, *mEnvironmentOptions );
(*iter)->OnDestroy();
}
+ // Clear out all the handles to Windows
+ mWindows.clear();
+
delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
delete mVSyncMonitor;
- delete mEventHandler;
delete mObjectProfiler;
delete mCore;
// Start the callback manager
mCallbackManager->Start();
- WindowPane defaultWindow = mWindowFrame.front();
-
- // Create event handler
- mEventHandler = new EventHandler( defaultWindow.surface, *this, *mGestureManager, *this, mDragAndDropDetector );
+ WindowPtr defaultWindow = mWindows.front();
if( mDeferredRotationObserver != NULL )
{
- mEventHandler->SetRotationObserver(mDeferredRotationObserver);
+ defaultWindow->SetRotationObserver( mDeferredRotationObserver );
mDeferredRotationObserver = NULL;
}
unsigned int dpiHor, dpiVer;
dpiHor = dpiVer = 0;
- defaultWindow.surface->GetDpi( dpiHor, dpiVer );
+ defaultWindow->GetSurface()->GetDpi( dpiHor, dpiVer );
// set the DPI value for font rendering
FontClient fontClient = FontClient::Get();
fontClient.SetDpi( dpiHor, dpiVer );
// Tell the core the size of the surface just before we start the render-thread
- mCore->SurfaceResized( defaultWindow.surface );
+ mCore->SurfaceResized( defaultWindow->GetSurface() );
// Initialize the thread controller
mThreadController->Initialize();
(*iter)->OnPause();
}
- // Reset the event handler when adaptor paused
- if( mEventHandler )
+ // Pause all windows event handlers when adaptor paused
+ for( WindowPtr window : mWindows )
{
- mEventHandler->Pause();
+ window->Pause();
}
mThreadController->Pause();
{
mState = RUNNING;
- // Reset the event handler when adaptor resumed
- if( mEventHandler )
+ // Reset the event handlers when adaptor resumed
+ for( WindowPtr window : mWindows )
{
- mEventHandler->Resume();
+ window->Resume();
}
// Inform observers that we have resumed.
mThreadController->Stop();
- // Clear out all the handles to Windows
- mWindowFrame.clear();
-
// Delete the TTS player
- for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
+ for( int i =0; i < Dali::TtsPlayer::MODE_NUM; i++ )
{
- if(mTtsPlayers[i])
+ if( mTtsPlayers[i] )
{
mTtsPlayers[i].Reset();
}
// Destroy the image loader plugin
Internal::Adaptor::ImageLoaderPluginProxy::Destroy();
- delete mEventHandler;
- mEventHandler = NULL;
-
delete mNotificationTrigger;
mNotificationTrigger = NULL;
void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
{
- mEventHandler->FeedTouchPoint( point, timeStamp );
+ mWindows.front()->FeedTouchPoint( point, timeStamp );
}
void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
{
- mEventHandler->FeedWheelEvent( wheelEvent );
+ mWindows.front()->FeedWheelEvent( wheelEvent );
}
void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
{
- mEventHandler->FeedKeyEvent( keyEvent );
+ mWindows.front()->FeedKeyEvent( keyEvent );
}
-void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurfaceInterface& newSurface )
+void Adaptor::ReplaceSurface( Dali::Window window, Dali::RenderSurfaceInterface& newSurface )
{
- // Let the core know the surface size has changed
- mCore->SurfaceResized( &newSurface );
-
- mResizedSignal.Emit( mAdaptor );
-
- WindowPane newDefaultWindow;
- newDefaultWindow.nativeWindow = nativeWindow;
- newDefaultWindow.surface = &newSurface;
- newDefaultWindow.surface->SetAdaptor(*this);
-
- WindowPane oldDefaultWindow = mWindowFrame.front();
+ Window* windowImpl = &Dali::GetImplementation( window );
+ for( WindowPtr windowPtr : mWindows )
+ {
+ if( windowPtr.Get() == windowImpl ) // the window is not deleted
+ {
+ // Let the core know the surface size has changed
+ mCore->SurfaceResized( &newSurface );
- // Update WindowFrame
- std::vector<WindowPane>::iterator iter = mWindowFrame.begin();
- iter = mWindowFrame.insert( iter, newDefaultWindow );
+ mResizedSignal.Emit( mAdaptor );
- // Flush the event queue to give the update-render thread chance
- // to start processing messages for new camera setup etc as soon as possible
- ProcessCoreEvents();
+ windowImpl->SetSurface( static_cast<WindowRenderSurface*>( &newSurface ) );
- // This method blocks until the render thread has completed the replace.
- mThreadController->ReplaceSurface( newDefaultWindow.surface );
+ // Flush the event queue to give the update-render thread chance
+ // to start processing messages for new camera setup etc as soon as possible
+ ProcessCoreEvents();
- // Must delete the old Window only after the render thread has completed the replace
- oldDefaultWindow.surface->DestroySurface();
- oldDefaultWindow.surface = nullptr;
+ // This method blocks until the render thread has completed the replace.
+ mThreadController->ReplaceSurface( &newSurface );
+ break;
+ }
+ }
}
Dali::RenderSurfaceInterface& Adaptor::GetSurface() const
{
- WindowPane defaultWindow = mWindowFrame.front();
- return *(defaultWindow.surface);
+ return *mWindows.front()->GetSurface();
}
void Adaptor::ReleaseSurfaceLock()
{
- WindowPane defaultWindow = mWindowFrame.front();
- defaultWindow.surface->ReleaseLock();
+ mWindows.front()->GetSurface()->ReleaseLock();
}
Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
{
- if(!mTtsPlayers[mode])
+ if( !mTtsPlayers[mode] )
{
// Create the TTS player when it needed, because it can reduce launching time.
mTtsPlayers[mode] = TtsPlayer::New(mode);
Window& windowImpl = Dali::GetImplementation( *childWindow );
windowImpl.SetAdaptor( Get() );
- // This is any Window that is not the main (default) one
- WindowPane additionalWindow;
- additionalWindow.instance = childWindow;
- additionalWindow.window_name = childWindowName;
- additionalWindow.class_name = childWindowClassName;
- additionalWindow.window_mode = childWindowMode;
- additionalWindow.surface = windowImpl.GetSurface();
- additionalWindow.id = windowImpl.GetId();
-
- // Add the new Window to the Frame - the order is not important
- mWindowFrame.push_back( additionalWindow );
-
+ // Add the new Window to the container - the order is not important
+ mWindows.push_back( WindowPtr( &windowImpl ) );
return true;
}
bool Adaptor::RemoveWindow( Dali::Window* childWindow )
{
- for ( WindowFrames::iterator iter = mWindowFrame.begin(); iter != mWindowFrame.end(); ++iter )
+ Window& windowImpl = Dali::GetImplementation( *childWindow );
+ for ( WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter )
{
- if( iter->instance == childWindow )
+ if( *iter == &windowImpl )
{
- mWindowFrame.erase( iter );
+ mWindows.erase( iter );
return true;
}
}
bool Adaptor::RemoveWindow( std::string childWindowName )
{
- for ( WindowFrames::iterator iter = mWindowFrame.begin(); iter != mWindowFrame.end(); ++iter )
+ for ( WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter )
{
- if( iter->window_name == childWindowName )
+ if( ( *iter )->GetName() == childWindowName )
{
- mWindowFrame.erase( iter );
+ mWindows.erase( iter );
return true;
}
}
bool Adaptor::RemoveWindow( Window* childWindow )
{
- for ( WindowFrames::iterator iter = mWindowFrame.begin(); iter != mWindowFrame.end(); ++iter )
+ for ( WindowContainer::iterator iter = mWindows.begin(); iter != mWindows.end(); ++iter )
{
- if( iter->id == childWindow->GetId() )
+ if( ( *iter )->GetId() == childWindow->GetId() )
{
- mWindowFrame.erase( iter );
+ mWindows.erase( iter );
return true;
}
}
Dali::RenderSurfaceInterface* Adaptor::GetRenderSurfaceInterface()
{
- if( !mWindowFrame.empty())
- {
- WindowPane defaultWindow = mWindowFrame.front();
- return defaultWindow.surface;
- }
- else
+ if( !mWindows.empty() )
{
- return nullptr;
+ return mWindows.front()->GetSurface();
}
+
+ return nullptr;
}
VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
{
mDragAndDropDetector = detector;
-
- if ( mEventHandler )
- {
- mEventHandler->SetDragAndDropDetector( detector );
- }
}
void Adaptor::SetRotationObserver( RotationObserver* observer )
{
- if( mEventHandler )
- {
- mEventHandler->SetRotationObserver( observer );
- }
- else if( mState == READY )
+ WindowPtr defaultWindow = mWindows.front();
+ if( !defaultWindow->SetRotationObserver( observer ) && mState == READY )
{
// Set once event handler exists
mDeferredRotationObserver = observer;
void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
{
- if(mTtsPlayers[mode])
+ if( mTtsPlayers[mode] )
{
mTtsPlayers[mode].Reset();
}
Any Adaptor::GetNativeWindowHandle()
{
- WindowPane defaultWindow = mWindowFrame.front();
- return defaultWindow.nativeWindow;
+ return mWindows.front()->GetNativeHandle();
}
Any Adaptor::GetGraphicsDisplay()
return false;
}
-Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions)
+Adaptor::Adaptor(Dali::Window window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions)
: mResizedSignal(),
mLanguageChangedSignal(),
mAdaptor( adaptor ),
mVSyncMonitor( nullptr ),
mGraphics( nullptr ),
mDisplayConnection( nullptr ),
- mWindowFrame(),
+ mWindows(),
mPlatformAbstraction( nullptr ),
- mEventHandler( nullptr ),
mCallbackManager( nullptr ),
mNotificationOnIdleInstalled( false ),
mNotificationTrigger( nullptr ),
mUseRemoteSurface( false )
{
DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
-
- WindowPane defaultWindow;
- defaultWindow.nativeWindow = nativeWindow;
- defaultWindow.surface = surface;
- defaultWindow.id = 0;
-
- std::vector<WindowPane>::iterator iter = mWindowFrame.begin();
- iter = mWindowFrame.insert( iter, defaultWindow );
+ mWindows.insert( mWindows.begin(), WindowPtr( &Dali::GetImplementation( window ) ) );
gThreadLocalAdaptor = this;
}
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor.h>
+#include <dali/integration-api/scene.h>
#include <dali/public-api/adaptor-framework/tts-player.h>
#include <dali/devel-api/adaptor-framework/clipboard.h>
#include <dali/internal/system/common/core-event-interface.h>
#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
#include <dali/internal/window-system/common/damage-observer.h>
+#include <dali/internal/window-system/common/window-impl.h>
#include <dali/internal/window-system/common/window-visibility-observer.h>
#include <dali/internal/system/common/kernel-trace.h>
#include <dali/internal/system/common/system-trace.h>
{
class DisplayConnection;
class GraphicsFactory;
-class EventHandler;
class GestureManager;
class GlImplementation;
class GlSyncImplementation;
/**
* Creates a New Adaptor
- * @param[in] nativeWindow Native window handle
+ * @param[in] window The window handle
* @param[in] surface A render surface can be one of the following
* - Pixmap, adaptor will use existing Pixmap to draw on to
* - Window, adaptor will use existing Window to draw on to
* @param[in] configuration The context loss configuration ( to choose resource discard policy )
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
- static Dali::Adaptor* New( Any nativeWindow,
+ static Dali::Adaptor* New( Dali::Window window,
Dali::RenderSurfaceInterface* surface,
Dali::Configuration::ContextLoss configuration,
EnvironmentOptions* environmentOptions );
/**
* Creates a New Adaptor
- * @param[in] nativeWindow native window handle
+ * @param[in] window The window handle
* @param[in] configuration The context loss configuration ( to choose resource discard policy )
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
/**
* Creates a New Adaptor
* @param[in] graphicsFactory A factory that creates the graphics interface
- * @param[in] nativeWindow Native window handle
+ * @param[in] window The window handle
* @param[in] surface A render surface can be one of the following
* - Pixmap, adaptor will use existing Pixmap to draw on to
* - Window, adaptor will use existing Window to draw on to
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
static Dali::Adaptor* New( GraphicsFactory& graphicsFactory,
- Any nativeWindow,
+ Dali::Window window,
Dali::RenderSurfaceInterface* surface,
Dali::Configuration::ContextLoss configuration,
EnvironmentOptions* environmentOptions );
/**
* Creates a New Adaptor
* @param[in] graphicsFactory A factory that creates the graphics interface
- * @param[in] nativeWindow native window handle
+ * @param[in] window The window handle
* @param[in] configuration The context loss configuration ( to choose resource discard policy )
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
/**
* @copydoc AdaptorInterface::ReplaceSurface()
*/
- virtual void ReplaceSurface( Any nativeWindow, Dali::RenderSurfaceInterface& surface );
+ virtual void ReplaceSurface( Dali::Window window, Dali::RenderSurfaceInterface& surface );
/**
* @copydoc Dali::Adaptor::GetSurface()
return mLanguageChangedSignal;
}
+ /**
+ * Gets the gesture manager.
+ * @return The GestureManager
+ */
+ GestureManager* GetGestureManager() const
+ {
+ return mGestureManager;
+ }
+
private: // From Dali::Internal::Adaptor::CoreEventInterface
/**
/**
* Constructor
- * @param[in] nativeWindow native window handle
+ * @param[in] window window handle
* @param[in] adaptor The public adaptor
* @param[in] surface A render surface can be one of the following
* - Pixmap, adaptor will use existing Pixmap to draw on to
* - Window, adaptor will use existing Window to draw on to
* @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
- Adaptor( Any nativeWindow, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions );
+ Adaptor( Dali::Window window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions );
private: // Types
STOPPED, ///< Adaptor has been stopped.
};
- // A structure to encapsulate each Window instance for the Adaptor to track them
- typedef struct WindowPane
- {
- Dali::Window* instance; ///< Window object
- std::string window_name; ///< Name (title)_of the window
- std::string class_name; ///< Class name that the window belongs to
- bool window_mode; ///< Display mode of the window
- Any nativeWindow; ///< window identifier
- uint32_t id; ///< unique Window ID
- Dali::RenderSurfaceInterface* surface; ///< The surface the Window is bound to
- } WindowPane;
-
- typedef std::vector<WindowPane> WindowFrames;
-
- typedef std::vector<LifeCycleObserver*> ObserverContainer;
+ using WindowPtr = IntrusivePtr< Window >;
+ using WindowContainer = std::vector<WindowPtr>;
+ using ObserverContainer = std::vector<LifeCycleObserver*>;
private: // Data
GraphicsInterface* mGraphics; ///< Graphics interface
Dali::DisplayConnection* mDisplayConnection; ///< Display connection
- WindowFrames mWindowFrame; ///< A container of all the Windows that are currently created
+ WindowContainer mWindows; ///< A container of all the Windows that are currently created
TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction
- EventHandler* mEventHandler; ///< event handler
CallbackManager* mCallbackManager; ///< Used to install callbacks
bool mNotificationOnIdleInstalled; ///< whether the idle handler is installed to send an notification event
TriggerEventInterface* mNotificationTrigger; ///< Notification event trigger
return *adaptor;
}
-Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurfaceInterface& surface )
+Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
{
- return New( nativeWindow, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
+ return New( window, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
}
-Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
+Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
{
Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface *>(&surface);
- Adaptor* adaptor = Internal::Adaptor::Adaptor::New( nativeWindow, pSurface, configuration, NULL );
+ Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, pSurface, configuration, NULL );
return *adaptor;
}
mImpl->RemoveIdle( callback );
}
-void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurfaceInterface& surface )
+void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
{
- mImpl->ReplaceSurface(nativeWindow, surface);
+ mImpl->ReplaceSurface( window, surface );
}
Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
#include <dali/internal/adaptor/common/lifecycle-controller-impl.h>
#include <dali/internal/window-system/common/window-impl.h>
#include <dali/internal/window-system/common/window-render-surface.h>
+#include <dali/internal/window-system/common/render-surface-factory.h>
+// To disable a macro with the same name from one of OpenGL headers
#undef Status
namespace Dali
void Application::ReplaceWindow( const PositionSize& positionSize, const std::string& name )
{
- Dali::Window newWindow = Dali::Window::New( positionSize, name, mMainWindowMode == Dali::Application::TRANSPARENT );
- Window& windowImpl = GetImplementation(newWindow);
- windowImpl.SetAdaptor(*mAdaptor);
+ Any surface;
+ auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
+ std::unique_ptr<Internal::Adaptor::WindowRenderSurface> renderSurface =
+ renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, false );
- Internal::Adaptor::WindowRenderSurface* renderSurface = windowImpl.GetSurface();
-
- Any nativeWindow = newWindow.GetNativeHandle();
- Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(nativeWindow, *renderSurface);
- mMainWindow = newWindow;
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface( mMainWindow, *renderSurface.release() );
mWindowPositionSize = positionSize;
}
// Use strdup() in app_get_id(), so need to free memory
if( appId )
{
- WindowPane defaultWindow = mWindowFrame.front();
#ifdef ECORE_WAYLAND2
- Ecore_Wl2_Window* ecoreWlWindow = AnyCast< Ecore_Wl2_Window* >( defaultWindow.nativeWindow );
+ Ecore_Wl2_Window* ecoreWlWindow = AnyCast< Ecore_Wl2_Window* >( mWindows.front()->GetNativeHandle() );
screen_connector_provider_remote_enable( appId, ecore_wl2_window_surface_get( ecoreWlWindow ) );
#else
- Ecore_Wl_Window* ecoreWlWindow = AnyCast< Ecore_Wl_Window* >( defaultWindow.nativeWindow );
+ Ecore_Wl_Window* ecoreWlWindow = AnyCast< Ecore_Wl_Window* >( mWindows.front()->GetNativeHandle() );
screen_connector_provider_remote_enable( appId, ecore_wl_window_surface_get( ecoreWlWindow ) );
#endif
free( appId );
#include <dali/public-api/events/gesture.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/object/ref-object.h>
+#include <dali/integration-api/scene.h>
namespace Dali
{
*/
Gesture::Type GetType() const { return mType; }
+ void SendEvent(Integration::Scene& scene, const Integration::TouchEvent& event)
+ {
+ mScene = &scene;
+ SendEvent(event);
+ }
+
protected:
/**
* @param[in] detectorType The type of gesture detector.
*/
GestureDetector(Vector2 screenSize, Gesture::Type detectorType)
- : mScreenSize(screenSize), mType(detectorType) {}
+ : mScreenSize(screenSize), mType(detectorType), mScene(nullptr) {}
/**
* Virtual destructor.
Vector2 mScreenSize;
Gesture::Type mType;
+ Integration::Scene* mScene;
};
typedef IntrusivePtr<GestureDetector> GestureDetectorPtr;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Destroying GestureManager\n" );
}
-void GestureManager::SendEvent(const Integration::TouchEvent& event)
+void GestureManager::SendEvent(Integration::Scene& scene, const Integration::TouchEvent& event)
{
if (mRunning)
{
// Send the event to all gesture detectors.
for ( GestureDetectorContainer::iterator iter = detectors.begin(), endIter = detectors.end(); iter != endIter; ++iter )
{
- (*iter)->SendEvent(event);
+ (*iter)->SendEvent(scene, event);
}
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "SendEvent: END\n" );
}
* Used by the event handler to send touch events to the Gesture Manager.
* @param[in] event The latest touch event.
*/
- void SendEvent(const Integration::TouchEvent& event);
+ void SendEvent(Integration::Scene& scene, const Integration::TouchEvent& event);
/**
* Used by the event handler to stop the GestureManager detection.
longPress.time += GetSystemValue();
}
- mCoreEventInterface.QueueCoreEvent(longPress);
+ if( mScene )
+ {
+ mScene->QueueEvent( longPress );
+ }
}
}
gesture.time = currentEvent.time;
- mCoreEventInterface.QueueCoreEvent(gesture);
+ if( mScene )
+ {
+ mScene->QueueEvent(gesture);
+ }
}
} // namespace Adaptor
Integration::TapGestureEvent tapEvent( Gesture::Possible );
tapEvent.point = mTouchPosition;
tapEvent.time = event.time;
- mCoreEventInterface.QueueCoreEvent(tapEvent);
+ if( mScene )
+ {
+ mScene->QueueEvent( tapEvent );
+ }
}
event.numberOfTaps = mTapsRegistered;
event.point = mTouchPosition;
event.time = time;
- mCoreEventInterface.QueueCoreEvent(event);
+ if( mScene )
+ {
+ mScene->QueueEvent( event );
+ }
}
} // namespace Adaptor
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/wheel-event-integ.h>
+#include <dali/integration-api/scene.h>
// INTERNAL INCLUDES
#include <dali/internal/input/common/gesture-manager.h>
} // unnamed namespace
-EventHandler::EventHandler( Integration::RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector )
-: mCoreEventInterface( coreEventInterface ),
+EventHandler::EventHandler( Dali::Integration::Scene scene, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver )
+: mScene( scene ),
+ mCoreEventInterface( coreEventInterface ),
mGestureManager( gestureManager ),
mStyleMonitor( StyleMonitor::Get() ),
mDamageObserver( damageObserver ),
mRotationObserver( NULL ),
- mDragAndDropDetector( dndDetector ),
mAccessibilityAdaptor( AccessibilityAdaptor::Get() ),
mClipboardEventNotifier( ClipboardEventNotifier::Get() ),
mClipboard( Clipboard::Get() ),
mPaused( false )
{
// this code only works with the WindowRenderSurface so need to downcast
- WindowRenderSurface* windowRenderSurface = static_cast< WindowRenderSurface* >( surface );
+ WindowRenderSurface* windowRenderSurface = static_cast< WindowRenderSurface* >( scene.GetSurface() );
if( windowRenderSurface )
{
WindowBase* windowBase = windowRenderSurface->GetWindowBase();
mGestureManager.Stop();
}
-void EventHandler::SendEvent(Integration::Point& point, unsigned long timeStamp)
+void EventHandler::SendEvent( Integration::Point& point, unsigned long timeStamp )
{
- if(timeStamp < 1)
+ if( timeStamp < 1 )
{
timeStamp = GetCurrentMilliSeconds();
}
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
- if(type != Integration::TouchEventCombiner::DispatchNone )
+ if( type != Integration::TouchEventCombiner::DispatchNone )
{
- DALI_LOG_INFO(gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetScreenPosition().x, point.GetScreenPosition().y);
-
+ DALI_LOG_INFO( gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetScreenPosition().x, point.GetScreenPosition().y );
// First the touch and/or hover event & related gesture events are queued
- if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth)
+ if( type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth )
{
- mCoreEventInterface.QueueCoreEvent( touchEvent );
- mGestureManager.SendEvent(touchEvent);
+ mScene.QueueEvent( touchEvent );
+ mGestureManager.SendEvent( mScene, touchEvent );
}
- if(type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth)
+ if( type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth )
{
- mCoreEventInterface.QueueCoreEvent( hoverEvent );
+ mScene.QueueEvent( hoverEvent );
}
// Next the events are processed with a single call into Core
void EventHandler::SendEvent(Integration::KeyEvent& keyEvent)
{
Dali::PhysicalKeyboard physicalKeyboard = PhysicalKeyboard::Get();
- if ( physicalKeyboard )
+ if( physicalKeyboard )
{
- if ( ! KeyLookup::IsDeviceButton( keyEvent.keyName.c_str() ) )
+ if( ! KeyLookup::IsDeviceButton( keyEvent.keyName.c_str() ) )
{
GetImplementation( physicalKeyboard ).KeyReceived( keyEvent.time > 1 );
}
}
// Create send KeyEvent to Core.
- mCoreEventInterface.QueueCoreEvent( keyEvent );
+ mScene.QueueEvent( keyEvent );
mCoreEventInterface.ProcessCoreEvents();
}
{
// Create WheelEvent and send to Core.
Integration::WheelEvent event( static_cast< Integration::WheelEvent::Type >(wheelEvent.type), wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp );
- mCoreEventInterface.QueueCoreEvent( event );
+
+ mScene.QueueEvent( event );
mCoreEventInterface.ProcessCoreEvents();
}
void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
{
Integration::Point convertedPoint( point );
- SendEvent(convertedPoint, timeStamp);
+ SendEvent( convertedPoint, timeStamp );
}
void EventHandler::FeedWheelEvent( WheelEvent& wheelEvent )
void EventHandler::FeedEvent( Integration::Event& event )
{
- mCoreEventInterface.QueueCoreEvent( event );
+ mScene.QueueEvent( event );
mCoreEventInterface.ProcessCoreEvents();
}
event.AddPoint( point );
// First the touch event & related gesture events are queued
- mCoreEventInterface.QueueCoreEvent( event );
- mGestureManager.SendEvent( event );
+ mScene.QueueEvent( event );
+
+ mGestureManager.SendEvent( mScene, event );
// Next the events are processed with a single call into Core
mCoreEventInterface.ProcessCoreEvents();
Reset();
}
-void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
-{
- mDragAndDropDetector = detector;
-}
-
void EventHandler::SetRotationObserver( RotationObserver* observer )
{
mRotationObserver = observer;
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/point.h>
#include <dali/integration-api/events/touch-event-combiner.h>
+#include <dali/devel-api/adaptor-framework/clipboard.h>
#include <dali/devel-api/adaptor-framework/style-monitor.h>
// INTERNAL INCLUDES
-#include <dali/internal/window-system/common/damage-observer.h>
-#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
#include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
#include <dali/internal/clipboard/common/clipboard-event-notifier-impl.h>
+#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
+#include <dali/internal/system/common/core-event-interface.h>
+#include <dali/internal/window-system/common/damage-observer.h>
#include <dali/internal/window-system/common/rotation-observer.h>
#include <dali/internal/window-system/common/window-base.h>
{
class RenderSurface;
-
+class Scene;
}
namespace Internal
namespace Adaptor
{
-class CoreEventInterface;
class GestureManager;
class StyleMonitor;
*
* These TouchEvents are then passed on to Core.
*/
-class EventHandler : public ConnectionTracker
+class EventHandler : public ConnectionTracker, public Dali::RefObject
{
public:
/**
* Constructor.
- * @param[in] surface The surface where events will be sent to.
+ * @param[in] scene The scene where events will be sent to.
* @param[in] coreEventInterface Used to send events to Core.
* @param[in] gestureManager The Gesture Manager.
* @param[in] damageObserver The damage observer (to pass damage events to).
- * @param[in] dndDetector The Drag & Drop listener (to pass DnD events to).
*/
- EventHandler( Integration::RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector );
+ EventHandler( Dali::Integration::Scene scene, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver );
/**
* Destructor.
void Resume();
/**
- * Sets the Drag & Drop detector.
- * @param[in] detector An intrusive pointer to the Drag & Drop listener to set. To unset pass in NULL.
- */
- void SetDragAndDropDetector( DragAndDropDetectorPtr detector );
-
- /**
* Set the rotation observer (note, some adaptors may not have a rotation observer)
* @param[in] observer The rotation observer
*/
private:
+ Dali::Integration::Scene mScene; ///< The scene the event handler is created for.
CoreEventInterface& mCoreEventInterface; ///< Used to send events to Core.
Dali::Integration::TouchEventCombiner mCombiner; ///< Combines multi-touch events.
GestureManager& mGestureManager; ///< Reference to the GestureManager, set on construction, to send touch events to for analysis.
DamageObserver& mDamageObserver; ///< Reference to the DamageObserver, set on construction, to sent damage events to.
RotationObserver* mRotationObserver; ///< Pointer to rotation observer, if present.
- DragAndDropDetectorPtr mDragAndDropDetector; ///< Pointer to the drag & drop detector, to send Drag & Drop events to.
Dali::AccessibilityAdaptor mAccessibilityAdaptor; ///< Pointer to the accessibility adaptor
Dali::ClipboardEventNotifier mClipboardEventNotifier; ///< Pointer to the clipboard event notifier
Dali::Clipboard mClipboard;///< Pointer to the clipboard
void Orientation::SetAdaptor(Dali::Adaptor& adaptor)
{
- Adaptor& adaptorImpl = Adaptor::GetImplementation(adaptor);
- adaptorImpl.SetRotationObserver(this);
+ SetAdaptor( Adaptor::GetImplementation( adaptor ) );
+}
+
+void Orientation::SetAdaptor(Adaptor& adaptor)
+{
+ adaptor.SetRotationObserver(this);
}
int Orientation::GetDegrees() const
namespace Adaptor
{
+class Adaptor;
class Window;
class Orientation;
void SetAdaptor(Dali::Adaptor& adaptor);
/**
+ * Set the adaptor for basic setup
+ * @param[in] adaptor The adaptor
+ */
+ void SetAdaptor(Adaptor& adaptor);
+
+ /**
* Returns the actual orientation in degrees
* @return The device's orientation
*/
// INTERNAL HEADERS
#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
-#include <dali/internal/window-system/common/window-visibility-observer.h>
+#include <dali/internal/window-system/common/event-handler.h>
#include <dali/internal/window-system/common/orientation-impl.h>
#include <dali/internal/window-system/common/render-surface-factory.h>
#include <dali/internal/window-system/common/window-factory.h>
#include <dali/internal/window-system/common/window-base.h>
#include <dali/internal/window-system/common/window-render-surface.h>
+#include <dali/internal/window-system/common/window-visibility-observer.h>
namespace Dali
{
mSurface( nullptr ),
mWindowBase(),
mStarted( false ),
+ mIsTransparent( false ),
mIsFocusAcceptable( true ),
mVisible( true ),
mIconified( false ),
if ( mAdaptor )
{
mAdaptor->RemoveObserver( *this );
- mAdaptor->SetDragAndDropDetector( NULL );
mAdaptor->RemoveWindow( this );
mAdaptor = NULL;
}
- mSurface.reset( nullptr );
+ // Do we need to do it?
+ mEventHandler->SetRotationObserver( nullptr );
}
void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
void Window::SetAdaptor(Dali::Adaptor& adaptor)
{
- DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
+ Window::SetAdaptor( Internal::Adaptor::Adaptor::GetImplementation( adaptor ) );
+}
+
+void Window::SetAdaptor(Adaptor& adaptor)
+{
+ if( mStarted )
+ {
+ return;
+ }
+
mStarted = true;
+ // Create scene for the window
PositionSize positionSize = mSurface->GetPositionSize();
- mScene = Dali::Integration::Scene::New( Vector2(positionSize.width, positionSize.height) );
+ mScene = Dali::Integration::Scene::New( Vector2( positionSize.width, positionSize.height ) );
mScene.SetSurface( *mSurface.get() );
unsigned int dpiHorizontal, dpiVertical;
mSurface->GetDpi( dpiHorizontal, dpiVertical );
mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
- // Create one overlay for the main window only
- Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
- mAdaptor = &adaptorImpl;
+ // Add the window to the adaptor observers
+ mAdaptor = &adaptor;
mAdaptor->AddObserver( *this );
// Can only create the detector when we know the Core has been instantiated.
mDragAndDropDetector = DragAndDropDetector::New();
- mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) );
if( mOrientation )
{
- mOrientation->SetAdaptor(adaptor);
+ mOrientation->SetAdaptor( adaptor );
}
mSurface->SetAdaptor( *mAdaptor );
+
+ mEventHandler = EventHandlerPtr(
+ new EventHandler( mScene, *mAdaptor, *mAdaptor->GetGestureManager(), *mAdaptor ) );
}
-WindowRenderSurface* Window::GetSurface()
+WindowRenderSurface* Window::GetSurface() const
{
return mSurface.get();
}
+void Window::SetSurface(WindowRenderSurface* surface)
+{
+ mSurface.reset( surface );
+
+ mScene.SetSurface( *mSurface.get() );
+
+ unsigned int dpiHorizontal, dpiVertical;
+ dpiHorizontal = dpiVertical = 0;
+
+ mSurface->GetDpi( dpiHorizontal, dpiVertical );
+ mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+
+ mSurface->SetAdaptor( *mAdaptor );
+}
+
void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
{
}
void Window::SetClass( std::string name, std::string className )
{
+ mName = name;
+ mClassName = className;
mWindowBase->SetClass( name, className );
}
+std::string Window::GetName() const
+{
+ return mName;
+}
+
+std::string Window::GetClassName() const
+{
+ return mClassName;
+}
+
void Window::Raise()
{
mWindowBase->Raise();
}
}
+Dali::Layer Window::GetRootLayer()
+{
+ return mScene.GetRootLayer();
+}
+
void Window::SetTransparency( bool transparent )
{
mSurface->SetTransparency( transparent );
return mId;
}
+void Window::FeedTouchPoint( TouchPoint& point, int timeStamp )
+{
+ if( mEventHandler )
+ {
+ mEventHandler->FeedTouchPoint( point, timeStamp );
+ }
+}
+
+void Window::FeedWheelEvent( WheelEvent& wheelEvent )
+{
+ if( mEventHandler )
+ {
+ mEventHandler->FeedWheelEvent( wheelEvent );
+ }
+}
+
+void Window::FeedKeyEvent( KeyEvent& keyEvent )
+{
+ if( mEventHandler )
+ {
+ mEventHandler->FeedKeyEvent( keyEvent );
+ }
+}
+
+void Window::Pause()
+{
+ if( mEventHandler )
+ {
+ mEventHandler->Pause();
+ }
+}
+
+void Window::Resume()
+{
+ if( mEventHandler )
+ {
+ mEventHandler->Resume();
+ }
+}
+
+bool Window::SetRotationObserver( RotationObserver* observer )
+{
+ if( mEventHandler )
+ {
+ mEventHandler->SetRotationObserver( observer );
+ return true;
+ }
+
+ return false;
+}
+
+
} // Adaptor
} // Internal
#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/adaptor-framework/key-grab.h>
#include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
namespace Dali
{
{
namespace Adaptor
{
+class EventHandler;
class Orientation;
+class RotationObserver;
class WindowRenderSurface;
class WindowBase;
class Window;
-typedef IntrusivePtr<Window> WindowPtr;
-typedef IntrusivePtr<Orientation> OrientationPtr;
+using WindowPtr = IntrusivePtr< Window >;
+using OrientationPtr = IntrusivePtr< Orientation >;
+using EventHandlerPtr = IntrusivePtr< EventHandler >;
/**
* Window provides a surface to render onto with orientation & indicator properties.
void SetAdaptor(Dali::Adaptor& adaptor);
/**
+ * Pass the adaptor back to the overlay. This allows the window to access Core's overlay.
+ * @param[in] adaptor implementation An initialized adaptor implementation
+ */
+ void SetAdaptor(Adaptor& adaptor);
+
+ /**
* Get the window surface
* @return The render surface
*/
- WindowRenderSurface* GetSurface();
+ WindowRenderSurface* GetSurface() const;
+
+ /**
+ * Set the window surface
+ * @param[in] surface The surface
+ */
+ void SetSurface(WindowRenderSurface* surface);
/**
* @copydoc Dali::Window::ShowIndicator()
void SetClass( std::string name, std::string className );
/**
+ * @brief Gets the window name.
+ * @return The name of the window
+ */
+ std::string GetName() const;
+
+ /**
+ * @brief Gets the window class name.
+ * @return The class of the window
+ */
+ std::string GetClassName() const;
+
+ /**
* @copydoc Dali::Window::Raise()
*/
void Raise();
void SetPositionSize( PositionSize positionSize );
/**
+ * @copydoc Dali::DevelWindow::GetRootLayer()
+ */
+ Dali::Layer GetRootLayer();
+
+ /**
* @copydoc Dali::Window::SetTransparency()
*/
void SetTransparency( bool transparent );
*/
uint32_t GetId() const;
+ /**
+ * Feed (Send) touch event to core and gesture manager
+ * @param[in] touchEvent The touch event holding the touch point information.
+ */
+ void FeedTouchPoint( TouchPoint& point, int timeStamp );
+
+ /**
+ * Feed (Send) wheel event to core and gesture manager
+ * @param[in] wheelEvent The wheel event
+ */
+ void FeedWheelEvent( WheelEvent& wheelEvent );
+
+ /**
+ * Feed (Send) key event to core
+ * @param[in] keyEvent The key event holding the key information.
+ */
+ void FeedKeyEvent( KeyEvent& keyEvent );
+
+ /**
+ * Called when the adaptor is paused.
+ */
+ void Pause();
+
+ /**
+ * Called when the adaptor is resumed (from pause).
+ */
+ void Resume();
+
+ /**
+ * Set the rotation observer (note, some adaptors may not have a rotation observer)
+ * @param[in] observer The rotation observer
+ * @return If the rotation observer is set
+ */
+ bool SetRotationObserver( RotationObserver* observer );
+
private:
/**
*/
SignalType& DeleteRequestSignal() { return mDeleteRequestSignal; }
+ /**
+ * @copydoc Dali::Window::SignalEventProcessingFinished()
+ */
+ Dali::DevelWindow::EventProcessingFinishedSignalType& EventProcessingFinishedSignal() { return mScene.EventProcessingFinishedSignal(); };
+
+ /**
+ * @copydoc Dali::Window::KeyEventSignal()
+ */
+ Dali::DevelWindow::KeyEventSignalType& KeyEventSignal() { return mScene.KeyEventSignal(); };
+
+ /**
+ * @copydoc Dali::Window::TouchSignal()
+ */
+ Dali::DevelWindow::TouchSignalType& TouchSignal() { return mScene.TouchSignal(); };
+
+ /**
+ * @copydoc Dali::Window::WheelEventSignal()
+ */
+ Dali::DevelWindow::WheelEventSignalType& WheelEventSignal() { return mScene.WheelEventSignal(); };
+
private:
static uint32_t mWindowCounter; ///< A counter to track the window creation
uint32_t mId; ///< A unique ID to identify the window starting from 0
- std::unique_ptr< WindowRenderSurface > mSurface;
+ std::unique_ptr< WindowRenderSurface >mSurface; ///< The window rendering surface
Dali::Integration::Scene mScene;
WindowBase* mWindowBase;
+ std::string mName;
+ std::string mClassName;
bool mStarted:1;
bool mIsTransparent:1;
bool mIsFocusAcceptable:1;
std::vector<Dali::Window::WindowOrientation> mAvailableOrientations;
Dali::Window::WindowOrientation mPreferredOrientation;
+ EventHandlerPtr mEventHandler; ///< The window events handler
+
Vector4 mBackgroundColor;
// Signals
- IndicatorSignalType mIndicatorVisibilityChangedSignal;
- FocusSignalType mFocusChangedSignal;
- ResizedSignalType mResizedSignal;
- SignalType mDeleteRequestSignal;
+ IndicatorSignalType mIndicatorVisibilityChangedSignal;
+ FocusSignalType mFocusChangedSignal;
+ ResizedSignalType mResizedSignal;
+ SignalType mDeleteRequestSignal;
+
+
};
} // namespace Adaptor