winemac: Maintain a list of which windows have been "key" (focused) recently.

oldstable
Ken Thomases 2013-01-27 16:19:45 -06:00 committed by Alexandre Julliard
parent 6cde62ac18
commit beccf0f8c0
2 changed files with 32 additions and 1 deletions

View File

@ -35,6 +35,8 @@
NSLock* eventQueuesLock;
NSTimeInterval eventTimeAdjustment;
NSMutableArray* keyWindows;
}
- (void) transformProcessToForeground;

View File

@ -34,7 +34,9 @@ int macdrv_err_on;
eventQueues = [[NSMutableArray alloc] init];
eventQueuesLock = [[NSLock alloc] init];
if (!eventQueues || !eventQueuesLock)
keyWindows = [[NSMutableArray alloc] init];
if (!eventQueues || !eventQueuesLock || !keyWindows)
{
[self release];
return nil;
@ -45,6 +47,7 @@ int macdrv_err_on;
- (void) dealloc
{
[keyWindows release];
[eventQueues release];
[eventQueuesLock release];
[super dealloc];
@ -118,6 +121,32 @@ int macdrv_err_on;
return (eventTime + eventTimeAdjustment) * 1000;
}
/*
* ---------- NSApplicationDelegate methods ----------
*/
- (void)applicationWillFinishLaunching:(NSNotification *)notification
{
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc addObserverForName:NSWindowDidBecomeKeyNotification
object:nil
queue:nil
usingBlock:^(NSNotification *note){
NSWindow* window = [note object];
[keyWindows removeObjectIdenticalTo:window];
[keyWindows insertObject:window atIndex:0];
}];
[nc addObserverForName:NSWindowWillCloseNotification
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note){
NSWindow* window = [note object];
[keyWindows removeObjectIdenticalTo:window];
}];
}
@end
/***********************************************************************