diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-22 00:33:03 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-22 01:49:45 +0400 |
commit | efa4c623618abca9ee9020e2af4f010c572d4ec8 (patch) | |
tree | 2860e281949bc43d415469385dc82ffd9597b69d /main/src | |
parent | d72f7439d62ff58b65ccf35d63d44fd30f78d50d (diff) |
[Gtk] Better workaround for Mac context menu issues
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs | 17 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs | 5 |
2 files changed, 16 insertions, 6 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs index a97c0d31fb..732a7f3eef 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs @@ -314,11 +314,24 @@ namespace Mono.TextEditor }; } + uint time; + uint button; + if (evt == null) { - menu.Popup (null, null, posFunc, 0, Gtk.Global.CurrentEventTime); + time = Gtk.Global.CurrentEventTime; + button = 0; } else { - menu.Popup (null, null, posFunc, evt.Button, evt.Time); + time = evt.Time; + button = evt.Button; } + + //HACK: work around GTK menu issues on mac when passing button to menu.Popup + //some menus appear and immediately hide, and submenus don't activate + if (Platform.IsMac) { + button = 0; + } + + menu.Popup (null, null, posFunc, button, time); } public static void ShowContextMenu (Gtk.Menu menu, Gtk.Widget parent, Gdk.EventButton evt) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs index 83c8aadb07..77e3f03e1f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs @@ -56,9 +56,8 @@ namespace MonoDevelop.Components if (!res) res = base.OnButtonPressEvent (evnt); - //HACK: show context menu in release event instead of show event to work around gtk bug if (DoPopupMenu != null && evnt.TriggersContextMenu ()) { - // DoPopupMenu (evnt); + DoPopupMenu (evnt); return true; } @@ -69,9 +68,7 @@ namespace MonoDevelop.Components { bool res = base.OnButtonReleaseEvent (evnt); - //HACK: show context menu in release event instead of show event to work around gtk bug if (DoPopupMenu != null && evnt.IsContextMenuButton ()) { - DoPopupMenu (evnt); return true; } |