// Set default offer is reject
ecore_wl2_offer_accept(ev->offer, NULL);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool EcoreEventDataLeave(void* data, int type, void* event)
+{
+ DragAndDropEcoreWl* dndImpl = reinterpret_cast<DragAndDropEcoreWl*>(data);
+ dndImpl->ResetDropTargets();
return ECORE_CALLBACK_PASS_ON;
}
mMotionHandler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_MOTION, EcoreEventDataMotion, this);
mDropHandler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_DROP, EcoreEventDataDrop, this);
mEnterHandler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_ENTER, EcoreEventDataEnter, this);
+ mLeaveHandler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_LEAVE, EcoreEventDataLeave, this);
}
DragAndDropEcoreWl::~DragAndDropEcoreWl()
Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
- // Disable Default Cursor
- ecore_wl2_input_pointer_set(input, NULL, 0, 0);
-
// Set mime type for drag and drop
const char* mimeTypes[2];
mimeTypes[0] = mMimeType.c_str();
}
}
+ auto parent = Dali::DevelWindow::Get(target);
+ Ecore_Wl2_Window* parentWindow = AnyCast<Ecore_Wl2_Window*>(parent.GetNativeHandle());
+ if(parentWindow == nullptr)
+ {
+ return false;
+ }
+
DropTarget targetData;
targetData.target = target;
targetData.callback = callback;
targetData.inside = false;
+ targetData.parentWindowId = ecore_wl2_window_id_get(parentWindow);
mDropTargets.push_back(targetData);
}
}
+void DragAndDropEcoreWl::ResetDropTargets()
+{
+ for(std::size_t i = 0; i < mDropTargets.size(); i++)
+ {
+ mDropTargets[i].inside = false;
+ }
+}
+
+
void DragAndDropEcoreWl::SendData(void* event)
{
Ecore_Wl2_Event_Data_Source_Send* ev = reinterpret_cast<Ecore_Wl2_Event_Data_Source_Send*>(event);
for(std::size_t i = 0; i < mDropTargets.size(); i++)
{
+ if(ev->win != mDropTargets[i].parentWindowId)
+ {
+ continue;
+ }
+
Vector2 position = mDropTargets[i].target.GetProperty<Vector2>(Dali::Actor::Property::POSITION);
Vector2 size = mDropTargets[i].target.GetProperty<Vector2>(Dali::Actor::Property::SIZE);
bool currentInside = IsIntersection(ev->x, ev->y, position.x, position.y, size.width, size.height);
for(std::size_t i = 0; i < mDropTargets.size(); i++)
{
+ if(ev->win != mDropTargets[i].parentWindowId)
+ {
+ continue;
+ }
+
Vector2 position = mDropTargets[i].target.GetProperty<Vector2>(Dali::Actor::Property::POSITION);
Vector2 size = mDropTargets[i].target.GetProperty<Vector2>(Dali::Actor::Property::SIZE);
// If the drop position is in the target object region, request drop data to the source object