Browse Source
Merge pull request #11247 from workgroupengineering/fixes/Discussion_11177
fix: removing unnecessary statements.
pull/11262/head
Max Katz
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
12 deletions
-
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<DragDropEffects> _tcs; |
|
|
|
@ -46,7 +35,7 @@ namespace Avalonia.Native |
|
|
|
public Task<DragDropEffects> 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(); |
|
|
|
|