From 2a7aa54963cbafe8f805a9498895c6b6e9f11d75 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Sun, 5 Feb 2023 06:27:45 +0200 Subject: [PATCH 1/2] fix!: Remove `SetNeedsKeyboard` from macOS BREAKING CHANGE: `Window.SetNeedsKeyboard` in macOS is removed. --- src/Uno.UI/Controls/Window.macOS.cs | 28 ------------------- .../UI/Xaml/Controls/TextBox/TextBox.macOS.cs | 11 -------- 2 files changed, 39 deletions(-) diff --git a/src/Uno.UI/Controls/Window.macOS.cs b/src/Uno.UI/Controls/Window.macOS.cs index f737519cade3..bb6537307e90 100644 --- a/src/Uno.UI/Controls/Window.macOS.cs +++ b/src/Uno.UI/Controls/Window.macOS.cs @@ -42,9 +42,6 @@ public partial class Window : NSWindow internal delegate void DraggingStage2Handler(NSDraggingInfo draggingInfo); internal delegate bool PerformDragOperationHandler(NSDraggingInfo draggingInfo); - private static readonly WeakAttachedDictionary _attachedProperties = new WeakAttachedDictionary(); - private const string NeedsKeyboardAttachedPropertyKey = "NeedsKeyboard"; - private readonly InputPane _inputPane; private WeakReference _scrollViewModifiedForKeyboard; private static PointerEventArgs _previous; @@ -523,31 +520,6 @@ internal virtual bool PerformDragOperation(NSDraggingInfo draggingInfo) }; #endregion - #region Keyboard - public static void SetNeedsKeyboard(NSView view, bool needsKeyboard) - { - if (view != null) - { - _attachedProperties.SetValue(view, NeedsKeyboardAttachedPropertyKey, (bool?)needsKeyboard); - } - } - - private static bool GetNeedsKeyboard(NSView view) - { - var superViews = view.FindSuperviews().ToList(); - superViews.Insert(0, view); - - return superViews.Any(superView => _attachedProperties.GetValue(superView, NeedsKeyboardAttachedPropertyKey, () => default(bool?)).GetValueOrDefault()); - } - - private static bool NeedsKeyboard(NSView view) - { - return view is NSTextView - || view is NSTextField - || GetNeedsKeyboard(view); - } - #endregion - public BringIntoViewMode? FocusedViewBringIntoViewOnKeyboardOpensMode { get; set; } diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.macOS.cs b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.macOS.cs index 378296f0143a..330b1ab0c516 100644 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.macOS.cs +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.macOS.cs @@ -188,17 +188,6 @@ public int SelectionLength } } - public override NSView HitTest(CGPoint point) - { - var view = base.HitTest(point); - if (view != null) - { - Uno.UI.Controls.Window.SetNeedsKeyboard(view, true); - } - - return view; - } - partial void OnForegroundColorChangedPartial(Brush newValue) { if (_textBoxView != null) From 458fb4d3b70363d839bbbac0ef0719cf215ebe8f Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Mon, 6 Feb 2023 07:38:46 +0200 Subject: [PATCH 2/2] chore: Update PackageDiffIgnore --- build/PackageDiffIgnore.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/build/PackageDiffIgnore.xml b/build/PackageDiffIgnore.xml index f07f55d5b6ba..7c75c807d8f8 100644 --- a/build/PackageDiffIgnore.xml +++ b/build/PackageDiffIgnore.xml @@ -9386,6 +9386,7 @@ +