mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
- Added processCommandQueueDidFinish notification to MMWindowController - Window resizing is delayed until processCommandQueueDidFinish (no more need for performSelectionOnMainThread:::)
git-svn-id: http://macvim.googlecode.com/svn/trunk@102 96c4425d-ca35-0410-94e5-3396d5c13a8f
This commit is contained in:
+3
-8
@@ -213,6 +213,8 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
[self updateMainMenu];
|
||||
}
|
||||
|
||||
[windowController processCommandQueueDidFinish];
|
||||
|
||||
inProcessCommandQueue = NO;
|
||||
|
||||
count = [sendQueue count];
|
||||
@@ -301,14 +303,7 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
|
||||
[windowController updateTabsWithData:data];
|
||||
} else if (ShowTabBarMsgID == msgid) {
|
||||
//NSLog(@"Showing tab bar");
|
||||
|
||||
// HACK! Vim sends several draw commands etc. after the show message
|
||||
// and these can mess up the display when showing the tab bar results
|
||||
// in the window having to resize to fit the screen; delaying this
|
||||
// message alleviates this problem.
|
||||
[windowController performSelectorOnMainThread:@selector(showTabBar:)
|
||||
withObject:self waitUntilDone:NO];
|
||||
//[windowController showTabBar:self];
|
||||
[windowController showTabBar:self];
|
||||
} else if (HideTabBarMsgID == msgid) {
|
||||
//NSLog(@"Hiding tab bar");
|
||||
[windowController hideTabBar:self];
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
MMTextStorage *textStorage;
|
||||
NSMutableArray *scrollbars;
|
||||
BOOL setupDone;
|
||||
BOOL shouldUpdateWindowSize;
|
||||
}
|
||||
|
||||
- (id)initWithVimController:(MMVimController *)controller;
|
||||
@@ -51,6 +52,7 @@
|
||||
identifier:(long)ident;
|
||||
- (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore;
|
||||
- (void)setFont:(NSFont *)font;
|
||||
- (void)processCommandQueueDidFinish;
|
||||
|
||||
- (IBAction)addNewTab:(id)sender;
|
||||
- (IBAction)showTabBar:(id)sender;
|
||||
|
||||
+31
-13
@@ -304,7 +304,7 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
[textStorage setMaxRows:rows columns:cols];
|
||||
|
||||
if (setupDone && ![textView inLiveResize])
|
||||
[self resizeWindowToFit:self];
|
||||
shouldUpdateWindowSize = YES;
|
||||
}
|
||||
|
||||
- (void)setStatusText:(NSString *)text
|
||||
@@ -361,9 +361,9 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
if (![scroller isHidden]) {
|
||||
// A visible scroller was removed, so the window must resize to
|
||||
// fit.
|
||||
// TODO! Should only do this once per update.
|
||||
[self performSelectorOnMainThread:@selector(resizeWindowToFit:)
|
||||
withObject:self waitUntilDone:NO];
|
||||
//NSLog(@"Visible scroller %d was destroyed, resizing window.",
|
||||
// ident);
|
||||
shouldUpdateWindowSize = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,10 +380,9 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
|
||||
if (wasVisible != visible) {
|
||||
// A scroller was hidden or shown, so the window must resize to fit.
|
||||
//NSLog(@"%s scroller %d", visible ? "Show" : "Hide", ident);
|
||||
// TODO! Should only do this once per update.
|
||||
[self performSelectorOnMainThread:@selector(resizeWindowToFit:)
|
||||
withObject:self waitUntilDone:NO];
|
||||
//NSLog(@"%s scroller %d and resize.", visible ? "Show" : "Hide",
|
||||
// ident);
|
||||
shouldUpdateWindowSize = YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,6 +420,14 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
[self updateResizeIncrements];
|
||||
}
|
||||
|
||||
- (void)processCommandQueueDidFinish
|
||||
{
|
||||
if (shouldUpdateWindowSize) {
|
||||
shouldUpdateWindowSize = NO;
|
||||
[self resizeWindowToFit:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)addNewTab:(id)sender
|
||||
{
|
||||
// NOTE! This can get called a lot if the user holds down the key
|
||||
@@ -435,7 +442,7 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
[tabBarControl setHidden:NO];
|
||||
|
||||
if (setupDone)
|
||||
[self resizeWindowToFit:self];
|
||||
shouldUpdateWindowSize = YES;
|
||||
}
|
||||
|
||||
- (IBAction)hideTabBar:(id)sender
|
||||
@@ -444,10 +451,12 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
[tabBarControl setHidden:YES];
|
||||
|
||||
if (setupDone)
|
||||
[self resizeWindowToFit:self];
|
||||
shouldUpdateWindowSize = YES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// -- PSMTabBarControl delegate ----------------------------------------------
|
||||
|
||||
|
||||
@@ -559,6 +568,11 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// -- Services menu delegate -------------------------------------------------
|
||||
|
||||
- (id)validRequestorForSendType:(NSString *)sendType
|
||||
returnType:(NSString *)returnType
|
||||
{
|
||||
@@ -567,9 +581,11 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
id backendProxy = [vimController backendProxy];
|
||||
|
||||
if ((!sendType || [sendType isEqual:NSStringPboardType])
|
||||
&& (!returnType || [returnType isEqual:NSStringPboardType])) {
|
||||
if ((!sendType || [backendProxy starRegisterToPasteboard:nil])
|
||||
&& (!returnType || [backendProxy starRegisterFromPasteboard:nil])) {
|
||||
&& (!returnType || [returnType isEqual:NSStringPboardType]))
|
||||
{
|
||||
if ((!sendType || [backendProxy starRegisterToPasteboard:nil]) &&
|
||||
(!returnType || [backendProxy starRegisterFromPasteboard:nil]))
|
||||
{
|
||||
return self;
|
||||
}
|
||||
}
|
||||
@@ -697,6 +713,8 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
frame = [self fitWindowToFrame:maxFrame];
|
||||
}
|
||||
|
||||
//NSLog(@"%s %@", _cmd, NSStringFromRect(frame));
|
||||
|
||||
// HACK! If the window does resize, then windowDidResize is called which in
|
||||
// turn calls placeViews. In case the computed new size of the window is
|
||||
// no different from the current size, then we need to call placeViews
|
||||
|
||||
Reference in New Issue
Block a user