# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1318215267 0 # Node ID aac69b11e821f2988c73f68d6a7fb430932db4a9 # Parent 10f5b8645975bda31b19c938acbdb75169c08c21 Fix to get button press events working from the task/statusbar on Mac. Need to check that the parameter is an NSEvent in the handler, because... When calling the selector like this it will actually be the NSStatusItem. diff -r 10f5b8645975 -r aac69b11e821 mac/dw.m --- a/mac/dw.m Mon Oct 10 02:04:17 2011 +0000 +++ b/mac/dw.m Mon Oct 10 02:54:27 2011 +0000 @@ -261,18 +261,24 @@ case 4: { int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; - id view = [[[event window] contentView] superview]; - NSPoint p = [view convertPoint:[event locationInWindow] toView:object]; - NSEventType type = [event type]; + NSPoint p = [NSEvent mouseLocation]; int button = 1; - - if(type == NSRightMouseDown || type == NSRightMouseUp) + + if([event isMemberOfClass:[NSEvent class]]) { - button = 2; - } - else if(type == NSOtherMouseDown || type == NSOtherMouseUp) - { - button = 3; + id view = [[[event window] contentView] superview]; + NSEventType type = [event type]; + + p = [view convertPoint:[event locationInWindow] toView:object]; + + if(type == NSRightMouseDown || type == NSRightMouseUp) + { + button = 2; + } + else if(type == NSOtherMouseDown || type == NSOtherMouseUp) + { + button = 3; + } } return buttonfunc(object, (int)p.x, (int)p.y, button, handler->data); @@ -6085,6 +6091,7 @@ [item setEnabled:YES]; [item setHighlightMode:YES]; [item sendActionOn:(NSLeftMouseUpMask|NSLeftMouseDownMask|NSRightMouseUpMask|NSRightMouseDownMask)]; + [item setAction:@selector(mouseDown:)]; dw_window_set_data(handle, "_dw_taskbar", item); }