diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m index 85cac5f4996..757ad6b3bf3 100644 --- a/dlls/winemac.drv/cocoa_event.m +++ b/dlls/winemac.drv/cocoa_event.m @@ -267,7 +267,7 @@ - (MacDrvEvent*) getEventMatchingMask:(macdrv_event_mask)mask return ret; } - - (void) discardEventsMatchingMask:(macdrv_event_mask)mask forWindow:(NSWindow*)window + - (void) discardEventsPassingTest:(BOOL (^)(macdrv_event* event))block { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSIndexSet* indexes; @@ -276,8 +276,7 @@ - (void) discardEventsMatchingMask:(macdrv_event_mask)mask forWindow:(NSWindow*) indexes = [events indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop){ MacDrvEvent* event = obj; - return ((event_mask_for_type(event->event->type) & mask) && - (!window || event->event->window == (macdrv_window)window)); + return block(event->event); }]; [events removeObjectsAtIndexes:indexes]; @@ -287,6 +286,14 @@ - (void) discardEventsMatchingMask:(macdrv_event_mask)mask forWindow:(NSWindow*) [pool release]; } + - (void) discardEventsMatchingMask:(macdrv_event_mask)mask forWindow:(NSWindow*)window + { + [self discardEventsPassingTest:^BOOL (macdrv_event* event){ + return ((event_mask_for_type(event->type) & mask) && + (!window || event->window == (macdrv_window)window)); + }]; + } + - (BOOL) query:(macdrv_query*)query timeout:(NSTimeInterval)timeout processEvents:(BOOL)processEvents { macdrv_event* event; diff --git a/dlls/winemac.drv/cocoa_status_item.m b/dlls/winemac.drv/cocoa_status_item.m index f0a5863cb8e..c38dc51a93d 100644 --- a/dlls/winemac.drv/cocoa_status_item.m +++ b/dlls/winemac.drv/cocoa_status_item.m @@ -96,6 +96,12 @@ - (void) removeFromStatusBar NSStatusBar* statusBar = [NSStatusBar systemStatusBar]; [statusBar removeStatusItem:item]; [item setView:nil]; + + [queue discardEventsPassingTest:^BOOL (macdrv_event* event){ + return ((event->type == STATUS_ITEM_MOUSE_BUTTON && event->status_item_mouse_button.item == (macdrv_status_item)self) || + (event->type == STATUS_ITEM_MOUSE_MOVE && event->status_item_mouse_move.item == (macdrv_status_item)self)); + }]; + self.item = nil; } }