void PopupContextMenuAtLocation (Gtk.Menu menu, int x, int y)
{
menu.ShowAll ();
Gtk.MenuPositionFunc pos_menu_func = null;
// Set up the funtion to position the context menu
// if we were called by the keyboard Gdk.Key.Menu.
if (x == 0 && y == 0)
pos_menu_func = PositionContextMenu;
try {
menu.Popup (null, null,
pos_menu_func,
0,
Gtk.Global.CurrentEventTime);
} catch {
Logger.Debug ("Menu popup failed with custom MenuPositionFunc; trying again without");
menu.Popup (null, null,
null,
0,
Gtk.Global.CurrentEventTime);
}
}