diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-17 03:44:24 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-17 19:39:47 +0400 |
commit | feff890b6d7570a6676d54f42623b40c6a4e4090 (patch) | |
tree | ce75efeb41bd4097807ce521925e4e2a29fe85c2 /main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs | |
parent | c8b60757713a28d0384fcaf77e6ea1922b904ee0 (diff) |
Work around GTK context menu bug
Triggering context menu from a button press event (which is the
correct thing to do) on mac is problematic because the release
event sometimes causes the menu to hide again (e.g. sln pad but
only when docked on left side). Work around this by triggering
it on the release event instead.
Diffstat (limited to 'main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs')
-rw-r--r-- | main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs index fc2b9cf79a..4ee8c0eb85 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs @@ -100,10 +100,10 @@ namespace MonoDevelop.Gettext //FIXME: avoid unnecessary creation of old treeview scrolledwindow1.Remove (treeviewEntries); treeviewEntries.Destroy (); - treeviewEntries = new ContextMenuTreeView (); + treeviewEntries = new MonoDevelop.Components.ContextMenuTreeView (); treeviewEntries.ShowAll (); scrolledwindow1.Add (treeviewEntries); - ((ContextMenuTreeView)treeviewEntries).DoPopupMenu = ShowPopup; + ((MonoDevelop.Components.ContextMenuTreeView)treeviewEntries).DoPopupMenu = ShowPopup; this.headersEditor = new CatalogHeadersWidget (); this.notebookPages.AppendPage (headersEditor, new Gtk.Label ()); @@ -1291,31 +1291,5 @@ namespace MonoDevelop.Gettext } } #endregion - - class ContextMenuTreeView : Gtk.TreeView - { - public Action<Gdk.EventButton> DoPopupMenu { get; set; } - - protected override bool OnButtonPressEvent (Gdk.EventButton evnt) - { - bool res = base.OnButtonPressEvent (evnt); - - if (DoPopupMenu != null && evnt.TriggersContextMenu ()) { - DoPopupMenu (evnt); - return true; - } - - return res; - } - - protected override bool OnPopupMenu () - { - if (DoPopupMenu != null) { - DoPopupMenu (null); - return true; - } - return base.OnPopupMenu (); - } - } } -} +}
\ No newline at end of file |