diff options
author | Greg Munn <gregm@microsoft.com> | 2019-10-11 21:49:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-11 21:49:43 +0300 |
commit | 72a85c3af7e8ee96fd0c5baca27ed2b18e105e2a (patch) | |
tree | 412131a53e879db8de9426b31aa8ed12c2137bbb | |
parent | 1164db0e6a105f753a32acb61bc91b57e11e91cd (diff) | |
parent | 118c5b572081c2deca4dee75d1812cd1f9529744 (diff) |
Merge pull request #8901 from mono/backport-pr-8900-to-release-8.4
[release-8.4] [Debugger] Fixed the Placeholder text color when the row is selected/…
2 files changed, 38 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs index 65dfc8bd56..e381997c28 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs @@ -53,6 +53,24 @@ namespace MonoDevelop.Debugger this.nameView = nameView; } + public override bool AcceptsFirstResponder () + { + if (!base.AcceptsFirstResponder ()) + return false; + + // Note: The MacDebuggerObjectNameView sets the PlaceholderAttributedString property + // so that it can control the font color and the baseline offset. Unfortunately, this + // breaks once the NSTextField is in "edit" mode because the placeholder text ends up + // being rendered as black instead of gray. By reverting to using the basic + // PlaceholderString property once we enter "edit" mode, it fixes the text color. + var placeholder = PlaceholderAttributedString; + + if (placeholder != null) + PlaceholderString = placeholder.Value; + + return true; + } + public override void DidBeginEditing (NSNotification notification) { base.DidBeginEditing (notification); @@ -111,7 +129,7 @@ namespace MonoDevelop.Debugger TextField = new EditableTextField (this) { AutoresizingMask = NSViewResizingMask.WidthSizable, TranslatesAutoresizingMaskIntoConstraints = false, - BackgroundColor = NSColor.Clear, + DrawsBackground = false, Bordered = false, Editable = false }; diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs index 07e0ed062a..0928aa5d53 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs @@ -53,6 +53,24 @@ namespace MonoDevelop.Debugger this.valueView = valueView; } + public override bool AcceptsFirstResponder () + { + if (!base.AcceptsFirstResponder ()) + return false; + + // Note: The MacDebuggerObjectValueView sets the PlaceholderAttributedString property + // so that it can control the font color and the baseline offset. Unfortunately, this + // breaks once the NSTextField is in "edit" mode because the placeholder text ends up + // being rendered as black instead of gray. By reverting to using the basic + // PlaceholderString property once we enter "edit" mode, it fixes the text color. + var placeholder = PlaceholderAttributedString; + + if (placeholder != null) + PlaceholderString = placeholder.Value; + + return true; + } + public override void DidBeginEditing (NSNotification notification) { base.DidBeginEditing (notification); @@ -135,7 +153,7 @@ namespace MonoDevelop.Debugger TextField = new EditableTextField (this) { AutoresizingMask = NSViewResizingMask.WidthSizable, TranslatesAutoresizingMaskIntoConstraints = false, - BackgroundColor = NSColor.Clear, + DrawsBackground = false, Bordered = false, Editable = false }; |