diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index cfab103f2..5e681695a 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -556,7 +556,7 @@ CPRunContinuesResponse = -1002; // [theWindow._bridge _obscureWindowsBelowModalWindow]; - [CPApp setCallback:_CPRunModalLoop forNextEventMatchingMask:CPAnyEventMask untilDate:nil inMode:0 dequeue:NO]; + [CPApp setCallback:_CPRunModalLoop forNextEventMatchingMask:CPAnyEventMask untilDate:nil inMode:0 dequeue:YES]; } /*! @@ -619,14 +619,22 @@ CPRunContinuesResponse = -1002; if (_eventListeners.length) { - if (_eventListeners[_eventListeners.length - 1]._mask & (1 << [anEvent type])) - { - var listener = _eventListeners.pop(); - listener._callback(anEvent); + var listener = _eventListeners[_eventListeners.length - 1]; - if (listener._dequeue) - return; + if (listener._mask & (1 << [anEvent type])) + { + _eventListeners.pop(); + listener._callback(anEvent); } + + /* + FIXME: This does not match Cocoa documented behavior for the dequeue + flag. Cocoa says the event is dequeued only if it matches the mask. + Unfortunately event handling code in Cappuccino is depending + on an event being dequeued even if it does not match. + */ + if (listener._dequeue) + return; } if ([anEvent type] == CPMouseMoved) diff --git a/Tests/Manual/CPAlertTest/AppController.j b/Tests/Manual/CPAlertTest/AppController.j index 016f365e3..a0d1d97a0 100644 --- a/Tests/Manual/CPAlertTest/AppController.j +++ b/Tests/Manual/CPAlertTest/AppController.j @@ -44,7 +44,9 @@ [CPDocModalWindowMask, CPCriticalAlertStyle] ]; - theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(100,100,500,500) styleMask:CPTitledWindowMask]; + theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(100, 100, 500, 500) styleMask:CPTitledWindowMask]; + [theWindow setTitle:@"CPAlert Test"]; + var contentView = [theWindow contentView]; label = [[CPTextField alloc] initWithFrame:CGRectMake(15, 15, 400, 24)];