Fix file open problem in full screen with Spaces

This fixes a problem when a full screen window was on another Space and
files were set to open in the topmost window.  Previously, this caused a
new window to open on the current Space instead of opening the file in
the full screen window on the other Space.
This commit is contained in:
Bjorn Winckler
2010-12-30 15:31:22 +01:00
parent deb3e9a368
commit 1cb9a4ffb9
+18 -1
View File
@@ -1390,7 +1390,16 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (MMVimController *)topmostVimController
{
// Find the topmost visible window which has an associated vim controller.
// Find the topmost visible window which has an associated vim controller
// as follows:
//
// 1. Search through ordered windows as determined by NSApp. Unfortunately
// this method can fail, e.g. if a full screen window is on another
// "Space" (in this case NSApp returns no windows at all), so we have to
// fall back on ...
// 2. Search through all Vim controllers and return the first visible
// window.
NSEnumerator *e = [[NSApp orderedWindows] objectEnumerator];
id window;
while ((window = [e nextObject]) && [window isVisible]) {
@@ -1402,6 +1411,14 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
}
unsigned i, count = [vimControllers count];
for (i = 0; i < count; ++i) {
MMVimController *vc = [vimControllers objectAtIndex:i];
if ([[[vc windowController] window] isVisible]) {
return vc;
}
}
return nil;
}