From 78bcafeddfeba182ea0207a898486c6cded4d00c Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Tue, 25 Nov 2014 15:20:48 +0000 Subject: [PATCH] Added public API to get native window handle from Window Change-Id: Ib4aca5cd77d84710ce6d7f37f77104e6596ad555 --- adaptors/common/window-impl.h | 5 +++++ adaptors/public-api/adaptor-framework/window.cpp | 5 +++++ adaptors/public-api/adaptor-framework/window.h | 8 ++++++++ adaptors/wayland/window-impl-wl.cpp | 12 ++++++++++++ adaptors/x11/window-impl-x.cpp | 12 ++++++++++++ 5 files changed, 42 insertions(+) diff --git a/adaptors/common/window-impl.h b/adaptors/common/window-impl.h index d0ce07b..0ba73f9 100644 --- a/adaptors/common/window-impl.h +++ b/adaptors/common/window-impl.h @@ -161,6 +161,11 @@ public: Dali::DragAndDropDetector GetDragAndDropDetector() const; /** + * @copydoc Dali::Window::GetNativeHandle() const + */ + Dali::Any GetNativeHandle() const; + + /** * Called from Orientation after the Change signal has been sent */ void RotationDone( int orientation, int width, int height ); diff --git a/adaptors/public-api/adaptor-framework/window.cpp b/adaptors/public-api/adaptor-framework/window.cpp index 31a271a..97998d0 100644 --- a/adaptors/public-api/adaptor-framework/window.cpp +++ b/adaptors/public-api/adaptor-framework/window.cpp @@ -131,6 +131,11 @@ DragAndDropDetector Window::GetDragAndDropDetector() const return GetImplementation(*this).GetDragAndDropDetector(); } +Any Window::GetNativeHandle() const +{ + return GetImplementation(*this).GetNativeHandle(); +} + Window::Window( Internal::Adaptor::Window* window ) : BaseHandle( window ) { diff --git a/adaptors/public-api/adaptor-framework/window.h b/adaptors/public-api/adaptor-framework/window.h index 5e24855..94e749e 100644 --- a/adaptors/public-api/adaptor-framework/window.h +++ b/adaptors/public-api/adaptor-framework/window.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace Dali { @@ -232,6 +233,13 @@ public: */ DragAndDropDetector GetDragAndDropDetector() const; + /** + * @brief Get the native handle of the window. + * @return The native handle of the window or an empty handle. + */ + + Any GetNativeHandle() const; + public: // Not intended for application developers /** * @brief This constructor is used by Dali::Application::GetWindow(). diff --git a/adaptors/wayland/window-impl-wl.cpp b/adaptors/wayland/window-impl-wl.cpp index 6bc1d56..e4f9f8f 100644 --- a/adaptors/wayland/window-impl-wl.cpp +++ b/adaptors/wayland/window-impl-wl.cpp @@ -358,6 +358,18 @@ Dali::DragAndDropDetector Window::GetDragAndDropDetector() const return mDragAndDropDetector; } +Dali::Any Window::GetNativeHandle() const +{ + if(mEventHandler) + { + return mEventHandler->mEcoreWindow; + } + else + { + return Dali::Any(); + } +} + void Window::OnStart() { DoShowIndicator( mIndicatorOrientation ); diff --git a/adaptors/x11/window-impl-x.cpp b/adaptors/x11/window-impl-x.cpp index be3bf51..af157e6 100644 --- a/adaptors/x11/window-impl-x.cpp +++ b/adaptors/x11/window-impl-x.cpp @@ -553,6 +553,18 @@ Dali::DragAndDropDetector Window::GetDragAndDropDetector() const return mDragAndDropDetector; } +Dali::Any Window::GetNativeHandle() const +{ + if(mEventHandler) + { + return mEventHandler->mEcoreWindow; + } + else + { + return Dali::Any(); + } +} + void Window::OnStart() { DoShowIndicator( mIndicatorOrientation ); -- 2.7.4