mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Improve window restoring
Zoom or minimize windows before ordering them front, and for the latter, don’t actually order them front (as that magnifies them). Also order front windows without also setting the window as key window.
This commit is contained in:
@@ -2458,27 +2458,43 @@ static NSUInteger DisableSessionSavingCount = 0;
|
||||
BOOL res = NO;
|
||||
++DisableSessionSavingCount;
|
||||
|
||||
NSWindow* keyWindow;
|
||||
|
||||
NSDictionary* session = [NSDictionary dictionaryWithContentsOfFile:[self sessionPath]];
|
||||
for(NSDictionary* project in session[@"projects"])
|
||||
{
|
||||
DocumentController* controller = [DocumentController new];
|
||||
[controller setupControllerForProject:project skipMissingFiles:NO];
|
||||
if(controller.documents.empty())
|
||||
continue;
|
||||
|
||||
if(NSString* windowFrame = project[@"windowFrame"])
|
||||
{
|
||||
if([windowFrame hasPrefix:@"{"]) // Legacy NSRect
|
||||
[controller.window setFrame:NSRectFromString(windowFrame) display:NO];
|
||||
else [controller.window setFrameFromString:windowFrame];
|
||||
}
|
||||
[controller showWindow:nil];
|
||||
|
||||
if([project[@"miniaturized"] boolValue])
|
||||
{
|
||||
[controller.window miniaturize:nil];
|
||||
else if([project[@"fullScreen"] boolValue])
|
||||
[controller.window toggleFullScreen:self];
|
||||
else if([project[@"zoomed"] boolValue])
|
||||
[controller.window zoom:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
if([project[@"fullScreen"] boolValue])
|
||||
[controller.window toggleFullScreen:self];
|
||||
else if([project[@"zoomed"] boolValue])
|
||||
[controller.window zoom:self];
|
||||
|
||||
[controller.window orderFront:self];
|
||||
keyWindow = controller.window;
|
||||
}
|
||||
|
||||
res = YES;
|
||||
}
|
||||
|
||||
[keyWindow makeKeyWindow];
|
||||
|
||||
--DisableSessionSavingCount;
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user