Skip to content

Commit

Permalink
Merge pull request #19535 from unoplatform/dev/mazi/dnd-init
Browse files Browse the repository at this point in the history
fix: Drag and Drop initialization on mobile
  • Loading branch information
jeromelaban authored Feb 18, 2025
2 parents 31d37f3 + 2c6d195 commit df40a4e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
23 changes: 23 additions & 0 deletions src/Uno.UI.RuntimeTests/Tests/Uno_UI_Xaml_Core/Given_DragDrop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Private.Infrastructure;

namespace Uno.UI.RuntimeTests.Tests.Uno_UI_Xaml_Core;

[TestClass]
public class Given_DragDrop
{
#if HAS_UNO // InputManager is internal.
[TestMethod]
[RunsOnUIThread]
public void Verify_Initialized()
{
var xamlRoot = TestServices.WindowHelper.XamlRoot;
var contentRoot = xamlRoot.VisualTree.ContentRoot;
Assert.IsNotNull(contentRoot.InputManager.DragDrop);
}
#endif
}
6 changes: 0 additions & 6 deletions src/Uno.UI/UI/Xaml/Internal/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public InputManager(ContentRoot contentRoot)
ConstructKeyboardManager();

ConstructPointerManager();

#if ANDROID // for some reason, moving InitDragAndDrop to Initialize breaks Android in CI
InitDragAndDrop();
#endif
}

partial void ConstructKeyboardManager();
Expand All @@ -39,9 +35,7 @@ internal void Initialize(object host)
{
InitializeKeyboard(host);
InitializePointers(host);
#if !ANDROID
InitDragAndDrop();
#endif
}

partial void InitializeKeyboard(object host);
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Window/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ internal void Initialize()
if (_windowType is WindowType.CoreWindow)
{
WinUICoreServices.Instance.InitCoreWindowContentRoot();
#if __WASM__ // We normally call SetHost from the NativeWindowWrapper on DesktopXamlSource targets, but for WASM we put it here.
#if __WASM__ || __ANDROID__ || __IOS__ // We normally call SetHost from the NativeWindowWrapper on DesktopXamlSource targets, but for WASM we put it here.
WinUICoreServices.Instance.MainVisualTree!.ContentRoot.SetHost(this);
#endif
}
Expand Down

0 comments on commit df40a4e

Please sign in to comment.