Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 6ca77e9

Browse files
authored
Merge pull request #8922 from mono/fix-1001720
Fixes overlapping in custom native property pad on PadContentShown/Hidden
2 parents b00b847 + 714eef1 commit 6ca77e9

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,14 @@ protected override void Initialize (IPadWindow container)
104104

105105
propertyGrid.SetToolbarProvider (toolbarProvider);
106106

107+
#if MAC
107108
//native cocoa needs content shown to initialize stuff
108109
if (isNative) {
109110
container.PadContentShown += Window_PadContentShown;
111+
container.PadContentHidden += Window_PadContentHidden;
110112
}
113+
#endif
114+
111115
this.container = container;
112116
DesignerSupport.Service.SetPad (this);
113117
}
@@ -127,6 +131,7 @@ public override void Dispose()
127131
#if MAC
128132
if (isNative) {
129133
container.PadContentShown -= Window_PadContentShown;
134+
container.PadContentHidden -= Window_PadContentHidden;
130135
nativeGrid.PropertyGridChanged -= Grid_Changed;
131136
} else {
132137
#endif
@@ -181,11 +186,24 @@ public void BlankPad ()
181186
CommandRouteOrigin = null;
182187
}
183188

189+
#if MAC
184190
void Window_PadContentShown (object sender, EventArgs e)
185191
{
186192
propertyGrid.OnPadContentShown ();
193+
194+
if (customWidget && frame.Child is GtkNSViewHost viewHost) {
195+
viewHost.Visible = true;
196+
}
187197
}
188198

199+
void Window_PadContentHidden (object sender, EventArgs e)
200+
{
201+
if (customWidget && frame.Child is GtkNSViewHost viewHost) {
202+
viewHost.Visible = false;
203+
}
204+
}
205+
#endif
206+
189207
void AttachToolbarIfCustomWidget ()
190208
{
191209
if (customWidget) {
@@ -212,7 +230,10 @@ internal void UseCustomWidget (Gtk.Widget widget)
212230
customWidget = true;
213231
frame.Remove (frame.Child);
214232
frame.Add (widget);
215-
widget.Show ();
233+
widget.Show ();
234+
if (container != null) {
235+
widget.Visible = container.ContentVisible;
236+
}
216237
}
217238

218239
void ClearToolbar ()

main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/GtkNSViewHost.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ static NSEvent GetNSEvent (Gdk.Event evnt)
8080
bool disposeViewOnGtkDestroy;
8181
bool sizeAllocated;
8282

83+
protected override void OnShown ()
84+
{
85+
view.Hidden = false;
86+
base.OnShown ();
87+
}
88+
89+
protected override void OnHidden ()
90+
{
91+
view.Hidden = true;
92+
base.OnHidden ();
93+
}
94+
8395
public GtkNSViewHost (NSView view)
8496
: this (view, disposeViewOnGtkDestroy: false)
8597
{

0 commit comments

Comments
 (0)