forked from Mirrors/wine-wine
winemac: Maintain a list of which windows have been "key" (focused) recently.
parent
6cde62ac18
commit
beccf0f8c0
|
@ -35,6 +35,8 @@
|
|||
NSLock* eventQueuesLock;
|
||||
|
||||
NSTimeInterval eventTimeAdjustment;
|
||||
|
||||
NSMutableArray* keyWindows;
|
||||
}
|
||||
|
||||
- (void) transformProcessToForeground;
|
||||
|
|
|
@ -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
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in New Issue