diff --git a/docs/changes.txt b/docs/changes.txt index b52b768f23..750de9d7a2 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -209,3 +209,4 @@ wxOSX/Cocoa: - Don't leave wxSlider labels shown when the slider itself is hidden. - Don't generate wxEVT_TEXT_ENTER for controls without wxTE_PROCESS_ENTER. - Implement wxToolTip::SetDelay() (David Vanderson). +- Correct positioning of popup menus relative to mouse pointer (John Roberts). diff --git a/src/osx/cocoa/menu.mm b/src/osx/cocoa/menu.mm index eb52113acc..3a35165d7a 100644 --- a/src/osx/cocoa/menu.mm +++ b/src/osx/cocoa/menu.mm @@ -237,18 +237,7 @@ public : { win->ScreenToClient( &x , &y ) ; NSView *view = win->GetPeer()->GetWXWidget(); - NSRect frame = [view frame]; - frame.origin.x = x; - frame.origin.y = y; - frame.size.width = 1; - frame.size.height = 1; - NSPopUpButtonCell *popUpButtonCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]; - [popUpButtonCell setAutoenablesItems:NO]; - [popUpButtonCell setAltersStateOfSelectedItem:NO]; - [popUpButtonCell setMenu:m_osxMenu]; - [popUpButtonCell selectItem:nil]; - [popUpButtonCell performClickWithFrame:frame inView:view]; - [popUpButtonCell release]; + [m_osxMenu popUpMenuPositioningItem:nil atLocation:CGPointMake(x, y) inView:view]; } virtual void GetMenuBarDimensions(int &x, int &y, int &width, int &height) const wxOVERRIDE