printf("tracking!!\n");
static pascal OSStatus MyMenuEventHandler(EventHandlerCallRef myHandler, EventRef event, void* userData){  OSStatus result = eventNotHandledErr;  UInt32 kind = ::GetEventKind(event);  if (kind == kEventMenuOpening || kind == kEventMenuClosed) {    nsISupports* supports = reinterpret_cast<nsISupports*>(userData);    nsCOMPtr<nsIMenuListener> listener(do_QueryInterface(supports));    if (listener) {      MenuRef menuRef;      ::GetEventParameter(event, kEventParamDirectObject, typeMenuRef, NULL, sizeof(menuRef), NULL, &menuRef);      nsMenuEvent menuEvent;      menuEvent.message = NS_MENU_SELECTED;      menuEvent.eventStructType = NS_MENU_EVENT;      menuEvent.point.x = 0;      menuEvent.point.y = 0;      menuEvent.widget = nsnull;      menuEvent.time = PR_IntervalNow();      menuEvent.mCommand = (PRUint32) menuRef;      if (kind == kEventMenuOpening) {        gCurrentlyTrackedMenuID = ::GetMenuID(menuRef);    // remember which menu ID we're over for later        listener->MenuSelected(menuEvent);      }      else        listener->MenuDeselected(menuEvent);    }  }  else if ( kind == kEventMenuTargetItem ) {printf("tracking!!\n");    // remember which menu ID we're over for later    MenuRef menuRef;    ::GetEventParameter(event, kEventParamDirectObject, typeMenuRef, NULL, sizeof(menuRef), NULL, &menuRef);    gCurrentlyTrackedMenuID = ::GetMenuID(menuRef);  }    return result;}