Mercurial > dwindows
comparison mac/dw.m @ 946:c64d3ca566f9
Attempt at inverting the window position and mouse pointer coordinates on Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 30 Apr 2011 21:33:27 +0000 |
parents | 254b50be1bc1 |
children | c9f6ba940453 |
comparison
equal
deleted
inserted
replaced
945:254b50be1bc1 | 946:c64d3ca566f9 |
---|---|
6348 { | 6348 { |
6349 *x = mouseLoc.x; | 6349 *x = mouseLoc.x; |
6350 } | 6350 } |
6351 if(y) | 6351 if(y) |
6352 { | 6352 { |
6353 *y = mouseLoc.y; | 6353 *y = [[NSScreen mainScreen] frame].size.height - mouseLoc.y; |
6354 } | 6354 } |
6355 } | 6355 } |
6356 | 6356 |
6357 /* | 6357 /* |
6358 * Sets the X and Y coordinates of the mouse pointer. | 6358 * Sets the X and Y coordinates of the mouse pointer. |
6416 NSMenu *thismenu = (NSMenu *)*menu; | 6416 NSMenu *thismenu = (NSMenu *)*menu; |
6417 id object = parent; | 6417 id object = parent; |
6418 NSView *view = [object isKindOfClass:[NSWindow class]] ? [object contentView] : parent; | 6418 NSView *view = [object isKindOfClass:[NSWindow class]] ? [object contentView] : parent; |
6419 NSWindow *window = [view window]; | 6419 NSWindow *window = [view window]; |
6420 NSEvent *event = [DWApp currentEvent]; | 6420 NSEvent *event = [DWApp currentEvent]; |
6421 NSPoint p = NSMakePoint(x, [[NSScreen mainScreen] frame].size.height - y); | |
6421 NSEvent* fake = [NSEvent mouseEventWithType:NSRightMouseDown | 6422 NSEvent* fake = [NSEvent mouseEventWithType:NSRightMouseDown |
6422 location:[window convertScreenToBase:NSMakePoint(x, y)] | 6423 location:[window convertScreenToBase:p] |
6423 modifierFlags:0 | 6424 modifierFlags:0 |
6424 timestamp:[event timestamp] | 6425 timestamp:[event timestamp] |
6425 windowNumber:[window windowNumber] | 6426 windowNumber:[window windowNumber] |
6426 context:[NSGraphicsContext currentContext] | 6427 context:[NSGraphicsContext currentContext] |
6427 eventNumber:1 | 6428 eventNumber:1 |
7531 int _locked_by_me = FALSE; | 7532 int _locked_by_me = FALSE; |
7532 DW_MUTEX_LOCK; | 7533 DW_MUTEX_LOCK; |
7533 NSObject *object = handle; | 7534 NSObject *object = handle; |
7534 NSPoint point; | 7535 NSPoint point; |
7535 point.x = x; | 7536 point.x = x; |
7536 point.y = y; | 7537 point.y = [[NSScreen mainScreen] frame].size.height - y; |
7537 | 7538 |
7538 if([ object isKindOfClass:[ NSWindow class ] ]) | 7539 if([ object isKindOfClass:[ NSWindow class ] ]) |
7539 { | 7540 { |
7540 NSWindow *window = handle; | 7541 NSWindow *window = handle; |
7541 [window setFrameOrigin:point]; | 7542 [window setFrameOrigin:point]; |
7576 NSWindow *window = handle; | 7577 NSWindow *window = handle; |
7577 NSRect rect = [window frame]; | 7578 NSRect rect = [window frame]; |
7578 if(x) | 7579 if(x) |
7579 *x = rect.origin.x; | 7580 *x = rect.origin.x; |
7580 if(y) | 7581 if(y) |
7581 *y = rect.origin.y; | 7582 *y = [[NSScreen mainScreen] frame].size.height - rect.origin.y; |
7582 if(width) | 7583 if(width) |
7583 *width = rect.size.width; | 7584 *width = rect.size.width; |
7584 if(height) | 7585 if(height) |
7585 *height = rect.size.height; | 7586 *height = rect.size.height; |
7586 return; | 7587 return; |