Mercurial > dwindows
changeset 945:254b50be1bc1
Coordinate system changes to button press and motion notify events on Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 30 Apr 2011 19:35:32 +0000 |
parents | cdb7a53e5515 |
children | c64d3ca566f9 |
files | mac/dw.m |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Sat Apr 30 18:43:07 2011 +0000 +++ b/mac/dw.m Sat Apr 30 19:35:32 2011 +0000 @@ -260,7 +260,8 @@ case 4: { int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; - NSPoint p = [object convertPoint:[event locationInWindow] fromView:nil]; + id view = [[[event window] contentView] superview]; + NSPoint p = [view convertPoint:[event locationInWindow] toView:object]; NSEventType type = [event type]; int button = 1; @@ -280,9 +281,10 @@ { int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; int buttonmask = (int)[NSEvent pressedMouseButtons]; - NSPoint point = [object convertPoint:[event locationInWindow] fromView:nil]; - - return motionfunc(object, (int)point.x, (int)point.y, buttonmask, handler->data); + id view = [[[event window] contentView] superview]; + NSPoint p = [view convertPoint:[event locationInWindow] toView:object]; + + return motionfunc(object, (int)p.x, (int)[object frame].size.height - p.y, buttonmask, handler->data); } /* Window close event */ case 6: