diff options
author | Cody Russell <cody@jhu.edu> | 2015-06-29 21:49:51 +0300 |
---|---|---|
committer | Cody Russell <cody@jhu.edu> | 2015-06-30 07:11:50 +0300 |
commit | a8391331ee54468fe238fa07a423b3b6ad229384 (patch) | |
tree | a8fa4ffb41f8cffb5eee3167a9fbe9f7251d084a /main/src/addins/MonoDevelop.SourceEditor2 | |
parent | dcb450f871a257c41c195254733b34ee5f235c0e (diff) |
[Ide] Context menu component improvements.
Refactored some of the internals of how we compute context menu position
and made it so that we can pass in [x,y] in window coordinates to show a
context menu. Now positioning by the text cursor with Alt-Shift-F10
works.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=21127
Diffstat (limited to 'main/src/addins/MonoDevelop.SourceEditor2')
-rw-r--r-- | main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs index fa68cdbd7d..84b2484b64 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs @@ -585,7 +585,15 @@ namespace MonoDevelop.SourceEditor CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet (ctx, menuPath); if (Platform.IsMac) { - IdeApp.CommandService.ShowContextMenu (this, evt, cset, this); + if (evt == null) { + int x, y; + var pt = LocationToPoint (this.Caret.Location); + TranslateCoordinates (Toplevel, pt.X, pt.Y, out x, out y); + + IdeApp.CommandService.ShowContextMenu (this, x, y, cset, this); + } else { + IdeApp.CommandService.ShowContextMenu (this, evt, cset, this); + } } else { Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset); var imMenu = CreateInputMethodMenuItem (GettextCatalog.GetString ("_Input Methods")); @@ -599,7 +607,8 @@ namespace MonoDevelop.SourceEditor GtkWorkarounds.ShowContextMenu (menu, this, evt); } else { var pt = LocationToPoint (this.Caret.Location); - GtkWorkarounds.ShowContextMenu (menu, this, new Gdk.Rectangle (pt.X, pt.Y, 1, (int)LineHeight)); + + GtkWorkarounds.ShowContextMenu (menu, this, (int)pt.X, (int)pt.Y); } } } |