KVMService.GetSourceMimetypes() returns mimetype list that current drag source offered.
[global::System.Runtime.InteropServices.DllImport(lib, EntryPoint = "tzsh_kvm_service_receive_drag_data")]
internal static extern int ReceiveDragData(IntPtr kvmService, string mimeType);
+ [global::System.Runtime.InteropServices.DllImport(lib, EntryPoint = "tzsh_kvm_service_get_source_mimetypes")]
+ internal static extern int GetSourceMimetypes(
+ IntPtr kvmService,
+ out string[] mimeTypes,
+ out int count);
+
[global::System.Runtime.InteropServices.DllImport(lib, EntryPoint = "tzsh_kvm_service_secondary_selection_set")]
internal static extern int SetSecondarySelection(IntPtr kvmService);
using System;
using System.ComponentModel;
+using System.Collections.Generic;
namespace Tizen.NUI.WindowSystem.Shell
{
}
/// <summary>
+ /// Requests to receive the mimetype list of drag source.
+ /// </summary>
+ /// <returns>
+ /// The list of mimetype.
+ /// If there are no mimetype, returns null.
+ /// </returns>
+ /// <exception cref="ArgumentException">Thrown when failed of invalid argument.</exception>
+ public List<string> GetSourceMimetypes()
+ {
+ int res = Interop.KVMService.GetSourceMimetypes(_kvmService, out string[] mimetypes, out int mimeTypeCount);
+ _tzsh.ErrorCodeThrow(res);
+
+ if (mimetypes == null) return null;
+ return new List<string>(mimetypes);
+ }
+
+ /// <summary>
/// Requests to set KVM window as secondary selection window.
/// The request name has typo and will remove soon.
/// Please use SetSecondarySelection.
{
Log.Debug("KVMSample", "Tizen KVM: Drag started");
+ List<string> mimeTypes;
+ mimeTypes = kvmService.GetSourceMimetypes();
+ if (mimeTypes == null)
+ Log.Debug("KVMSample", "Tizen KVM: There're no Source mimetypes");
+ else
+ Log.Debug("KVMSample", "Tizen KVM: Source mimetypes: " + string.Join(", ", mimeTypes));
+ string mimeType = mimeTypes[0];
+
// Request the drag data to the Display server.
// The drag data can get at DnD Listener (OnDnDEvent function)
- kvmService.ReceiveDragData("text/plain");
+ kvmService.ReceiveDragData(mimeType);
}
private void OnDragEnded(object sender, EventArgs e)