comparison mac/dw.m @ 711:82250177f814

Fix for popup menus not being created when window handle passed is a toplevel window.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 12 Mar 2011 06:19:35 +0000
parents 78460ff977c1
children 01107d8e033e
comparison
equal deleted inserted replaced
710:78460ff977c1 711:82250177f814
5085 * y: Y coordinate. 5085 * y: Y coordinate.
5086 */ 5086 */
5087 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) 5087 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
5088 { 5088 {
5089 NSMenu *thismenu = (NSMenu *)*menu; 5089 NSMenu *thismenu = (NSMenu *)*menu;
5090 NSView *view = parent; 5090 id object = parent;
5091 NSView *view = [object isKindOfClass:[NSWindow class]] ? [object contentView] : parent;
5091 NSWindow *window = [view window]; 5092 NSWindow *window = [view window];
5092 NSEvent *event = [DWApp currentEvent]; 5093 NSEvent *event = [DWApp currentEvent];
5093 NSEvent* fake = [NSEvent mouseEventWithType:NSRightMouseDown 5094 NSEvent* fake = [NSEvent mouseEventWithType:NSRightMouseDown
5094 location:[window convertScreenToBase:NSMakePoint(x, y)] 5095 location:[window convertScreenToBase:NSMakePoint(x, y)]
5095 modifierFlags:0 5096 modifierFlags:0