From f9d55c9d082ffed373d86f01ee02b49caac7876b Mon Sep 17 00:00:00 2001 From: BDisp Date: Sat, 4 Jul 2020 09:43:18 +0100 Subject: [PATCH] Ensures the HasFocus property only can be set by the SetHasFocus method. Removed unnecessary code in Menu. --- Terminal.Gui/Core/Responder.cs | 3 +-- Terminal.Gui/Core/View.cs | 1 + Terminal.Gui/Views/Menu.cs | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/Core/Responder.cs b/Terminal.Gui/Core/Responder.cs index 15bb22b05..52fce4b21 100644 --- a/Terminal.Gui/Core/Responder.cs +++ b/Terminal.Gui/Core/Responder.cs @@ -24,12 +24,11 @@ namespace Terminal.Gui { /// true if can focus; otherwise, false. public virtual bool CanFocus { get; set; } - internal bool hasFocus; /// /// Gets or sets a value indicating whether this has focus. /// /// true if has focus; otherwise, false. - public virtual bool HasFocus { get { return hasFocus; } } + public virtual bool HasFocus { get; } // Key handling /// diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index b798be760..762c3702f 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -895,6 +895,7 @@ namespace Terminal.Gui { } } + bool hasFocus; /// public override bool HasFocus { get { diff --git a/Terminal.Gui/Views/Menu.cs b/Terminal.Gui/Views/Menu.cs index aa71c87bf..40d53fa22 100644 --- a/Terminal.Gui/Views/Menu.cs +++ b/Terminal.Gui/Views/Menu.cs @@ -535,8 +535,6 @@ namespace Terminal.Gui { if (item == null || !item.IsEnabled ()) disabled = true; if (item != null && !disabled) current = me.Y - 1; - hasFocus = true; - SetNeedsDisplay (); CheckSubMenu (); return true; }