mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-05-28 00:21:57 +02:00
Avoid window flashing white when opened (final)
The previous commit would not present the window until all plugins etc. had been loaded. Since this can take a significant time it may seem like no window is opening. This commit opens a blank window as soon as possible. (Also fixes a regression introduced by the last commit where opening multiple files in tabs from Terminal would cause two tablines to be displayed.)
This commit is contained in:
@@ -1914,6 +1914,11 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
[cachedVimControllers removeObjectAtIndex:0];
|
||||
[vc setIsPreloading:NO];
|
||||
|
||||
// If the Vim process has finished loading then the window will displayed
|
||||
// now, otherwise it will be displayed when the OpenWindowMsgID message is
|
||||
// received.
|
||||
[[vc windowController] presentWindow:nil];
|
||||
|
||||
// Since we've taken one controller from the cache we take the opportunity
|
||||
// to preload another.
|
||||
[self scheduleVimControllerPreloadAfterDelay:1];
|
||||
|
||||
@@ -473,6 +473,9 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
|
||||
[self queueMessage:OpenWindowMsgID data:nil];
|
||||
|
||||
// HACK: Clear window immediately upon opening to avoid it flashing white.
|
||||
[self clearAll];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#endif
|
||||
BOOL isPreloading;
|
||||
NSDate *creationDate;
|
||||
BOOL windowHasBeenPresented;
|
||||
}
|
||||
|
||||
- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
|
||||
|
||||
@@ -548,14 +548,17 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
{
|
||||
if (OpenWindowMsgID == msgid) {
|
||||
[windowController openWindow];
|
||||
|
||||
// HACK: Delay actually presenting the window onscreen until after
|
||||
// processing the queue since it contains drawing commands that need to
|
||||
// be issued before presentation; otherwise the window may flash white
|
||||
// just as it opens.
|
||||
if (!isPreloading)
|
||||
[windowController performSelector:@selector(presentWindow:)
|
||||
withObject:nil
|
||||
afterDelay:0];
|
||||
} else if (BatchDrawMsgID == msgid) {
|
||||
[[[windowController vimView] textView] performBatchDrawWithData:data];
|
||||
|
||||
// HACK! In order to avoid the window flashing white on startup we take
|
||||
// care to only present the window on screen once something has been
|
||||
// drawn to it.
|
||||
if (!windowHasBeenPresented)
|
||||
windowHasBeenPresented = [windowController presentWindow];
|
||||
} else if (SelectTabMsgID == msgid) {
|
||||
#if 0 // NOTE: Tab selection is done inside updateTabsWithData:.
|
||||
const void *bytes = [data bytes];
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
- (void)setWindowAutosaveKey:(NSString *)key;
|
||||
- (void)cleanup;
|
||||
- (void)openWindow;
|
||||
- (BOOL)presentWindow;
|
||||
- (BOOL)presentWindow:(id)unused;
|
||||
- (void)updateTabsWithData:(NSData *)data;
|
||||
- (void)selectTabWithIndex:(int)idx;
|
||||
- (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
keepOnScreen:YES];
|
||||
}
|
||||
|
||||
- (BOOL)presentWindow
|
||||
- (BOOL)presentWindow:(id)unused
|
||||
{
|
||||
// Actually show the window on screen. However, if openWindow hasn't
|
||||
// already been called nothing will happen (the window will be displayed
|
||||
|
||||
Reference in New Issue
Block a user