Browse Source

Remove MouseDevice from the TopLevel

pull/8577/head
Max Katz 4 years ago
parent
commit
d1683c963e
  1. 5
      src/Avalonia.Base/Input/IInputRoot.cs
  2. 9
      src/Avalonia.Controls/Platform/ITopLevelImpl.cs
  3. 3
      src/Avalonia.Controls/TopLevel.cs
  4. 8
      tests/Avalonia.UnitTests/MockWindowingPlatform.cs
  5. 4
      tests/Avalonia.UnitTests/TestRoot.cs

5
src/Avalonia.Base/Input/IInputRoot.cs

@ -27,10 +27,5 @@ namespace Avalonia.Input
/// Gets or sets a value indicating whether access keys are shown in the window. /// Gets or sets a value indicating whether access keys are shown in the window.
/// </summary> /// </summary>
bool ShowAccessKeys { get; set; } bool ShowAccessKeys { get; set; }
/// <summary>
/// Gets associated mouse device
/// </summary>
IMouseDevice? MouseDevice { get; }
} }
} }

9
src/Avalonia.Controls/Platform/ITopLevelImpl.cs

@ -6,7 +6,6 @@ using Avalonia.Input.Raw;
using Avalonia.Layout; using Avalonia.Layout;
using Avalonia.Metadata; using Avalonia.Metadata;
using Avalonia.Rendering; using Avalonia.Rendering;
using JetBrains.Annotations;
namespace Avalonia.Platform namespace Avalonia.Platform
{ {
@ -151,13 +150,7 @@ namespace Avalonia.Platform
/// Gets or sets a method called when the input focus is lost. /// Gets or sets a method called when the input focus is lost.
/// </summary> /// </summary>
Action? LostFocus { get; set; } Action? LostFocus { get; set; }
/// <summary>
/// Gets a mouse device associated with toplevel
/// </summary>
[CanBeNull]
IMouseDevice MouseDevice { get; }
IPopupImpl? CreatePopup(); IPopupImpl? CreatePopup();
/// <summary> /// <summary>

3
src/Avalonia.Controls/TopLevel.cs

@ -304,9 +304,6 @@ namespace Avalonia.Controls
set { SetValue(PointerOverElementProperty, value); } set { SetValue(PointerOverElementProperty, value); }
} }
/// <inheritdoc/>
IMouseDevice? IInputRoot.MouseDevice => PlatformImpl?.MouseDevice;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether access keys are shown in the window. /// Gets or sets a value indicating whether access keys are shown in the window.
/// </summary> /// </summary>

8
tests/Avalonia.UnitTests/MockWindowingPlatform.cs

@ -34,7 +34,6 @@ namespace Avalonia.UnitTests
windowImpl.Setup(x => x.RenderScaling).Returns(1); windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.Screen).Returns(CreateScreenMock().Object); windowImpl.Setup(x => x.Screen).Returns(CreateScreenMock().Object);
windowImpl.Setup(x => x.Position).Returns(() => position); windowImpl.Setup(x => x.Position).Returns(() => position);
SetupToplevel(windowImpl);
windowImpl.Setup(x => x.CreatePopup()).Returns(() => windowImpl.Setup(x => x.CreatePopup()).Returns(() =>
{ {
@ -100,8 +99,6 @@ namespace Avalonia.UnitTests
{ {
popupImpl.Object.Closed?.Invoke(); popupImpl.Object.Closed?.Invoke();
}); });
SetupToplevel(popupImpl);
return popupImpl; return popupImpl;
} }
@ -144,10 +141,5 @@ namespace Avalonia.UnitTests
{ {
return null; return null;
} }
private static void SetupToplevel<T>(Mock<T> mock) where T : class, ITopLevelImpl
{
mock.SetupGet(x => x.MouseDevice).Returns(new MouseDevice());
}
} }
} }

4
tests/Avalonia.UnitTests/TestRoot.cs

@ -58,9 +58,7 @@ namespace Avalonia.UnitTests
public IKeyboardNavigationHandler KeyboardNavigationHandler => null; public IKeyboardNavigationHandler KeyboardNavigationHandler => null;
public IInputElement PointerOverElement { get; set; } public IInputElement PointerOverElement { get; set; }
public IMouseDevice MouseDevice { get; set; }
public bool ShowAccessKeys { get; set; } public bool ShowAccessKeys { get; set; }
public IStyleHost StylingParent { get; set; } public IStyleHost StylingParent { get; set; }

Loading…
Cancel
Save