comparison mac/dw.m @ 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
comparison
equal deleted inserted replaced
944:cdb7a53e5515 945:254b50be1bc1
258 /* Button press and release event */ 258 /* Button press and release event */
259 case 3: 259 case 3:
260 case 4: 260 case 4:
261 { 261 {
262 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; 262 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction;
263 NSPoint p = [object convertPoint:[event locationInWindow] fromView:nil]; 263 id view = [[[event window] contentView] superview];
264 NSPoint p = [view convertPoint:[event locationInWindow] toView:object];
264 NSEventType type = [event type]; 265 NSEventType type = [event type];
265 int button = 1; 266 int button = 1;
266 267
267 if(type == NSRightMouseDown || type == NSRightMouseUp) 268 if(type == NSRightMouseDown || type == NSRightMouseUp)
268 { 269 {
278 /* Motion notify event */ 279 /* Motion notify event */
279 case 5: 280 case 5:
280 { 281 {
281 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; 282 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction;
282 int buttonmask = (int)[NSEvent pressedMouseButtons]; 283 int buttonmask = (int)[NSEvent pressedMouseButtons];
283 NSPoint point = [object convertPoint:[event locationInWindow] fromView:nil]; 284 id view = [[[event window] contentView] superview];
284 285 NSPoint p = [view convertPoint:[event locationInWindow] toView:object];
285 return motionfunc(object, (int)point.x, (int)point.y, buttonmask, handler->data); 286
287 return motionfunc(object, (int)p.x, (int)[object frame].size.height - p.y, buttonmask, handler->data);
286 } 288 }
287 /* Window close event */ 289 /* Window close event */
288 case 6: 290 case 6:
289 { 291 {
290 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction; 292 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction;