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:
Bjorn Winckler
2010-07-16 01:58:04 +02:00
parent 9b3ab2637a
commit 7dc2c998ff
6 changed files with 19 additions and 9 deletions
+5
View File
@@ -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];
+3
View File
@@ -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;
}
-1
View File
@@ -41,7 +41,6 @@
#endif
BOOL isPreloading;
NSDate *creationDate;
BOOL windowHasBeenPresented;
}
- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
+9 -6
View File
@@ -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];
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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