Commit 9d1cfecc authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: When removing the status item for a systray icon, discard any…

winemac: When removing the status item for a systray icon, discard any associated events in the queue.
parent ba57f572
......@@ -267,7 +267,7 @@ static const OSType WineHotKeySignature = 'Wine';
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 @@ static const OSType WineHotKeySignature = 'Wine';
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 @@ static const OSType WineHotKeySignature = 'Wine';
[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;
......
......@@ -96,6 +96,12 @@
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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment