mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge pull request #308 from steakknife/fix_256__defer_nsalerts
Defer alerts until the window is shown
This commit is contained in:
@@ -839,9 +839,11 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
if (dict)
|
||||
[self handleBrowseForFile:dict];
|
||||
} else if (ShowDialogMsgID == msgid) {
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
|
||||
if (dict)
|
||||
[self handleShowDialog:dict];
|
||||
[windowController runAfterWindowPresentedUsingBlock:^{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
|
||||
if (dict)
|
||||
[self handleShowDialog:dict];
|
||||
}];
|
||||
} else if (DeleteSignMsgID == msgid) {
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
|
||||
if (dict)
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
NSToolbar *toolbar;
|
||||
BOOL resizingDueToMove;
|
||||
int blurRadius;
|
||||
NSMutableArray *afterWindowPresentedQueue;
|
||||
}
|
||||
|
||||
- (id)initWithVimController:(MMVimController *)controller;
|
||||
@@ -89,6 +90,7 @@
|
||||
- (void)setBufferModified:(BOOL)mod;
|
||||
- (void)setTopLeft:(NSPoint)pt;
|
||||
- (BOOL)getDefaultTopLeft:(NSPoint*)pt;
|
||||
- (void)runAfterWindowPresentedUsingBlock:(void (^)(void))block;
|
||||
|
||||
- (IBAction)addNewTab:(id)sender;
|
||||
- (IBAction)toggleToolbar:(id)sender;
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
- (BOOL)maximizeWindow:(int)options;
|
||||
- (void)applicationDidChangeScreenParameters:(NSNotification *)notification;
|
||||
- (void)enterNativeFullScreen;
|
||||
- (void)processAfterWindowPresentedQueue;
|
||||
@end
|
||||
|
||||
|
||||
@@ -236,6 +237,8 @@
|
||||
[windowAutosaveKey release]; windowAutosaveKey = nil;
|
||||
[vimView release]; vimView = nil;
|
||||
[toolbar release]; toolbar = nil;
|
||||
// in case processAfterWindowPresentedQueue wasn't called
|
||||
[afterWindowPresentedQueue release]; afterWindowPresentedQueue = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -344,6 +347,9 @@
|
||||
// code to depend on the screen state. (Such as constraining views etc.)
|
||||
windowPresented = YES;
|
||||
|
||||
// Process deferred blocks
|
||||
[self processAfterWindowPresentedQueue];
|
||||
|
||||
if (fullScreenWindow) {
|
||||
// Delayed entering of full-screen happens here (a ":set fu" in a
|
||||
// GUIEnter auto command could cause this).
|
||||
@@ -1329,6 +1335,19 @@
|
||||
|
||||
#endif // (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
|
||||
|
||||
- (void)runAfterWindowPresentedUsingBlock:(void (^)(void))block
|
||||
{
|
||||
if (windowPresented) { // no need to defer block, just run it now
|
||||
block();
|
||||
return;
|
||||
}
|
||||
|
||||
// run block later
|
||||
if (afterWindowPresentedQueue == nil)
|
||||
afterWindowPresentedQueue = [[NSMutableArray alloc] init];
|
||||
[afterWindowPresentedQueue addObject:[block copy]];
|
||||
}
|
||||
|
||||
@end // MMWindowController
|
||||
|
||||
|
||||
@@ -1665,5 +1684,12 @@
|
||||
[decoratedWindow realToggleFullScreen:self];
|
||||
}
|
||||
|
||||
- (void)processAfterWindowPresentedQueue
|
||||
{
|
||||
for (void (^block)(void) in afterWindowPresentedQueue)
|
||||
block();
|
||||
|
||||
[afterWindowPresentedQueue release]; afterWindowPresentedQueue = nil;
|
||||
}
|
||||
@end // MMWindowController (Private)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user