From 4b539f77b1c22a2975451355558ef4d10fa6ccb9 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Fri, 5 May 2023 11:29:02 +0200 Subject: [PATCH] fix: removing unnecessary statements. --- src/Avalonia.Native/AvaloniaNativeDragSource.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/Avalonia.Native/AvaloniaNativeDragSource.cs b/src/Avalonia.Native/AvaloniaNativeDragSource.cs index 7f4c462ee0..5063c7a0a0 100644 --- a/src/Avalonia.Native/AvaloniaNativeDragSource.cs +++ b/src/Avalonia.Native/AvaloniaNativeDragSource.cs @@ -4,7 +4,6 @@ using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Input.Platform; -using Avalonia.Interactivity; using Avalonia.Native.Interop; namespace Avalonia.Native @@ -18,16 +17,6 @@ namespace Avalonia.Native _factory = factory; } - private static TopLevel FindRoot(object? element) - { - while (element is Interactive interactive && element is not Visual) - element = interactive.GetInteractiveParent(); - if (element == null) - return null; - var visual = (Visual)element; - return TopLevel.GetTopLevel(visual); - } - class DndCallback : NativeCallbackBase, IAvnDndResultCallback { private TaskCompletionSource _tcs; @@ -46,7 +35,7 @@ namespace Avalonia.Native public Task DoDragDrop(PointerEventArgs triggerEvent, IDataObject data, DragDropEffects allowedEffects) { // Sanity check - var tl = FindRoot(triggerEvent.Source); + var tl = TopLevel.GetTopLevel(triggerEvent.Source as Visual); var view = tl?.PlatformImpl as WindowBaseImpl; if (view == null) throw new ArgumentException();