Browse Source

Fix D2D project build

pull/7506/head
Max Katz 5 years ago
parent
commit
418a3b665d
  1. 6
      src/Windows/Avalonia.Win32/ClipboardFormats.cs
  2. 4
      src/Windows/Avalonia.Win32/DragSource.cs
  3. 2
      src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs

6
src/Windows/Avalonia.Win32/ClipboardFormats.cs

@ -16,9 +16,9 @@ namespace Avalonia.Win32
{ {
public ushort Format { get; private set; } public ushort Format { get; private set; }
public string Name { get; private set; } public string Name { get; private set; }
public short[] Synthesized { get; private set; } public ushort[] Synthesized { get; private set; }
public ClipboardFormat(string name, ushort format, params short[] synthesized) public ClipboardFormat(string name, ushort format, params ushort[] synthesized)
{ {
Format = format; Format = format;
Name = name; Name = name;
@ -28,7 +28,7 @@ namespace Avalonia.Win32
private static readonly List<ClipboardFormat> FormatList = new List<ClipboardFormat>() private static readonly List<ClipboardFormat> FormatList = new List<ClipboardFormat>()
{ {
new ClipboardFormat(DataFormats.Text, (ushort)UnmanagedMethods.ClipboardFormat.CF_UNICODETEXT, (short)UnmanagedMethods.ClipboardFormat.CF_TEXT), new ClipboardFormat(DataFormats.Text, (ushort)UnmanagedMethods.ClipboardFormat.CF_UNICODETEXT, (ushort)UnmanagedMethods.ClipboardFormat.CF_TEXT),
new ClipboardFormat(DataFormats.FileNames, (ushort)UnmanagedMethods.ClipboardFormat.CF_HDROP), new ClipboardFormat(DataFormats.FileNames, (ushort)UnmanagedMethods.ClipboardFormat.CF_HDROP),
}; };

4
src/Windows/Avalonia.Win32/DragSource.cs

@ -22,8 +22,8 @@ namespace Avalonia.Win32
var objPtr = MicroCom.MicroComRuntime.GetNativeIntPtr<Win32Com.IDataObject>(dataObject, true); var objPtr = MicroCom.MicroComRuntime.GetNativeIntPtr<Win32Com.IDataObject>(dataObject, true);
var srcPtr = MicroCom.MicroComRuntime.GetNativeIntPtr<Win32Com.IDropSource>(src, true); var srcPtr = MicroCom.MicroComRuntime.GetNativeIntPtr<Win32Com.IDropSource>(src, true);
UnmanagedMethods.DoDragDrop(objPtr, srcPtr, allowed, out var finalEffect); UnmanagedMethods.DoDragDrop(objPtr, srcPtr, (int)allowed, out var finalEffect);
return Task.FromResult(OleDropTarget.ConvertDropEffect(finalEffect)); return Task.FromResult(OleDropTarget.ConvertDropEffect((Win32Com.DropEffect)finalEffect));
} }
} }
} }

2
src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs

@ -1448,7 +1448,7 @@ namespace Avalonia.Win32.Interop
public static extern int DragQueryFile(IntPtr hDrop, int iFile, StringBuilder lpszFile, int cch); public static extern int DragQueryFile(IntPtr hDrop, int iFile, StringBuilder lpszFile, int cch);
[DllImport("ole32.dll", CharSet = CharSet.Auto, ExactSpelling = true, PreserveSig = false)] [DllImport("ole32.dll", CharSet = CharSet.Auto, ExactSpelling = true, PreserveSig = false)]
internal static extern void DoDragDrop(IntPtr dataObject, IntPtr dropSource, DropEffect allowedEffects, [Out] out DropEffect finalEffect); internal static extern void DoDragDrop(IntPtr dataObject, IntPtr dropSource, int allowedEffects, [Out] out int finalEffect);
[DllImport("dwmapi.dll")] [DllImport("dwmapi.dll")]
public static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins); public static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);

Loading…
Cancel
Save