DragAndDrop : support multiwindow dnd on single process 57/288657/3
authorTaehyub Kim <taehyub.kim@samsung.com>
Tue, 21 Feb 2023 06:16:12 +0000 (15:16 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 21 Feb 2023 08:48:09 +0000 (17:48 +0900)
Change-Id: Ifadcbe29b6f63420f91cd892c56d11dad5172c44

dali/internal/drag-and-drop/tizen-wayland/drag-and-drop-impl-ecore-wl2.cpp
dali/internal/drag-and-drop/tizen-wayland/drag-and-drop-impl-ecore-wl2.h

index ca895f1..1a773af 100644 (file)
@@ -228,10 +228,18 @@ bool DragAndDropEcoreWl::AddListener(Dali::Actor target, Dali::DragAndDrop::Drag
     }
   }
 
+  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);
 
@@ -343,6 +351,11 @@ bool DragAndDropEcoreWl::CalculateDragEvent(void* 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);
@@ -389,6 +402,11 @@ bool DragAndDropEcoreWl::CalculateViewRegion(void* 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);
     // If the drop position is in the target object region, request drop data to the source object
index 162c3d0..0b1b286 100644 (file)
@@ -35,6 +35,7 @@ struct DropTarget
   Dali::Actor                            target;
   Dali::DragAndDrop::DragAndDropFunction callback;
   bool                                   inside;
+  int                                    parentWindowId;
 };
 
 /**