Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: Remove SetNeedsKeyboard from macOS #11197

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/PackageDiffIgnore.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9388,6 +9388,7 @@
<Member fullName="Windows.UI.Xaml.CornerRadius Uno.UI.Toolkit.ElevatedView.get_CornerRadius()" reason="Already exists in Control and ElevatedView should not shadow it" />
<Member fullName="System.Void Uno.UI.Toolkit.ElevatedView.set_CornerRadius(Windows.UI.Xaml.CornerRadius value)" reason="Already exists in Control and ElevatedView should not shadow it" />
<Member fullName="Windows.UI.Xaml.DependencyProperty Uno.UI.Toolkit.ElevatedView.get_CornerRadiusProperty()" reason="Already exists in Control and ElevatedView should not shadow it" />
<Member fullName="System.Void Uno.UI.Controls.Window.SetNeedsKeyboard(AppKit.NSView view, System.Boolean needsKeyboard)" reason="Not needed and doesn't do something useful" />
<Member fullName="System.Void Windows.ApplicationModel.SuspendingDeferral..ctor(System.Action deferralDone)" reason="This constructor does not exist in Windows" />
</Methods>
</IgnoreSet>
Expand Down
28 changes: 0 additions & 28 deletions src/Uno.UI/Controls/Window.macOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<NSView, string> _attachedProperties = new WeakAttachedDictionary<NSView, string>();
private const string NeedsKeyboardAttachedPropertyKey = "NeedsKeyboard";

private readonly InputPane _inputPane;
private WeakReference<NSScrollView> _scrollViewModifiedForKeyboard;
private static PointerEventArgs _previous;
Expand Down Expand Up @@ -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; }


Expand Down
11 changes: 0 additions & 11 deletions src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.macOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down