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

Commit 344161b

Browse files
committed
[Ide] Let the references search be a child of the notebook
This is a partial fix for VSTS #750263, AtkCocoa needs to support the right focus order, including an Action widget.
1 parent fa939f1 commit 344161b

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/SelectReferenceDialog.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
using MonoDevelop.Components;
3737
using MonoDevelop.Components.Commands;
3838
using System.IO;
39+
using System.Runtime.InteropServices;
3940

4041
namespace MonoDevelop.Ide.Projects
4142
{
@@ -157,16 +158,21 @@ TreeIter AddPackageReference (ProjectReference refInfo)
157158
}
158159
return refTreeStore.AppendValues (txt, secondaryTxt, GetTypeText (refInfo), refInfo.Reference, refInfo, ImageService.GetIcon ("md-package", IconSize.Dnd));
159160
}
160-
161+
162+
[DllImport ("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
163+
private static extern void gtk_notebook_set_action_widget (IntPtr notebook, IntPtr widget, int packType);
164+
161165
public SelectReferenceDialog ()
162166
{
163167
Build ();
164168

165169
combinedBox = new CombinedBox ();
166170
combinedBox.Show ();
167171
mainBook = new Notebook ();
168-
combinedBox.Add (mainBook);
169-
alignment1.Add (combinedBox);
172+
173+
gtk_notebook_set_action_widget (mainBook.Handle, combinedBox.Handle, (int)PackType.End);
174+
175+
alignment1.Add (mainBook);
170176
mainBook.ShowAll ();
171177

172178
filterEntry = combinedBox.FilterEntry;
@@ -538,22 +544,24 @@ protected override void OnRemoved (Widget widget)
538544

539545
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
540546
{
547+
allocation.Y -= 2;
541548
base.OnSizeAllocated (allocation);
542549
RepositionFilter ();
543550
}
544551

545552
protected override void OnSizeRequested (ref Requisition requisition)
546553
{
547-
if (Child != null)
548-
requisition = Child.SizeRequest ();
549-
requisition.Width += filterEntry.SizeRequest ().Width;
554+
requisition = Child?.SizeRequest () ?? Requisition.Zero;
555+
var entryRequest = filterEntry.SizeRequest ();
556+
requisition.Width += entryRequest.Width;
557+
requisition.Height = Math.Max (requisition.Height, entryRequest.Height);
550558
}
551559

552560
void RepositionFilter ()
553561
{
554-
int w = filterEntry.SizeRequest ().Width;
555-
int h = filterEntry.SizeRequest ().Height;
556-
filterEntry.SizeAllocate (new Gdk.Rectangle (Allocation.Width - w - 1, 0, w, h));
562+
var req = filterEntry.SizeRequest ();
563+
int h = Math.Min (Allocation.Height, req.Height);
564+
filterEntry.SizeAllocate (new Gdk.Rectangle (Allocation.Width - req.Width - 1, 0, req.Width, h));
557565
}
558566
}
559567

0 commit comments

Comments
 (0)