virtual Accessible* FindByPath(const std::string& path) const = 0;
/**
+ * @brief Notifies accessibility dbus that window has just been created.
+ *
+ * @param[in] window The window to be created
+ */
+ virtual void WindowCreated(Window window) = 0;
+
+ /**
* @brief Notifies accessibility dbus that window has just been shown.
*
* @param[in] window The window to be shown
return GetImplementation(*this).RemoveListener(target);
}
+bool DragAndDrop::AddListener(Dali::Window target, DragAndDropFunction callback)
+{
+ return GetImplementation(*this).AddListener(target, callback);
+}
+
+bool DragAndDrop::RemoveListener(Dali::Window target)
+{
+ return GetImplementation(*this).RemoveListener(target);
+}
+
} // namespace Dali
*/
bool RemoveListener(Dali::Actor target);
+ /**
+ * @brief Add the listener for receiving the drag and drop events.
+ *
+ * @param[in] target The drop target object.
+ * @param[in] callback A drag and drop event callback.
+ * @return bool true if the listener is added successfully.
+ */
+ bool AddListener(Dali::Window target, DragAndDropFunction callback);
+
+ /**
+ * @brief Remove the listener.
+ *
+ * @param[in] target The drop target object.
+ * @return bool true if the listener is removed successfully.
+ */
+ bool RemoveListener(Dali::Window target);
+
public:
/**
* @brief This constructor is used by Adaptor::GetDragAndDrop().
return GetImplementation(window).GetLastTouchEvent();
}
+const HoverEvent& GetLastHoverEvent(Window window)
+{
+ return GetImplementation(window).GetLastHoverEvent();
+}
+
bool PointerConstraintsLock(Window window)
{
return GetImplementation(window).PointerConstraintsLock();
{
class KeyEvent;
class TouchEvent;
+class HoverEvent;
class WheelEvent;
class RenderTaskList;
struct TouchPoint;
DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
/**
+ * @brief Gets the last hover event the window gets.
+ *
+ * @param[in] window The window instance.
+ * @return The last hover event the window gets.
+ * @note It returns the raw event the window gets. There is no hit-actor and local position information.
+ */
+DALI_ADAPTOR_API const HoverEvent& GetLastHoverEvent(Window window);
+
+/**
* @brief Sets the pointer constraints lock.
*
* @param[in] window The window instance.
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/touch-integ.h>
#include <dali/integration-api/events/wheel-event-integ.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/layer.h>
SceneHolder::SceneHolder()
: mLifeCycleObserver(new SceneHolderLifeCycleObserver(mAdaptor)),
+ mLastTouchEvent(),
+ mLastHoverEvent(),
mId(mSceneHolderCounter++),
mSurface(nullptr),
mAdaptor(nullptr),
// First the touch and/or hover event & related gesture events are queued
if(type == Integration::TouchEventCombiner::DISPATCH_TOUCH || type == Integration::TouchEventCombiner::DISPATCH_BOTH)
{
+ mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
mScene.QueueEvent(touchEvent);
}
if(type == Integration::TouchEventCombiner::DISPATCH_HOVER || type == Integration::TouchEventCombiner::DISPATCH_BOTH)
{
+ mLastHoverEvent = Dali::Integration::NewHoverEvent(timeStamp, point);
mScene.QueueEvent(hoverEvent);
}
}
}
+const Dali::TouchEvent& SceneHolder::GetLastTouchEvent() const
+{
+ return mLastTouchEvent;
+}
+
+const Dali::HoverEvent& SceneHolder::GetLastHoverEvent() const
+{
+ return mLastHoverEvent;
+}
+
void SceneHolder::FeedWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
{
// Signals can be emitted while processing core events, and the scene holder could be deleted in the signal callback.
// EXTERNAL INCLUDES
#include <dali/graphics-api/graphics-controller.h>
+#include <dali/integration-api/events/hover-event-integ.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/integration-api/scene.h>
#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/events/hover-event.h>
+#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/math/uint-16-pair.h>
#include <dali/public-api/object/base-object.h>
#include <atomic>
void FeedTouchPoint(Dali::Integration::Point& point, int timeStamp);
/**
+ * @brief Get the Last Touch Event
+ *
+ * @return Dali::TouchEvent
+ */
+ const Dali::TouchEvent& GetLastTouchEvent() const;
+
+ /**
+ * @brief Get the Last Hover Event
+ *
+ * @return Dali::HoverEvent
+ */
+ const Dali::HoverEvent& GetLastHoverEvent() const;
+
+ /**
* @copydoc Dali::Integration::SceneHolder::FeedWheelEvent
*/
void FeedWheelEvent(Dali::Integration::WheelEvent& wheelEvent);
class SceneHolderLifeCycleObserver;
std::unique_ptr<SceneHolderLifeCycleObserver> mLifeCycleObserver; ///< The adaptor life cycle observer
+ Dali::TouchEvent mLastTouchEvent;
+ Dali::HoverEvent mLastHoverEvent;
protected:
uint32_t mId; ///< A unique ID to identify the SceneHolder starting from 0
}
/**
+ * @brief Sends a signal to dbus that the window is created.
+ *
+ * @param[in] window The window to be created
+ * @see BridgeObject::Emit()
+ */
+ void EmitCreated(Dali::Window window)
+ {
+ auto windowAccessible = mApplication.GetWindowAccessible(window);
+ if(windowAccessible)
+ {
+ windowAccessible->Emit(WindowEvent::CREATE, 0);
+ }
+ }
+
+ /**
* @brief Sends a signal to dbus that the window is shown.
*
* @param[in] window The window to be shown
}
/**
+ * @copydoc Dali::Accessibility::Bridge::WindowCreated()
+ */
+ void WindowCreated(Dali::Window window) override
+ {
+ if(IsUp())
+ {
+ EmitCreated(window);
+ }
+ }
+
+ /**
* @copydoc Dali::Accessibility::Bridge::WindowShown()
*/
void WindowShown(Dali::Window window) override
return nullptr;
}
+ void WindowCreated(Window window) override
+ {
+ }
+
void WindowShown(Window window) override
{
}
}
//////////////////////////////
- // TextureUploadRequest
+ // TextureUploadRequest (phase #1)
//////////////////////////////
// Upload requested resources after resource context activated.
}
}
+ //////////////////////////////
+ // TextureUploadRequest (phase #2)
+ //////////////////////////////
+
+ // Upload requested resources after resource context activated.
graphics.ActivateResourceContext();
+ // Since uploadOnly value used at Update side, we should not change uploadOnly value now even some textures are uploaded.
+ mTextureUploadManager.ResourceUpload();
+
if(mFirstFrameAfterResume)
{
// mFirstFrameAfterResume is set to true when the thread is resumed
mDataSelectedSignal.Emit(selectedType);
}
- uint32_t mSerial{0u};
+ uint32_t mSerial{std::numeric_limits<uint32_t>::max()};
std::string mMimeType;
std::string mData;
Ecore_Event_Handler* mSendHandler{nullptr};
virtual bool RemoveListener(Dali::Actor target) = 0;
/**
+ * @copydoc Dali::DragAndDrop::AddListener()
+ */
+ virtual bool AddListener(Dali::Window window, Dali::DragAndDrop::DragAndDropFunction callback) = 0;
+
+ /**
+ * @copydoc Dali::DragAndDrop::RemoveListener()
+ */
+ virtual bool RemoveListener(Dali::Window target) = 0;
+
+ /**
* @copydoc Dali::DragAndDrop::SendData()
*/
virtual void SendData(void* event) = 0;
return true;
}
+bool DragAndDropGeneric::AddListener(Dali::Window target, Dali::DragAndDrop::DragAndDropFunction callback)
+{
+ return true;
+}
+
+bool DragAndDropGeneric::RemoveListener(Dali::Window target)
+{
+ return true;
+}
+
void DragAndDropGeneric::SendData(void* event)
{
return;
bool RemoveListener(Dali::Actor target) override;
/**
+ * @copydoc Dali::DragAndDrop::AddListener()
+ */
+ bool AddListener(Dali::Window target, Dali::DragAndDrop::DragAndDropFunction callback) override;
+
+ /**
+ * @copydoc Dali::DragAndDrop::RemoveListener()
+ */
+ bool RemoveListener(Dali::Window target) override;
+
+ /**
* @copydoc Dali::DragAndDrop::SendData()
*/
void SendData(void* event) override;
return true;
}
+bool DragAndDropEcoreWl::AddListener(Dali::Window target, Dali::DragAndDrop::DragAndDropFunction callback)
+{
+ std::vector<DropWindowTarget>::iterator itr;
+ for(itr = mDropWindowTargets.begin(); itr < mDropWindowTargets.end(); itr++)
+ {
+ if((*itr).target == target)
+ {
+ return false;
+ }
+ }
+
+ int windowId = INVALID_ECORE_WL2_WINDOW_ID;
+
+ Ecore_Wl2_Window* window = AnyCast<Ecore_Wl2_Window*>(target.GetNativeHandle());
+ if(window == nullptr)
+ {
+ return false;
+ }
+ windowId = ecore_wl2_window_id_get(window);
+
+ DropWindowTarget targetData;
+ targetData.target = target;
+ targetData.callback = callback;
+ targetData.inside = false;
+ targetData.windowId = windowId;
+
+ mDropWindowTargets.push_back(targetData);
+
+ return true;
+}
+
bool DragAndDropEcoreWl::RemoveListener(Dali::Actor target)
{
std::vector<DropTarget>::iterator itr;
return true;
}
+bool DragAndDropEcoreWl::RemoveListener(Dali::Window target)
+{
+ std::vector<DropWindowTarget>::iterator itr;
+ for(itr = mDropWindowTargets.begin(); itr < mDropWindowTargets.end(); itr++)
+ {
+ if((*itr).target == target)
+ {
+ mDropWindowTargets.erase(itr);
+ break;
+ }
+ }
+
+ return true;
+}
+
void DragAndDropEcoreWl::CallSourceEvent(Dali::DragAndDrop::SourceEventType type)
{
if(mSourceCallback)
}
mDropTargets[i].inside = false;
}
+
+ for(std::size_t i = 0; i < mDropWindowTargets.size(); i++)
+ {
+ if(mDropWindowTargets[i].inside)
+ {
+ Dali::DragAndDrop::DragEvent dragEvent;
+ dragEvent.SetAction(Dali::DragAndDrop::DragType::LEAVE);
+ Dali::Vector2 position(DEFAULT_POSITION, DEFAULT_POSITION);
+ dragEvent.SetPosition(position);
+ mDropWindowTargets[i].callback(dragEvent);
+ }
+ mDropWindowTargets[i].inside = false;
+ }
}
void DragAndDropEcoreWl::SendData(void* event)
Dali::DragAndDrop::DragEvent dragEvent(Dali::DragAndDrop::DragType::DROP, mPosition, ev->mimetype, ev->data);
mDropTargets[mTargetIndex].callback(dragEvent);
mDropTargets[mTargetIndex].inside = false;
- ecore_wl2_offer_finish(ev->offer);
}
mTargetIndex = -1;
+
+ if(mWindowTargetIndex != -1)
+ {
+ Dali::DragAndDrop::DragEvent dragEvent(Dali::DragAndDrop::DragType::DROP, mWindowPosition, ev->mimetype, ev->data);
+ mDropWindowTargets[mWindowTargetIndex].callback(dragEvent);
+ mDropWindowTargets[mWindowTargetIndex].inside = false;
+ }
+ mWindowTargetIndex = -1;
+
}
Vector2 DragAndDropEcoreWl::RecalculatePositionByOrientation(int x, int y, Dali::Window window)
}
}
+ for(std::size_t i = 0; i < mDropWindowTargets.size(); i++)
+ {
+ if(ev->win != mDropWindowTargets[i].windowId)
+ {
+ continue;
+ }
+
+ // Recalculate Cursor by Orientation
+ Dali::Window window = mDropWindowTargets[i].target;
+ Dali::Window::WindowPosition position = window.GetPosition();
+ Dali::Window::WindowSize size = window.GetSize();
+
+ bool currentInside = IsIntersection(ev->x + position.GetX(), ev->y + position.GetY(), position.GetX(), position.GetY(), size.GetWidth(), size.GetHeight());
+
+ // Calculate Drag Enter, Leave, Move Event
+ if(currentInside && !mDropWindowTargets[i].inside)
+ {
+ mDropWindowTargets[i].inside = true;
+ // Call Enter Event
+ dragEvent.SetAction(Dali::DragAndDrop::DragType::ENTER);
+ dragEvent.SetPosition(curPosition);
+ mDropWindowTargets[i].callback(dragEvent);
+ // Accept Offer
+ ecore_wl2_offer_mimes_set(ev->offer, ecore_wl2_offer_mimes_get(ev->offer));
+ }
+ else if(!currentInside && mDropWindowTargets[i].inside)
+ {
+ mDropWindowTargets[i].inside = false;
+ // Call Leave Event
+ dragEvent.SetAction(Dali::DragAndDrop::DragType::LEAVE);
+ dragEvent.SetPosition(curPosition);
+ mDropWindowTargets[i].callback(dragEvent);
+ // Reject Offer
+ ecore_wl2_offer_accept(ev->offer, NULL);
+ }
+ else if(currentInside && mDropWindowTargets[i].inside)
+ {
+ // Call Move Event
+ dragEvent.SetAction(Dali::DragAndDrop::DragType::MOVE);
+ dragEvent.SetPosition(curPosition);
+ mDropWindowTargets[i].callback(dragEvent);
+ }
+ }
+
return true;
}
// Check the target object region
mTargetIndex = -1;
+ mWindowTargetIndex = -1;
for(std::size_t i = 0; i < mDropTargets.size(); i++)
{
}
}
+ for(std::size_t i = 0; i < mDropWindowTargets.size(); i++)
+ {
+ if(ev->win != mDropWindowTargets[i].windowId)
+ {
+ continue;
+ }
+
+ // Recalculate Cursor by Orientation
+ Dali::Window window = mDropWindowTargets[i].target;
+ Dali::Window::WindowPosition position = window.GetPosition();
+ Dali::Window::WindowSize size = window.GetSize();
+
+ // If the drop position is in the target object region, request drop data to the source object
+ if(IsIntersection(ev->x + position.GetX(), ev->y + position.GetY(), position.GetX(), position.GetY(), size.GetWidth(), size.GetHeight()))
+ {
+ mWindowTargetIndex = i;
+ mWindowPosition = Dali::Vector2(position.GetX(), position.GetY());
+
+ char* mimetype = (char*)eina_array_data_get(ecore_wl2_offer_mimes_get(ev->offer), 0);
+ if(mimetype)
+ {
+ ecore_wl2_offer_receive(ev->offer, mimetype);
+ Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
+ Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
+ ecore_wl2_display_flush(ecore_wl2_input_display_get(input));
+ }
+ return true;
+ }
+ }
+
return false;
}
int parentWindowId;
};
+struct DropWindowTarget
+{
+ Dali::Window target;
+ Dali::DragAndDrop::DragAndDropFunction callback;
+ bool inside;
+ int windowId;
+};
+
/**
* DragAndDrop Implementation
*/
bool AddListener(Dali::Actor target, Dali::DragAndDrop::DragAndDropFunction callback) override;
/**
+ * @copydoc Dali::DragAndDrop::AddListener()
+ */
+ bool AddListener(Dali::Window target, Dali::DragAndDrop::DragAndDropFunction callback) override;
+
+ /**
* @copydoc Dali::DragAndDrop::RemoveListener()
*/
bool RemoveListener(Dali::Actor target) override;
/**
+ * @copydoc Dali::DragAndDrop::RemoveListener()
+ */
+ bool RemoveListener(Dali::Window target) override;
+
+ /**
* @copydoc Dali::DragAndDrop::SendData()
*/
void SendData(void* event) override;
private:
Dali::Window mDragWindow;
- uint32_t mSerial{0u};
+ uint32_t mSerial{std::numeric_limits<uint32_t>::max()};
Ecore_Event_Handler* mSendHandler{nullptr};
Ecore_Event_Handler* mSourceEndHandler{nullptr};
Ecore_Event_Handler* mSourceDropHandler{nullptr};
Ecore_Event_Handler* mDropHandler{nullptr};
Ecore_Event_Handler* mEnterHandler{nullptr};
Ecore_Event_Handler* mLeaveHandler{nullptr};
- int mTargetIndex{0};
+ int mTargetIndex{-1};
+ int mWindowTargetIndex{-1};
std::string mMimeType;
std::string mData;
int mDataSize{0};
Dali::Vector2 mPosition;
+ Dali::Vector2 mWindowPosition;
Dali::DragAndDrop::SourceFunction mSourceCallback{nullptr};
std::vector<DropTarget> mDropTargets;
+ std::vector<DropWindowTarget> mDropWindowTargets;
}; // class DragAndDropEcoreWl
} // namespace Adaptor
return Any(mPixmap);
}
-bool NativeImageSourceAndroid::GetPixels(std::vector<unsigned char>& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const
+bool NativeImageSourceAndroid::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const
{
- DALI_ASSERT_DEBUG(sizeof(unsigned) == 4);
+ DALI_ASSERT_DEBUG(sizeof(uint32_t) == 4);
bool success = false;
width = mWidth;
uint32_t size = dstStride * bufferDescription.height;
pixbuf.resize(size);
//copy each row over
- const unsigned char* ptrSrc = reinterpret_cast<const unsigned char*>(buffer);
- unsigned char* ptrDst = pixbuf.data();
+ const uint8_t* ptrSrc = reinterpret_cast<const uint8_t*>(buffer);
+ uint8_t* ptrDst = pixbuf.data();
for(int y = 0; y < bufferDescription.height; y++, ptrSrc += srcStride, ptrDst += dstStride)
{
memcpy(ptrDst, ptrSrc, dstStride);
/**
* @copydoc Dali::NativeImageSource::GetPixels()
*/
- bool GetPixels(std::vector<unsigned char>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
+ bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
{
namespace Adaptor
{
-NativeBitmapBuffer::NativeBitmapBuffer(Adaptor* adaptor, unsigned int width, unsigned int height, Pixel::Format pFormat)
+NativeBitmapBuffer::NativeBitmapBuffer(Adaptor* adaptor, uint32_t width, uint32_t height, Pixel::Format pFormat)
: mGlAbstraction(nullptr),
mWidth(width),
mHeight(height),
Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat);
- const unsigned char* buf = mBuffer->Read();
+ const uint8_t* buf = mBuffer->Read();
if(buf && buf != mLastReadBuffer) // Prevent same buffer being uploaded multiple times
{
}
}
-void NativeBitmapBuffer::Write(const unsigned char* src, size_t size)
+void NativeBitmapBuffer::Write(const uint8_t* src, size_t size)
{
mBuffer->Write(src, size); // Write will cause LocklessBuffer to switch to the other buffer
}
{
}
-unsigned int NativeBitmapBuffer::TargetTexture()
+uint32_t NativeBitmapBuffer::TargetTexture()
{
return 0;
}
-unsigned int NativeBitmapBuffer::GetWidth() const
+uint32_t NativeBitmapBuffer::GetWidth() const
{
return mWidth;
}
-unsigned int NativeBitmapBuffer::GetHeight() const
+uint32_t NativeBitmapBuffer::GetHeight() const
{
return mHeight;
}
* @param height height of image
* @param pixelFormat pixel format for image
*/
- NativeBitmapBuffer(Adaptor* adaptor, unsigned int width, unsigned int height, Pixel::Format pixelFormat);
+ NativeBitmapBuffer(Adaptor* adaptor, uint32_t width, uint32_t height, Pixel::Format pixelFormat);
/**
* virtual destructor
* @param[in] size size of data in bytes
* @return true if successful, false if currently reading from buffer in render thread
*/
- void Write(const unsigned char* src, size_t size);
+ void Write(const uint8_t* src, size_t size);
public:
/**
/**
* @copydoc Dali::NativeImageInterface::TargetTexture()
*/
- unsigned int TargetTexture() override;
+ uint32_t TargetTexture() override;
/**
* @copydoc Dali::NativeImageInterface::PrepareTexture()
/**
* @copydoc Dali::NativeImageInterface::GetWidth()
*/
- unsigned int GetWidth() const override;
+ uint32_t GetWidth() const override;
/**
* @copydoc Dali::NativeImageInterface::GetHeight()
*/
- unsigned int GetHeight() const override;
+ uint32_t GetHeight() const override;
/**
* @copydoc Dali::NativeImageInterface::RequiresBlending()
Integration::GlAbstraction* mGlAbstraction; ///< GlAbstraction used
Integration::LocklessBuffer* mBuffer; ///< bitmap data double buffered
- unsigned int mWidth; ///< Image width
- unsigned int mHeight; ///< Image height
+ uint32_t mWidth; ///< Image width
+ uint32_t mHeight; ///< Image height
Pixel::Format mPixelFormat; ///< Image pixelformat
- const unsigned char* mLastReadBuffer; ///< last buffer that was read
+ const uint8_t* mLastReadBuffer; ///< last buffer that was read
};
} // namespace Adaptor
/**
* @copydoc Dali::NativeImageSource::GetPixels()
*/
- virtual bool GetPixels(std::vector<unsigned char>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const = 0;
+ virtual bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const = 0;
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
{
std::unique_ptr<NativeImageSource>
NativeImageSourceFactoryCocoa::CreateNativeImageSource(
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource)
{
std::unique_ptr<NativeImageSourceQueue>
NativeImageSourceFactoryCocoa::CreateNativeImageSourceQueue(
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Dali::NativeImageSourceQueue::ColorFormat colorFormat,
Any nativeImageSourceQueue)
{
{
public:
std::unique_ptr<NativeImageSource> CreateNativeImageSource(
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource) override;
std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Dali::NativeImageSourceQueue::ColorFormat colorFormat,
Any nativeImageSourceQueue) override;
};
using Dali::Integration::PixelBuffer;
NativeImageSourceCocoa* NativeImageSourceCocoa::New(
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource)
{
}
NativeImageSourceCocoa::NativeImageSourceCocoa(
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource)
: mImage(MakeRef<CGImageRef>(nullptr)),
bool NativeImageSourceCocoa::GetPixels(
std::vector<uint8_t>& pixbuf,
- unsigned& width,
- unsigned& height,
+ uint32_t& width,
+ uint32_t& height,
Pixel::Format& pixelFormat) const
{
- width = CGImageGetWidth(mImage.get());
- height = CGImageGetHeight(mImage.get());
+ width = static_cast<uint32_t>(CGImageGetWidth(mImage.get()));
+ height = static_cast<uint32_t>(CGImageGetHeight(mImage.get()));
return true;
}
{
}
-unsigned int NativeImageSourceCocoa::TargetTexture()
+uint32_t NativeImageSourceCocoa::TargetTexture()
{
return 0;
}
return Any(mImage.get());
}
-unsigned int NativeImageSourceCocoa::GetWidth() const
+uint32_t NativeImageSourceCocoa::GetWidth() const
{
- return CGImageGetWidth(mImage.get());
+ return static_cast<uint32_t>(CGImageGetWidth(mImage.get()));
}
-unsigned int NativeImageSourceCocoa::GetHeight() const
+uint32_t NativeImageSourceCocoa::GetHeight() const
{
- return CGImageGetHeight(mImage.get());
+ return static_cast<uint32_t>(CGImageGetHeight(mImage.get()));
}
bool NativeImageSourceCocoa::RequiresBlending() const
* @return A smart-pointer to a newly allocated image.
*/
static NativeImageSourceCocoa* New(
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource);
* @copydoc Dali::NativeImageSource::GetPixels()
*/
bool GetPixels(
- std::vector<unsigned char>& pixbuf,
- unsigned int& width,
- unsigned int& height,
- Pixel::Format& pixelFormat) const override;
+ std::vector<uint8_t>& pixbuf,
+ uint32_t& width,
+ uint32_t& height,
+ Pixel::Format& pixelFormat) const override;
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
/**
* @copydoc Dali::NativeImageSource::TargetTexture()
*/
- unsigned int TargetTexture() override;
+ uint32_t TargetTexture() override;
/**
* @copydoc Dali::NativeImageSource::PrepareTexture()
/**
* @copydoc Dali::NativeImageSource::GetWidth()
*/
- unsigned int GetWidth() const override;
+ uint32_t GetWidth() const override;
/**
* @copydoc Dali::NativeImageSource::GetHeight()
*/
- unsigned int GetHeight() const override;
+ uint32_t GetHeight() const override;
/**
* @copydoc Dali::NativeImageSource::RequiresBlending()
* @param[in] nativeImageSource contains either: pixmap of type Win32 Pixmap , a WinPixmap or is empty
*/
NativeImageSourceCocoa(
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource);
return Any(mTbmSurface);
}
-bool NativeImageSourceTizen::GetPixels(std::vector<unsigned char>& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const
+bool NativeImageSourceTizen::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const
{
std::scoped_lock lock(mMutex);
if(mTbmSurface != NULL)
return false;
}
- tbm_format format = surface_info.format;
- uint32_t stride = surface_info.planes[0].stride;
- unsigned char* ptr = surface_info.planes[0].ptr;
+ tbm_format format = surface_info.format;
+ uint32_t stride = surface_info.planes[0].stride;
+ uint8_t* ptr = surface_info.planes[0].ptr;
width = mWidth;
height = mHeight;
lineSize = width * 3;
pixelFormat = Pixel::RGB888;
pixbuf.resize(lineSize * height);
- unsigned char* bufptr = &pixbuf[0];
+ uint8_t* bufptr = &pixbuf[0];
- for(unsigned int r = 0; r < height; ++r, bufptr += lineSize)
+ for(uint32_t r = 0; r < height; ++r, bufptr += lineSize)
{
- for(unsigned int c = 0; c < width; ++c)
+ for(uint32_t c = 0; c < width; ++c)
{
cOffset = c * 3;
offset = cOffset + r * stride;
lineSize = width * 4;
pixelFormat = Pixel::RGBA8888;
pixbuf.resize(lineSize * height);
- unsigned char* bufptr = &pixbuf[0];
+ uint8_t* bufptr = &pixbuf[0];
- for(unsigned int r = 0; r < height; ++r, bufptr += lineSize)
+ for(uint32_t r = 0; r < height; ++r, bufptr += lineSize)
{
- for(unsigned int c = 0; c < width; ++c)
+ for(uint32_t c = 0; c < width; ++c)
{
cOffset = c * 4;
offset = cOffset + r * stride;
lineSize = width * 4;
pixelFormat = Pixel::RGBA8888;
pixbuf.resize(lineSize * height);
- unsigned char* bufptr = &pixbuf[0];
+ uint8_t* bufptr = &pixbuf[0];
- for(unsigned int r = 0; r < height; ++r, bufptr += lineSize)
+ for(uint32_t r = 0; r < height; ++r, bufptr += lineSize)
{
- for(unsigned int c = 0; c < width; ++c)
+ for(uint32_t c = 0; c < width; ++c)
{
cOffset = c * 4;
offset = cOffset + r * stride;
if(tbm_surface_query_formats(&formats, &formatNum))
{
- for(unsigned int i = 0; i < formatNum; i++)
+ for(uint32_t i = 0; i < formatNum; i++)
{
if(formats[i] == format)
{
return updatedArea;
}
- unsigned char* srcBuffer = info.planes[0].ptr;
- unsigned char* dstBuffer = backBufferInfo.planes[0].ptr;
+ uint8_t* srcBuffer = info.planes[0].ptr;
+ uint8_t* dstBuffer = backBufferInfo.planes[0].ptr;
uint32_t stride = info.planes[0].stride;
uint32_t bytesPerPixel = info.bpp >> 3;
/**
* @copydoc Dali::NativeImageSource::GetPixels()
*/
- bool GetPixels(std::vector<unsigned char>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
+ bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
return NULL;
}
- unsigned char* buffer = info.planes[0].ptr;
+ uint8_t* buffer = info.planes[0].ptr;
if(!buffer)
{
DALI_LOG_ERROR("tbm buffer pointer is null! [%p]\n", tbmSurface);
bool CheckBlending(int format);
private:
- typedef std::pair<tbm_surface_h, void*> EglImagePair;
- typedef std::pair<tbm_surface_h, void*> BufferPair;
+ typedef std::pair<tbm_surface_h, void*> EglImagePair;
+ typedef std::pair<tbm_surface_h, uint8_t*> BufferPair;
Dali::Mutex mMutex; ///< Mutex
uint32_t mWidth; ///< image width
return Any(mPixmap);
}
-bool NativeImageSourceX::GetPixels(std::vector<unsigned char>& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const
+bool NativeImageSourceX::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const
{
- DALI_ASSERT_DEBUG(sizeof(unsigned) == 4);
+ DALI_ASSERT_DEBUG(sizeof(uint32_t) == 4);
bool success = false;
width = mWidth;
height = mHeight;
{
pixelFormat = Pixel::RGB888;
pixbuf.resize(width * height * 3);
- unsigned char* bufPtr = &pixbuf[0];
+ uint8_t* bufPtr = &pixbuf[0];
- for(unsigned y = 0; y < height; ++y)
+ for(uint32_t y = 0; y < height; ++y)
{
- for(unsigned x = 0; x < width; ++x, bufPtr += 3)
+ for(uint32_t x = 0; x < width; ++x, bufPtr += 3)
{
- const unsigned pixel = XGetPixel(pXImage, x, y);
+ const uint32_t pixel = XGetPixel(pXImage, x, y);
// store as RGB
- const unsigned blue = pixel & 0xFFU;
- const unsigned green = (pixel >> 8) & 0xFFU;
- const unsigned red = (pixel >> 16) & 0xFFU;
+ const uint32_t blue = pixel & 0xFFU;
+ const uint32_t green = (pixel >> 8) & 0xFFU;
+ const uint32_t red = (pixel >> 16) & 0xFFU;
*bufPtr = red;
*(bufPtr + 1) = green;
// Sweep through the image, doing a vertical flip, but handling each scanline as
// an inlined intrinsic/builtin memcpy (should be fast):
pixbuf.resize(width * height * 4);
- unsigned* bufPtr = reinterpret_cast<unsigned*>(&pixbuf[0]);
- const unsigned xDataLineSkip = pXImage->bytes_per_line;
+ uint32_t* bufPtr = reinterpret_cast<uint32_t*>(&pixbuf[0]);
+ const uint32_t xDataLineSkip = pXImage->bytes_per_line;
const size_t copy_count = static_cast<size_t>(width) * 4;
pixelFormat = Pixel::BGRA8888;
- for(unsigned y = 0; y < height; ++y, bufPtr += width)
+ for(uint32_t y = 0; y < height; ++y, bufPtr += width)
{
const char* const in = pXImage->data + xDataLineSkip * y;
/**
* @copydoc Dali::NativeImageSource::GetPixels()
*/
- bool GetPixels(std::vector<unsigned char>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
+ bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
{
namespace Adaptor
{
-std::unique_ptr<NativeImageSource> NativeImageSourceFactoryWin::CreateNativeImageSource(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource)
+std::unique_ptr<NativeImageSource> NativeImageSourceFactoryWin::CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource)
{
return std::unique_ptr<NativeImageSource>(NativeImageSourceWin::New(width, height, depth, nativeImageSource));
}
-std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryWin::CreateNativeImageSourceQueue(unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
+std::unique_ptr<NativeImageSourceQueue> NativeImageSourceFactoryWin::CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
{
return std::unique_ptr<NativeImageSourceQueue>(nullptr);
}
class NativeImageSourceFactoryWin : public NativeImageSourceFactory
{
public:
- std::unique_ptr<NativeImageSource> CreateNativeImageSource(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override;
+ std::unique_ptr<NativeImageSource> CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override;
- std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
+ std::unique_ptr<NativeImageSourceQueue> CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override;
};
} // namespace Adaptor
{
using Dali::Integration::PixelBuffer;
-NativeImageSourceWin* NativeImageSourceWin::New(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource)
+NativeImageSourceWin* NativeImageSourceWin::New(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource)
{
NativeImageSourceWin* image = new NativeImageSourceWin(width, height, depth, nativeImageSource);
DALI_ASSERT_DEBUG(image && "NativeImageSource allocation failed.");
return image;
}
-NativeImageSourceWin::NativeImageSourceWin(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource)
+NativeImageSourceWin::NativeImageSourceWin(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource)
: mWidth(width),
mHeight(height),
mOwnPixmap(true),
return Any(mPixmap);
}
-bool NativeImageSourceWin::GetPixels(std::vector<uint8_t>& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const
+bool NativeImageSourceWin::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const
{
- DALI_ASSERT_DEBUG(sizeof(unsigned) == 4);
+ DALI_ASSERT_DEBUG(sizeof(uint32_t) == 4);
bool success = false;
width = mWidth;
height = mHeight;
}
}
-unsigned int NativeImageSourceWin::TargetTexture()
+uint32_t NativeImageSourceWin::TargetTexture()
{
mEglImageExtensions->TargetTextureKHR(mEglImageKHR);
#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/internal/imaging/common/native-image-source-impl.h>
+#include <cstdint>
namespace Dali
{
* @param[in] nativeImageSource contains either: pixmap of type Win32 Pixmap , a WinPixmap or is empty
* @return A smart-pointer to a newly allocated image.
*/
- static NativeImageSourceWin* New(unsigned int width,
- unsigned int height,
+ static NativeImageSourceWin* New(uint32_t width,
+ uint32_t height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource);
/**
/**
* @copydoc Dali::NativeImageSource::GetPixels()
*/
- bool GetPixels(std::vector<unsigned char>& pixbuf, unsigned int& width, unsigned int& height, Pixel::Format& pixelFormat) const override;
+ bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
/**
* @copydoc Dali::NativeImageSource::TargetTexture()
*/
- unsigned int TargetTexture() override;
+ uint32_t TargetTexture() override;
/**
* @copydoc Dali::NativeImageSource::PrepareTexture()
/**
* @copydoc Dali::NativeImageSource::GetWidth()
*/
- unsigned int GetWidth() const override
+ uint32_t GetWidth() const override
{
return mWidth;
}
/**
* @copydoc Dali::NativeImageSource::GetHeight()
*/
- unsigned int GetHeight() const override
+ uint32_t GetHeight() const override
{
return mHeight;
}
* @param[in] colour depth of the image.
* @param[in] nativeImageSource contains either: pixmap of type Win32 Pixmap , a WinPixmap or is empty
*/
- NativeImageSourceWin(unsigned int width,
- unsigned int height,
+ NativeImageSourceWin(uint32_t width,
+ uint32_t height,
Dali::NativeImageSource::ColorDepth depth,
Any nativeImageSource);
void GetPixmapDetails();
private:
- unsigned int mWidth; ///< image width
- unsigned int mHeight; ///< image heights
+ uint32_t mWidth; ///< image width
+ uint32_t mHeight; ///< image heights
bool mOwnPixmap; ///< Whether we created pixmap or not
unsigned int mPixmap; ///< From Windows
bool mBlendingRequired; ///< Whether blending is required
{
namespace
{
+constexpr auto FORCE_TRIGGER_THRESHOLD = 128u; ///< Trigger TasksCompleted() forcely if the number of completed task contain too much.
+
constexpr auto DEFAULT_NUMBER_OF_ASYNC_THREADS = size_t{8u};
constexpr auto NUMBER_OF_ASYNC_THREADS_ENV = "DALI_ASYNC_MANAGER_THREAD_POOL_SIZE";
if(task)
{
- const bool needTrigger = task->GetCallbackInvocationThread() == AsyncTask::ThreadType::MAIN_THREAD;
+ bool needTrigger = (task->GetCallbackInvocationThread() == AsyncTask::ThreadType::MAIN_THREAD);
// Lock while check validation of task.
{
CacheImpl::EraseTaskCache(mCacheImpl->mRunningTasksCache, task, iter);
mRunningTasks.erase(iter);
+ if(!needTrigger)
+ {
+ needTrigger |= (mCompletedTasks.size() >= FORCE_TRIGGER_THRESHOLD);
+ }
+
// Now, task is invalidate.
task.Reset();
}
{\r
namespace Adaptor\r
{\r
+/**\r
+ * Structure contains the callback function and control options\r
+ */\r
+struct WindowsCallbackData\r
+{\r
+ /**\r
+ * Constructor\r
+ */\r
+ WindowsCallbackData(CallbackBase* callback, bool hasReturnValue)\r
+ : mCallback(callback),\r
+ mHasReturnValue(hasReturnValue)\r
+ {\r
+ }\r
+ /**\r
+ * Destructor\r
+ */\r
+ ~WindowsCallbackData()\r
+ {\r
+ delete mCallback;\r
+ }\r
+\r
+ CallbackBase* mCallback; ///< call back\r
+ bool mHasReturnValue; ///< true if the callback function has a return value.\r
+};\r
+\r
WinCallbackManager::WinCallbackManager()\r
: mRunning(false)\r
{\r
+ mSelfCallback = MakeCallback(this, &WinCallbackManager::ProcessIdleFromFramework);\r
+}\r
+\r
+WinCallbackManager::~WinCallbackManager()\r
+{\r
+ delete mSelfCallback;\r
}\r
\r
void WinCallbackManager::Start()\r
// make sure we're not called twice\r
DALI_ASSERT_DEBUG(mRunning == true);\r
\r
+ ClearIdleCallbacks();\r
+\r
mRunning = false;\r
}\r
\r
return false;\r
}\r
\r
- mCallbacks.insert(callback);\r
+ WindowsCallbackData* callbackData = new WindowsCallbackData(callback, hasReturnValue);\r
\r
- WindowsPlatform::PostWinThreadMessage(WIN_CALLBACK_EVENT, reinterpret_cast<uint64_t>(callback), 0);\r
+ mCallbackContainer.push_back(callbackData);\r
+\r
+ if(!mSelfCallbackRegistered)\r
+ {\r
+ // Post only one times.\r
+ mSelfCallbackRegistered = true;\r
+ WindowsPlatform::PostWinThreadMessage(WIN_CALLBACK_EVENT, reinterpret_cast<uint64_t>(mSelfCallback), 0);\r
+ }\r
\r
return true;\r
}\r
\r
void WinCallbackManager::RemoveIdleCallback(CallbackBase* callback)\r
{\r
- //Wait for deal\r
+ for(auto iter = mCallbackContainer.begin(), endIter = mCallbackContainer.end(); iter != endIter; ++iter)\r
+ {\r
+ auto* callbackData = *iter;\r
+\r
+ if(callbackData->mCallback == callback)\r
+ {\r
+ // delete our data\r
+ delete callbackData;\r
+\r
+ // Set stored value as nullptr. It will be removed from container after ProcessIdle()\r
+ (*iter) = nullptr;\r
+\r
+ return;\r
+ }\r
+ }\r
}\r
\r
bool WinCallbackManager::ProcessIdle()\r
{\r
- const bool idleProcessed = !mCallbacks.empty();\r
+ mSelfCallbackRegistered = false;\r
+\r
+ const bool idleProcessed = !mCallbackContainer.empty();\r
+\r
+ for(auto iter = mCallbackContainer.begin(); iter != mCallbackContainer.end();)\r
+ {\r
+ auto* callbackData = *iter;\r
+ bool removed = true;\r
+ if(callbackData)\r
+ {\r
+ if(callbackData->mHasReturnValue)\r
+ {\r
+ const bool retValue = Dali::CallbackBase::ExecuteReturn<bool>(*(callbackData->mCallback));\r
+\r
+ // Do not remove callback if return value is true.\r
+ removed = !retValue;\r
+ }\r
+ else\r
+ {\r
+ Dali::CallbackBase::Execute(*(callbackData->mCallback));\r
+ }\r
+ }\r
+\r
+ if(removed)\r
+ {\r
+ delete (*iter);\r
+ iter = mCallbackContainer.erase(iter);\r
+ }\r
+ else\r
+ {\r
+ ++iter;\r
+ }\r
+ }\r
\r
- // @todo : Need to consider callback with return & don't erase callback when it return true.\r
- for(CallbackBase* cb : mCallbacks)\r
+ // Re-register WIN_CALLBACK_EVENT when some idle callback remained.\r
+ if(!mCallbackContainer.empty())\r
{\r
- Dali::CallbackBase::Execute(*cb);\r
+ if(!mSelfCallbackRegistered)\r
+ {\r
+ // Post only one times.\r
+ mSelfCallbackRegistered = true;\r
+ WindowsPlatform::PostWinThreadMessage(WIN_CALLBACK_EVENT, reinterpret_cast<uint64_t>(mSelfCallback), 0);\r
+ }\r
}\r
- mCallbacks.clear();\r
\r
return idleProcessed;\r
}\r
\r
void WinCallbackManager::ClearIdleCallbacks()\r
{\r
- mCallbacks.clear();\r
+ for(auto iter = mCallbackContainer.begin(), endIter = mCallbackContainer.end(); iter != endIter; ++iter)\r
+ {\r
+ auto* callbackData = *iter;\r
+ delete callbackData;\r
+ }\r
+ mCallbackContainer.clear();\r
}\r
\r
bool WinCallbackManager::AddIdleEntererCallback(CallbackBase* callback)\r
\r
void WinCallbackManager::RemoveIdleEntererCallback(CallbackBase* callback)\r
{\r
+ RemoveIdleCallback(callback);\r
+}\r
+\r
+void WinCallbackManager::ProcessIdleFromFramework()\r
+{\r
+ ProcessIdle();\r
}\r
\r
} // namespace Adaptor\r
*/
// EXTERNAL INCLUDES
-#include <set>
+#include <dali/public-api/common/list-wrapper.h>
// INTERNAL INCLUDES
#include <dali/internal/system/common/callback-manager.h>
{
namespace Adaptor
{
+struct WindowsCallbackData;
+
/**
- * @brief LibUV callback manager used to install call backs in the applications main loop.
+ * @brief Windows callback manager used to install call backs in the applications main loop.
* The manager keeps track of all callbacks, so that if Stop() is called it can remove them.
*/
class WinCallbackManager : public CallbackManager
/**
* @brief destructor
*/
- ~WinCallbackManager()
- {
- }
+ ~WinCallbackManager();
/**
* @copydoc CallbackManager::AddIdleCallback()
WinCallbackManager(const WinCallbackManager&) = delete;
WinCallbackManager& operator=(WinCallbackManager&) = delete;
+ /**
+ * @brief Callback function comes from framework.
+ * It will be self callback.
+ */
+ void ProcessIdleFromFramework();
+
private:
- std::set<CallbackBase*> mCallbacks;
- bool mRunning; ///< flag is set to true if when running
+ CallbackBase* mSelfCallback{nullptr};
+ bool mSelfCallbackRegistered{false}; ///< flag is set to true if we send processIdle callback register.
+
+ typedef std::list<WindowsCallbackData*> CallbackList;
+
+ CallbackList mCallbackContainer;
+ bool mRunning; ///< flag is set to true if when running
};
} // namespace Adaptor
return false;
}
-
-BidiDirection GetBidiCharacterDirection(FriBidiCharType characterDirection)
-{
- switch(characterDirection)
- {
- case FRIBIDI_TYPE_LTR: // Left-To-Right letter.
- {
- return LEFT_TO_RIGHT;
- }
- case FRIBIDI_TYPE_AL: // Arabic Letter.
- case FRIBIDI_TYPE_RTL: // Right-To-Left letter.
- {
- return RIGHT_TO_LEFT;
- }
- case FRIBIDI_TYPE_AN: // Arabic Numeral.
- case FRIBIDI_TYPE_ES: // European number Separator.
- case FRIBIDI_TYPE_ET: // European number Terminator.
- case FRIBIDI_TYPE_EN: // European Numeral.
- default:
- {
- return NEUTRAL;
- }
- }
-}
} // namespace
struct BidirectionalSupport::Plugin
*/
struct BidirectionalInfo
{
- FriBidiCharType* characterTypes; ///< The type of each character (right, left, neutral, ...)
- FriBidiLevel* embeddedLevels; ///< Embedded levels.
- FriBidiParType paragraphDirection; ///< The paragraph's direction.
+ FriBidiCharType* characterTypes; ///< The type of each character (right, left, neutral, ...)
+ FriBidiBracketType* bracketTypes; ///< Input list of bracket types as returned by fribidi_get_bracket_types().
+ FriBidiLevel* embeddedLevels; ///< Embedded levels.
+ FriBidiParType paragraphDirection; ///< The paragraph's direction.
};
Plugin()
free(info->embeddedLevels);
free(info->characterTypes);
+ free(info->bracketTypes);
delete info;
}
}
// Retrieve the paragraph's direction.
bidirectionalInfo->paragraphDirection = matchLayoutDirection == true ? (layoutDirection == LayoutDirection::RIGHT_TO_LEFT ? FRIBIDI_PAR_RTL : FRIBIDI_PAR_LTR) : (fribidi_get_par_direction(bidirectionalInfo->characterTypes, numberOfCharacters));
+ bidirectionalInfo->bracketTypes = reinterpret_cast<FriBidiBracketType*>(malloc(numberOfCharacters * sizeof(FriBidiBracketType)));
+ if(!bidirectionalInfo->bracketTypes)
+ {
+ free(bidirectionalInfo->bracketTypes);
+ delete bidirectionalInfo;
+ return 0;
+ }
+
+ fribidi_get_bracket_types(paragraph, numberOfCharacters, bidirectionalInfo->characterTypes, bidirectionalInfo->bracketTypes);
+
// Retrieve the embedding levels.
- if(fribidi_get_par_embedding_levels(bidirectionalInfo->characterTypes, numberOfCharacters, &bidirectionalInfo->paragraphDirection, bidirectionalInfo->embeddedLevels) == 0)
+ if(fribidi_get_par_embedding_levels_ex(bidirectionalInfo->characterTypes, bidirectionalInfo->bracketTypes, numberOfCharacters, &bidirectionalInfo->paragraphDirection, bidirectionalInfo->embeddedLevels) == 0)
{
free(bidirectionalInfo->characterTypes);
+ free(bidirectionalInfo->bracketTypes);
delete bidirectionalInfo;
return 0;
}
// Free resources and destroy the container.
free(bidirectionalInfo->embeddedLevels);
free(bidirectionalInfo->characterTypes);
+ free(bidirectionalInfo->bracketTypes);
delete bidirectionalInfo;
*it = NULL;
{
const BidirectionalInfo* const bidirectionalInfo = *(mParagraphBidirectionalInfo.Begin() + bidiInfoIndex);
- const CharacterDirection paragraphDirection = GetBidiParagraphDirection(bidirectionalInfo->paragraphDirection);
- CharacterDirection previousDirection = paragraphDirection;
-
for(CharacterIndex index = 0u; index < numberOfCharacters; ++index)
{
CharacterDirection& characterDirection = *(directions + index);
- CharacterDirection nextDirection = false;
-
- characterDirection = false;
-
- // Get the bidi direction.
- const BidiDirection bidiDirection = GetBidiCharacterDirection(*(bidirectionalInfo->characterTypes + index));
-
- if(RIGHT_TO_LEFT == bidiDirection)
- {
- characterDirection = true;
- nextDirection = true;
- }
- else if(NEUTRAL == bidiDirection)
- {
- // For neutral characters it check's the next and previous directions.
- // If they are equals set that direction. If they are not, sets the paragraph's direction.
- // If there is no next, sets the paragraph's direction.
- nextDirection = paragraphDirection;
-
- // Look for the next non-neutral character.
- Length nextIndex = index + 1u;
- for(; nextIndex < numberOfCharacters; ++nextIndex)
- {
- BidiDirection nextBidiDirection = GetBidiCharacterDirection(*(bidirectionalInfo->characterTypes + nextIndex));
- if(nextBidiDirection != NEUTRAL)
- {
- nextDirection = RIGHT_TO_LEFT == nextBidiDirection;
- break;
- }
- }
-
- // Calculate the direction for all the neutral characters.
- characterDirection = previousDirection == nextDirection ? previousDirection : paragraphDirection;
-
- // Set the direction to all the neutral characters.
- // The indices from currentIndex + 1u to nextIndex - 1u are neutral characters.
- ++index;
-
- for(; index < nextIndex; ++index)
- {
- CharacterDirection& nextCharacterDirection = *(directions + index);
- nextCharacterDirection = characterDirection;
- }
-
- // Set the direction of the next non-neutral character.
- if(nextIndex < numberOfCharacters)
- {
- *(directions + nextIndex) = nextDirection;
- }
- }
- previousDirection = nextDirection;
+ // Checks if the character is rtl oriented.
+ // I.e even a neutral character can become rtl if surrounded by rtl characters.
+ characterDirection = FRIBIDI_IS_RTL(*(bidirectionalInfo->embeddedLevels + index));
+
+ // NOTE
+ // We are discontinuing the previous character direction determination logic.
+ // The previous logic was too heuristic and had many shortcomings in handling various RTL cases.
+ // The key change in this update is that character direction is determined based on embedding levels,
+ // including bracket information.
+ // The character direction determined here will affect the behavior of the GetMirroredText() function.
+ // BTW, Harfbuzz(hb_shape) also supports text mirroring.
+ // To use this, we need to pass the character direction at the embedding level to hb_buffer_set_direction,
+ // which is currently challenging for us.
+ // If this is implemented, we will no longer need to perform GetMirroredText().
}
}
#include <dali/devel-api/events/key-event-devel.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/touch-integ.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/actors/layer.h>
mInsetsChangedSignal(),
mPointerConstraintsSignal(),
mLastKeyEvent(),
- mLastTouchEvent(),
mIsTransparent(false),
mIsFocusAcceptable(true),
mIconified(false),
mWindowRotationAcknowledgement(false),
mFocused(false),
mIsWindowRotating(false),
- mIsEnabledUserGeometry(false)
+ mIsEnabledUserGeometry(false),
+ mIsEmittedWindowCreatedEvent(false)
{
}
// Add Window to bridge for ATSPI
auto bridge = Accessibility::Bridge::GetCurrentBridge();
- if(bridge->IsUp())
- {
- auto rootLayer = mScene.GetRootLayer();
- auto accessible = Accessibility::Accessible::Get(rootLayer);
- bridge->AddTopLevelWindow(accessible);
-
- // Emit Window create event
- // Create and Destory signal only emit in multi-window environment, so it does not emit on default layer.
- bridge->Emit(accessible, Accessibility::WindowEvent::CREATE);
- }
bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled);
bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled);
+ if(bridge->IsUp())
+ {
+ OnAccessibilityEnabled();
+ }
+ else
+ {
+ OnAccessibilityDisabled();
+ }
+
// If you call the 'Show' before creating the adaptor, the application cannot know the app resource id.
// The show must be called after the adaptor is initialized.
Show();
void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
{
- mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
FeedTouchPoint(point, timeStamp);
}
auto accessible = Accessibility::Accessible::Get(rootLayer);
bridge->AddTopLevelWindow(accessible);
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is enabled\n", this, mNativeWindowId);
+
+ Dali::Window handle(this);
+ if(!mIsEmittedWindowCreatedEvent)
+ {
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Created Event\n", this, mNativeWindowId);
+ bridge->WindowCreated(handle);
+ mIsEmittedWindowCreatedEvent = true;
+ }
+
if(!mVisible || mIconified)
{
return;
}
- Dali::Window handle(this);
bridge->WindowShown(handle);
if(mFocused)
{
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Focused Event\n", this, mNativeWindowId);
bridge->WindowFocused(handle);
}
}
auto rootLayer = mScene.GetRootLayer();
auto accessible = Accessibility::Accessible::Get(rootLayer);
bridge->RemoveTopLevelWindow(accessible);
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is disabled\n", this, mNativeWindowId);
}
void Window::OnMoveCompleted(Dali::Window::WindowPosition& position)
return mLastKeyEvent;
}
-const Dali::TouchEvent& Window::GetLastTouchEvent() const
-{
- return mLastTouchEvent;
-}
-
void Window::SetUserGeometryPolicy()
{
if(mIsEnabledUserGeometry == true)
const Dali::KeyEvent& GetLastKeyEvent() const;
/**
- * @copydoc Dali::DevelWindow::GetLastTouchEvent()
- */
- const Dali::TouchEvent& GetLastTouchEvent() const;
-
- /**
* @copydoc Dali::DevelWindow::PointerConstraintsLock()
*/
bool PointerConstraintsLock();
InsetsChangedSignalType mInsetsChangedSignal;
PointerConstraintsSignalType mPointerConstraintsSignal;
- Dali::KeyEvent mLastKeyEvent;
- Dali::TouchEvent mLastTouchEvent;
+ Dali::KeyEvent mLastKeyEvent;
bool mIsTransparent : 1;
bool mIsFocusAcceptable : 1;
bool mFocused : 1;
bool mIsWindowRotating : 1; ///< The window rotating flag.
bool mIsEnabledUserGeometry : 1; ///< The user geometry enable flag.
+ bool mIsEmittedWindowCreatedEvent : 1; ///< The Window Created Event emit flag for accessibility.
};
} // namespace Adaptor
GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
+ bool isRepeat = false;
+#if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 25)
+ if(keyEvent->event_flags & ECORE_EVENT_FLAG_REPEAT)
+ {
+ isRepeat = true;
+ }
+#endif // Since ecore 1.25 version
+
Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
+ keyEvent.isRepeat = isRepeat;
mKeyEventSignal.Emit(keyEvent);
}
namespace Dali
{
-NativeImageSourcePtr NativeImageSource::New(unsigned int width, unsigned int height, ColorDepth depth)
+NativeImageSourcePtr NativeImageSource::New(uint32_t width, uint32_t height, ColorDepth depth)
{
Any empty;
NativeImageSourcePtr image = new NativeImageSource(width, height, depth, empty);
return image;
}
-bool NativeImageSource::GetPixels(std::vector<unsigned char>& pixbuf, unsigned int& width, unsigned int& height, Pixel::Format& pixelFormat) const
+bool NativeImageSource::GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const
{
return mImpl->GetPixels(pixbuf, width, height, pixelFormat);
}
mImpl->DestroyResource();
}
-unsigned int NativeImageSource::TargetTexture()
+uint32_t NativeImageSource::TargetTexture()
{
return mImpl->TargetTexture();
}
mImpl->PrepareTexture();
}
-unsigned int NativeImageSource::GetWidth() const
+uint32_t NativeImageSource::GetWidth() const
{
return mImpl->GetWidth();
}
-unsigned int NativeImageSource::GetHeight() const
+uint32_t NativeImageSource::GetHeight() const
{
return mImpl->GetHeight();
}
return mImpl->GetNativeImageInterfaceExtension();
}
-NativeImageSource::NativeImageSource(unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource)
+NativeImageSource::NativeImageSource(uint32_t width, uint32_t height, ColorDepth depth, Any nativeImageSource)
{
auto factory = Dali::Internal::Adaptor::GetNativeImageSourceFactory();
mImpl = factory->CreateNativeImageSource(width, height, depth, nativeImageSource).release();
* @param[in] depth color depth of the image
* @return A smart-pointer to a newly allocated image
*/
- static NativeImageSourcePtr New(unsigned int width, unsigned int height, ColorDepth depth);
+ static NativeImageSourcePtr New(uint32_t width, uint32_t height, ColorDepth depth);
/**
* @brief Creates a new NativeImageSource from an existing native image source.
* @param[out] pixelFormat pixel format used by image
* @return @c true if the pixels were gotten, and @c false otherwise
*/
- bool GetPixels(std::vector<unsigned char>& pixbuf, unsigned int& width, unsigned int& height, Pixel::Format& pixelFormat) const;
+ bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const;
/**
* @brief Converts the current pixel contents to either a JPEG or PNG format
*/
bool IsColorDepthSupported(ColorDepth colorDepth);
+public: // native image
+ /**
+ * @copydoc Dali::NativeImageInterface::GetWidth()
+ */
+ uint32_t GetWidth() const override;
+
+ /**
+ * @copydoc Dali::NativeImageInterface::GetHeight()
+ */
+ uint32_t GetHeight() const override;
+
/**
* @copydoc Dali::NativeImageInterface::GetTextureTarget()
*/
/**
* @copydoc Dali::NativeImageInterface::TargetTexture()
*/
- unsigned int TargetTexture() override;
+ uint32_t TargetTexture() override;
/**
* @copydoc Dali::NativeImageInterface::PrepareTexture()
void PrepareTexture() override;
/**
- * @copydoc Dali::NativeImageInterface::GetWidth()
- */
- unsigned int GetWidth() const override;
-
- /**
- * @copydoc Dali::NativeImageInterface::GetHeight()
- */
- unsigned int GetHeight() const override;
-
- /**
* @copydoc Dali::NativeImageInterface::RequiresBlending()
*/
bool RequiresBlending() const override;
* @param[in] depth color depth of the image
* @param[in] nativeImageSource contains either: native image source or is empty
*/
- DALI_INTERNAL NativeImageSource(unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource);
+ DALI_INTERNAL NativeImageSource(uint32_t width, uint32_t height, ColorDepth depth, Any nativeImageSource);
/**
* @brief A reference counted object may only be deleted by calling Unreference().
{
const unsigned int ADAPTOR_MAJOR_VERSION = 2;
const unsigned int ADAPTOR_MINOR_VERSION = 2;
-const unsigned int ADAPTOR_MICRO_VERSION = 43;
+const unsigned int ADAPTOR_MICRO_VERSION = 44;
const char* const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-adaptor
Summary: The DALi Tizen Adaptor
-Version: 2.2.43
+Version: 2.2.44
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT