diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 169f3088cb1..a0b38bf4d75 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -81,24 +81,24 @@ /src/Tizen.Multimedia.Vision/ @hsgwon # UI FW (NUI) -/src/Tizen.NUI.Components.Design/ @dongsug-song @bshsqa @rabbifor @hinohie -/src/Tizen.NUI.Components/ @dongsug-song @bshsqa @rabbifor @hinohie -/src/Tizen.NUI.Design/ @dongsug-song @bshsqa @rabbifor @hinohie -/src/Tizen.NUI.Extension/ @dongsug-song @bshsqa @rabbifor @hinohie -/src/Tizen.NUI.Physics2D/ @dongsug-song @bshsqa @rabbifor @hinohie -/src/Tizen.NUI.Scene3D/ @dongsug-song @bshsqa @rabbifor @hinohie -/src/Tizen.NUI.WindowSystem/ @dongsug-song @bshsqa @rabbifor @hinohie -/src/Tizen.NUI.XamlBuild/ @dongsug-song @bshsqa @rabbifor @hinohie -/src/Tizen.NUI/ @dongsug-song @bshsqa @rabbifor @hinohie -/test/NUITestSample/ @dongsug-song @bshsqa @rabbifor @hinohie -/test/NUITizenGallery/ @dongsug-song @bshsqa @rabbifor @hinohie -/test/Tizen.NUI.ComponentApplication/ @bshsqa @rabbifor @hinohie -/test/Tizen.NUI.Samples/ @dongsug-song @bshsqa @rabbifor @hinohie -/test/Tizen.NUI.SeamlessSamples/ @dongsug-song @bshsqa @rabbifor @hinohie -/test/Tizen.NUI.StyleGuide/ @dongsug-song @bshsqa @rabbifor @hinohie -/test/Tizen.NUI.Tests/ @dongsug-song @bshsqa @rabbifor @hinohie -/test/Tizen.NUI.WebViewTest/ @dongsug-song @bshsqa @rabbifor @hinohie -/test/Tizen.NUI.WindowSystem.Samples/ @dongsug-song @bshsqa @rabbifor @hinohie +/src/Tizen.NUI.Components.Design/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/src/Tizen.NUI.Components/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/src/Tizen.NUI.Design/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/src/Tizen.NUI.Extension/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/src/Tizen.NUI.Physics2D/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/src/Tizen.NUI.Scene3D/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/src/Tizen.NUI.WindowSystem/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/src/Tizen.NUI.XamlBuild/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/src/Tizen.NUI/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/test/NUITestSample/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/test/NUITizenGallery/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/test/Tizen.NUI.ComponentApplication/ @bshsqa @rabbitfor @JoogabYun +/test/Tizen.NUI.Samples/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/test/Tizen.NUI.SeamlessSamples/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/test/Tizen.NUI.StyleGuide/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/test/Tizen.NUI.Tests/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/test/Tizen.NUI.WebViewTest/ @dongsug-song @bshsqa @rabbitfor @JoogabYun +/test/Tizen.NUI.WindowSystem.Samples/ @dongsug-song @bshsqa @rabbitfor @JoogabYun # NETWORK /src/Tizen.Network.Bluetooth/ @dh79pyun @wootak-jung diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.DragAndDrop.cs b/src/Tizen.NUI/src/internal/Interop/Interop.DragAndDrop.cs index e921ba3060a..b6cb6636572 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.DragAndDrop.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.DragAndDrop.cs @@ -58,9 +58,11 @@ internal enum DragType [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_DragEvent_GetPosition")] public static extern global::System.IntPtr GetPosition(global::System.IntPtr dragAndDrop); - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_DragEvent_GetMimeTypes")] - [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] - public static extern bool GetMimeTypes(global::System.IntPtr dragAndDrop, out global::System.IntPtr mimeTypes, out int count); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_DragEvent_GetMimeTypeCount")] + public static extern int GetMimeTypeCount(global::System.IntPtr dragAndDrop); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_DragEvent_GetMimeType")] + public static extern string GetMimeType(global::System.IntPtr dragAndDrop, int index); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_DragEvent_GetData")] public static extern string GetData(global::System.IntPtr dragAndDrop); diff --git a/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs b/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs index 2e58d8f6c2f..29a2bd6f9fd 100755 --- a/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs +++ b/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs @@ -61,6 +61,23 @@ public class DragAndDrop : BaseHandle private const int MinDragWindowWidth = 100; private const int MinDragWindowHeight = 100; + private static string [] GetMimeTypes(IntPtr nativeDragEvent) + { + int count = Interop.DragAndDrop.GetMimeTypeCount(nativeDragEvent); + if (count <= 0) + { + return null; + } + + string [] managedMimeTypes = new string[count]; + for (int iterator = 0; iterator < count; iterator++) + { + managedMimeTypes[iterator] = Interop.DragAndDrop.GetMimeType(nativeDragEvent, iterator); + } + + return managedMimeTypes; + } + private void ProcessDragEventTargetCallback(IntPtr nativeDragEvent, View targetView, DragAndDropEventHandler callback) { DragType type = (DragType)Interop.DragAndDrop.GetAction(nativeDragEvent); @@ -68,21 +85,9 @@ private void ProcessDragEventTargetCallback(IntPtr nativeDragEvent, View targetV global::System.IntPtr cPtr = Interop.DragAndDrop.GetPosition(nativeDragEvent); dragEvent.Position = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, true); - IntPtr nativeMimeTypes; - int count; - Interop.DragAndDrop.GetMimeTypes(nativeDragEvent, out nativeMimeTypes, out count); - if (count > 0) + string [] managedMimeTypes = GetMimeTypes(nativeDragEvent); + if (managedMimeTypes != null) { - IntPtr [] nativeMimeTypesArrary = new IntPtr[count]; - Marshal.Copy(nativeMimeTypes, nativeMimeTypesArrary, 0, count); - - string [] managedMimeTypes = new string[count]; - - for (int iterator = 0; iterator < count; iterator++) - { - managedMimeTypes[iterator] = Marshal.PtrToStringAnsi(nativeMimeTypesArrary[iterator]); - } - dragEvent.MimeType = managedMimeTypes[0]; dragEvent.MimeTypes = managedMimeTypes; } @@ -117,21 +122,9 @@ private void ProcessDragEventWindowCallback(IntPtr nativeDragEvent, Window targe global::System.IntPtr cPtr = Interop.DragAndDrop.GetPosition(nativeDragEvent); dragEvent.Position = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - IntPtr nativeMimeTypes; - int count; - Interop.DragAndDrop.GetMimeTypes(nativeDragEvent, out nativeMimeTypes, out count); - if (count > 0) + string [] managedMimeTypes = GetMimeTypes(nativeDragEvent); + if (managedMimeTypes != null) { - IntPtr [] nativeMimeTypesArrary = new IntPtr[count]; - Marshal.Copy(nativeMimeTypes, nativeMimeTypesArrary, 0, count); - - string [] managedMimeTypes = new string[count]; - - for (int iterator = 0; iterator < count; iterator++) - { - managedMimeTypes[iterator] = Marshal.PtrToStringAnsi(nativeMimeTypesArrary[iterator]); - } - dragEvent.MimeType = managedMimeTypes[0]; dragEvent.MimeTypes = managedMimeTypes; } @@ -318,7 +311,8 @@ public void AddListener(View targetView, string mimeType, DragAndDropEventHandle if (!Interop.DragAndDrop.AddListener(SwigCPtr, View.getCPtr(targetView), mimeType, new global::System.Runtime.InteropServices.HandleRef(this, Marshal.GetFunctionPointerForDelegate(cb)))) { - throw new InvalidOperationException("Fail to AddListener for View"); + targetEventDictionary.Remove(targetView); + throw new InvalidOperationException("Fail to AddListener for View"); } } @@ -336,12 +330,12 @@ public void RemoveListener(View targetView, DragAndDropEventHandler _) } InternalDragAndDropEventHandler cb = targetEventDictionary[targetView]; - targetEventDictionary.Remove(targetView); if (!Interop.DragAndDrop.RemoveListener(SwigCPtr, View.getCPtr(targetView), new global::System.Runtime.InteropServices.HandleRef(this, Marshal.GetFunctionPointerForDelegate(cb)))) { - throw new InvalidOperationException("Fail to RemoveListener for View"); + throw new InvalidOperationException("Fail to RemoveListener for View"); } + targetEventDictionary.Remove(targetView); } /// @@ -371,7 +365,8 @@ public void AddListener(Window targetWindow, string mimeType, DragAndDropWindowE if (!Interop.DragAndDrop.WindowAddListener(SwigCPtr, Window.getCPtr(targetWindow), mimeType, new global::System.Runtime.InteropServices.HandleRef(this, Marshal.GetFunctionPointerForDelegate(cb)))) { - throw new InvalidOperationException("Fail to AddListener for Window"); + targetWindowEventDictionary.Remove(targetWindow); + throw new InvalidOperationException("Fail to AddListener for Window"); } } @@ -389,12 +384,12 @@ public void RemoveListener(Window targetWindow, DragAndDropWindowEventHandler _) } InternalDragAndDropEventHandler cb = targetWindowEventDictionary[targetWindow]; - targetWindowEventDictionary.Remove(targetWindow); if (!Interop.DragAndDrop.WindowRemoveListener(SwigCPtr, Window.getCPtr(targetWindow), new global::System.Runtime.InteropServices.HandleRef(this, Marshal.GetFunctionPointerForDelegate(cb)))) { - throw new InvalidOperationException("Fail to RemoveListener for Window"); + throw new InvalidOperationException("Fail to RemoveListener for Window"); } + targetWindowEventDictionary.Remove(targetWindow); } ///