Skip to content
Browse files

Merge branch 'master' of github.com:gnachman/iTerm2

  • Loading branch information...
2 parents 64407cc + afa3e88 commit 2f2480ac741333208c398481b3013d01f86f9129 @gnachman gnachman committed Mar 4, 2012
Showing with 89 additions and 4 deletions.
  1. +14 −0 BackgroundThread.h
  2. +52 −0 BackgroundThread.m
  3. +8 −0 LineBuffer.m
  4. +5 −3 PTYTab.m
  5. +1 −0 PseudoTerminal.m
  6. +1 −1 SessionTitleView.m
  7. +8 −0 iTerm.xcodeproj/project.pbxproj
View
14 BackgroundThread.h
@@ -0,0 +1,14 @@
+//
+// BackgroundThread.h
+// iTerm
+//
+// Created by George Nachman on 3/1/12.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface BackgroundThread : NSThread
+
++ (NSThread *)backgroundThread;
+
+@end
View
52 BackgroundThread.m
@@ -0,0 +1,52 @@
+//
+// BackgroundThread.m
+// iTerm
+//
+// Created by George Nachman on 3/1/12.
+//
+
+#import "BackgroundThread.h"
+
+@implementation BackgroundThread
+
++ (NSThread *)backgroundThread
+{
+ static NSThread *thread;
+ if (!thread) {
+ thread = [[BackgroundThread alloc] init];
+ [thread start];
+ }
+ return thread;
+}
+
+- (void)scheduleTimer
+{
+ NSRunLoop* myRunLoop = [NSRunLoop currentRunLoop]; //[[NSRunLoop alloc] init];
+
+ [myRunLoop addTimer:[NSTimer timerWithTimeInterval:60
+ target:self
+ selector:@selector(scheduleTimer)
+ userInfo:nil
+ repeats:YES]
+ forMode:NSDefaultRunLoopMode];
+}
+
+- (void)main
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSRunLoop* myRunLoop = [NSRunLoop currentRunLoop]; //[[NSRunLoop alloc] init];
+ // The timer keeps the runloop from returning immediately.
+ [self scheduleTimer];
+ while (1) {
+ if (!pool) {
+ pool = [[NSAutoreleasePool alloc] init];
+ }
+
+ [myRunLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
+
+ [pool drain];
+ pool = nil;
+ }
+}
+
+@end
View
8 LineBuffer.m
@@ -29,6 +29,7 @@
#import <LineBuffer.h>
#import "RegexKitLite/RegexKitLite.h"
+#import "BackgroundThread.h"
@implementation ResultRange
@end
@@ -941,6 +942,13 @@ - (LineBuffer*) initWithBlockSize: (int) bs
- (void)dealloc
{
+ // This causes the blocks to be released in a background thread.
+ // When a LineBuffer is really gigantic, it can take
+ // quite a bit of time to release all the blocks.
+ [blocks performSelector:@selector(removeAllObjects)
+ onThread:[BackgroundThread backgroundThread]
+ withObject:nil
+ waitUntilDone:NO];
[blocks release];
[super dealloc];
}
View
8 PTYTab.m
@@ -1811,20 +1811,22 @@ - (NSSize)_minSizeOfView:(NSView*)view
}
}
-// Blur the window if most sessions are blurred.
+// Blur the window if any session is blurred.
- (bool)blur
{
int n = 0;
int y = 0;
NSArray* sessions = [self sessions];
for (PTYSession* session in sessions) {
- if ([[[session addressBookEntry] objectForKey:KEY_BLUR] boolValue]) {
+ if ([session transparency] > 0 &&
+ [[session TEXTVIEW] useTransparency] &&
+ [[[session addressBookEntry] objectForKey:KEY_BLUR] boolValue]) {
++y;
} else {
++n;
}
}
- return y > n;
+ return y > 0;
}
- (double)blurRadius
View
1 PseudoTerminal.m
@@ -2055,6 +2055,7 @@ - (IBAction)toggleUseTransparency:(id)sender
[[aSession view] setNeedsDisplay:YES];
}
restoreUseTransparency_ = NO;
+ [[self currentTab] recheckBlur];
}
- (BOOL)useTransparency
View
2 SessionTitleView.m
@@ -53,7 +53,7 @@ - (id)initWithFrame:(NSRect)frame {
[menuButton_ addItemWithTitle:@"Foo"];
menuButton_.frame = NSMakeRect(frame.size.width - menuButton_.frame.size.width - kMargin,
- (frame.size.height - menuButton_.frame.size.height) / 2,
+ (frame.size.height - menuButton_.frame.size.height) / 2 + 1,
menuButton_.frame.size.width,
menuButton_.frame.size.height);
[menuButton_ setAutoresizingMask:NSViewMinXMargin];
View
8 iTerm.xcodeproj/project.pbxproj
@@ -283,6 +283,8 @@
1DA02CFB1327612600D7E7DB /* bell.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DA02CFA1327612600D7E7DB /* bell.png */; };
1DA030F91328BD7C00D7E7DB /* wrap_to_bottom.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DA030F71328BD7C00D7E7DB /* wrap_to_bottom.png */; };
1DA030FA1328BD7C00D7E7DB /* wrap_to_top.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DA030F81328BD7C00D7E7DB /* wrap_to_top.png */; };
+ 1DA26AC015007507004B5792 /* BackgroundThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DA26ABE15007507004B5792 /* BackgroundThread.h */; };
+ 1DA26AC115007507004B5792 /* BackgroundThread.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DA26ABF15007507004B5792 /* BackgroundThread.m */; };
1DA7894814AC19F500C8FBD9 /* Growl in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DA7894714AC19F500C8FBD9 /* Growl */; };
1DA8117E13CEA30A00CCA89A /* FontSizeEstimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DA8117C13CEA30A00CCA89A /* FontSizeEstimator.h */; };
1DA8117F13CEA30A00CCA89A /* FontSizeEstimator.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DA8117D13CEA30A00CCA89A /* FontSizeEstimator.m */; };
@@ -552,6 +554,8 @@
1DA02CFA1327612600D7E7DB /* bell.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = bell.png; path = images/bell.png; sourceTree = "<group>"; };
1DA030F71328BD7C00D7E7DB /* wrap_to_bottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = wrap_to_bottom.png; path = images/wrap_to_bottom.png; sourceTree = "<group>"; };
1DA030F81328BD7C00D7E7DB /* wrap_to_top.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = wrap_to_top.png; path = images/wrap_to_top.png; sourceTree = "<group>"; };
+ 1DA26ABE15007507004B5792 /* BackgroundThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackgroundThread.h; sourceTree = "<group>"; };
+ 1DA26ABF15007507004B5792 /* BackgroundThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BackgroundThread.m; sourceTree = "<group>"; };
1DA7894714AC19F500C8FBD9 /* Growl */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = Growl; path = Growl.framework/Growl; sourceTree = "<absolute>"; };
1DA8117C13CEA30A00CCA89A /* FontSizeEstimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSizeEstimator.h; sourceTree = "<group>"; };
1DA8117D13CEA30A00CCA89A /* FontSizeEstimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FontSizeEstimator.m; sourceTree = "<group>"; };
@@ -821,6 +825,8 @@
1D9DDE2F142E735900275650 /* DVR */,
1D9DDE2E142E733100275650 /* Toolbelt */,
1D9DDE2D142E730700275650 /* Triggers */,
+ 1DA26ABE15007507004B5792 /* BackgroundThread.h */,
+ 1DA26ABF15007507004B5792 /* BackgroundThread.m */,
1D9DDD9B142E5FBB00275650 /* Coprocess.m */,
1D237D27131D8741004DD60C /* FindView.m */,
1D237D93131D8D66004DD60C /* FindViewController.m */,
@@ -1522,6 +1528,7 @@
1D06E7D714BC04E20097C0ED /* ProfileModelWrapper.h in Headers */,
1D06E7DB14BC05DB0097C0ED /* ProfileTableView.h in Headers */,
A073973E14C768E400786414 /* ColorsMenuItemView.h in Headers */,
+ 1DA26AC015007507004B5792 /* BackgroundThread.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1820,6 +1827,7 @@
1D06E7D814BC04E20097C0ED /* ProfileModelWrapper.m in Sources */,
1D06E7DC14BC05DB0097C0ED /* ProfileTableView.m in Sources */,
A073974014C7694600786414 /* ColorsMenuItemView.m in Sources */,
+ 1DA26AC115007507004B5792 /* BackgroundThread.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

0 comments on commit 2f2480a

Please sign in to comment.
Something went wrong with that request. Please try again.