From b99d62e45005ba07b870a08aa1de9a2e383be1a7 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 13 Jun 2023 20:55:22 +0200 Subject: [PATCH] Some finetuning. --- Dalamud/Interface/DragDrop/DragDropInterop.cs | 16 ++++++++-------- Dalamud/Interface/DragDrop/DragDropTarget.cs | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Dalamud/Interface/DragDrop/DragDropInterop.cs b/Dalamud/Interface/DragDrop/DragDropInterop.cs index 8bf04f160..28a2644a5 100644 --- a/Dalamud/Interface/DragDrop/DragDropInterop.cs +++ b/Dalamud/Interface/DragDrop/DragDropInterop.cs @@ -13,14 +13,6 @@ namespace Dalamud.Interface.DragDrop; /// Implements interop enums and function calls to interact with external drag and drop. internal partial class DragDropManager { - internal struct POINTL - { - [ComAliasName("Microsoft.VisualStudio.OLE.Interop.LONG")] - public int x; - [ComAliasName("Microsoft.VisualStudio.OLE.Interop.LONG")] - public int y; - } - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("00000122-0000-0000-C000-000000000046")] [ComImport] @@ -39,6 +31,14 @@ internal partial class DragDropManager void Drop([MarshalAs(UnmanagedType.Interface), In] IDataObject pDataObj, [ComAliasName("Microsoft.VisualStudio.OLE.Interop.DWORD"), In] uint grfKeyState, [ComAliasName("Microsoft.VisualStudio.OLE.Interop.POINTL"), In] POINTL pt, [ComAliasName("Microsoft.VisualStudio.OLE.Interop.DWORD"), In, Out] ref uint pdwEffect); } + internal struct POINTL + { + [ComAliasName("Microsoft.VisualStudio.OLE.Interop.LONG")] + public int x; + [ComAliasName("Microsoft.VisualStudio.OLE.Interop.LONG")] + public int y; + } + private static class DragDropInterop { [Flags] diff --git a/Dalamud/Interface/DragDrop/DragDropTarget.cs b/Dalamud/Interface/DragDrop/DragDropTarget.cs index b6bb9d237..05e5599f9 100644 --- a/Dalamud/Interface/DragDrop/DragDropTarget.cs +++ b/Dalamud/Interface/DragDrop/DragDropTarget.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices.ComTypes; using System.Text; @@ -19,7 +18,7 @@ internal partial class DragDropManager : DragDropManager.IDropTarget private DragDropInterop.ModifierKeys lastKeyState = DragDropInterop.ModifierKeys.MK_NONE; /// Create the drag and drop formats we accept. - private static FORMATETC FormatEtc = + private FORMATETC formatEtc = new() { cfFormat = (short)DragDropInterop.ClipboardFormat.CF_HDROP, @@ -41,7 +40,7 @@ internal partial class DragDropManager : DragDropManager.IDropTarget this.IsDragging = true; this.lastKeyState = UpdateIo((DragDropInterop.ModifierKeys)grfKeyState, true); - if (pDataObj.QueryGetData(ref FormatEtc) != 0) + if (pDataObj.QueryGetData(ref this.formatEtc) != 0) { pdwEffect = 0; } @@ -203,7 +202,7 @@ internal partial class DragDropManager : DragDropManager.IDropTarget try { - data.GetData(ref FormatEtc, out var stgMedium); + data.GetData(ref this.formatEtc, out var stgMedium); var numFiles = DragDropInterop.DragQueryFile(stgMedium.unionmember, uint.MaxValue, new StringBuilder(), 0); var files = new string[numFiles]; var sb = new StringBuilder(1024);