Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
gnachman committed Aug 6, 2013
2 parents 38d1016 + e0fd484 commit 988a8c1
Show file tree
Hide file tree
Showing 232 changed files with 621 additions and 1,974 deletions.
51 changes: 45 additions & 6 deletions ITAddressBookMgr.m
Expand Up @@ -266,22 +266,31 @@ - (ProfileModel*)model
return [ProfileModel sharedInstance];
}

- (BOOL)verbose {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"iTermDebugBonjour"];
}

// NSNetServiceBrowser delegate methods
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing
{
if ([self verbose]) {
NSLog(@"netServiceBrowser:%@ didFindService:%@ moreComing:%d", aNetServiceBrowser, aNetService, (int)moreComing);
}
// resolve the service and add to temporary array to retain it so that
// resolving works.
[bonjourServices addObject:aNetService];
[aNetService setDelegate:self];
[aNetService resolveWithTimeout:5];
}


- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveService:(NSNetService *)aNetService moreComing:(BOOL)moreComing
{
if (aNetService == nil) {
return;
}
if ([self verbose]) {
NSLog(@"netServiceBrowser:%@ didRemoveService:%@ moreComing:%d", aNetServiceBrowser, aNetService, (int)moreComing);
}

// remove host entry from this group
NSMutableArray* toRemove = [[[NSMutableArray alloc] init] autorelease];
Expand All @@ -297,6 +306,9 @@ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveSer
|| [bookmarkName isEqualToString:sftpName]
#endif
) {
if ([self verbose]) {
NSLog(@"remove profile with name %@", bookmarkName);
}
[toRemove addObject:[NSNumber numberWithInt:i]];
}
}
Expand Down Expand Up @@ -386,28 +398,43 @@ - (void)netServiceDidResolveAddress:(NSNetService *)sender
// cancel the resolution
[sender stop];

if ([self verbose]) {
NSLog(@"netServiceDidResolveAddress:%@", sender);
}
if ([bonjourServices containsObject: sender] == NO) {
if ([self verbose]) {
NSLog(@"netServiceDidResolveAddress sender not in services @", bonjourServices);
}
return;
}

// grab the address
if ([[sender addresses] count] == 0) {
if ([self verbose]) {
NSLog(@"netServiceDidResolveAddress sender has no addresses");
}
return;
}
NSString* serviceType = [self getBonjourServiceType:[sender type]];
NSString* serviceName = [sender name];
NSData* address = [[sender addresses] objectAtIndex: 0];
if ([self verbose]) {
NSLog(@"netServiceDidResolveAddress type=%@ name=%@ address=%@", serviceType, serviceName, address);
}
struct sockaddr_in *socketAddress = (struct sockaddr_in *)[address bytes];
char buffer[INET6_ADDRSTRLEN + 1];

const char* strAddr = inet_ntop(socketAddress->sin_family, &socketAddress->sin_addr,
buffer, [address length]);
if (strAddr) {
[self _addBonjourHostProfileWithName:serviceName
ipAddressString:[NSString stringWithFormat:@"%s", strAddr]
port:htons(socketAddress->sin_port)
serviceType:serviceType];

if ([self verbose]) {
NSLog(@"netServiceDidResolveAddress add profile with address %s", strAddr);
}
[self _addBonjourHostProfileWithName:serviceName
ipAddressString:[NSString stringWithFormat:@"%s", strAddr]
port:htons(socketAddress->sin_port)
serviceType:serviceType];

// remove from array now that resolving is done
if ([bonjourServices containsObject:sender]) {
[bonjourServices removeObject:sender];
Expand All @@ -433,14 +460,26 @@ - (void)netServiceDidStop:(NSNetService *)aNetService

- (NSString*)getBonjourServiceType:(NSString*)aType
{
if ([self verbose]) {
NSLog(@"getBonjourServiceType:%@", aType);
}
NSString *serviceType = aType;
if ([aType length] <= 0) {
if ([self verbose]) {
NSLog(@"netServiceDidResolveAddress empty type");
}
return nil;
}
NSRange aRange = [serviceType rangeOfString: @"."];
if(aRange.location != NSNotFound) {
if ([self verbose]) {
NSLog(@"netServiceDidResolveAddress return value prior to first .");
}
return [serviceType substringWithRange: NSMakeRange(1, aRange.location - 1)];
} else {
if ([self verbose]) {
NSLog(@"netServiceDidResolveAddress no . found, return whole value");
}
return serviceType;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -40,7 +40,9 @@ Deployment:
chmod -R go+rX build/Deployment

Nightly: force
cp nightly-iTerm.plist iTerm.plist
xcodebuild -parallelizeTargets -alltargets -configuration Nightly && \
git checkout -- iTerm.plist
chmod -R go+rX build/Nightly

run: Development
Expand Down
25 changes: 25 additions & 0 deletions MovingAverage.h
@@ -0,0 +1,25 @@
//
// MovingAverage.h
// iTerm
//
// Created by George Nachman on 7/28/13.
//
//

#import <Foundation/Foundation.h>

@interface MovingAverage : NSObject {
double _alpha;
double _value;
NSTimeInterval _time;
}

@property (nonatomic, assign) double alpha; // Initialized to 0.5.
@property (nonatomic, assign) double value;

- (void)startTimer;
- (NSTimeInterval)timeSinceTimerStarted;
- (void)addValue:(double)value;
- (BOOL)haveStartedTimer;

@end
40 changes: 40 additions & 0 deletions MovingAverage.m
@@ -0,0 +1,40 @@
//
// MovingAverage.m
// iTerm
//
// Created by George Nachman on 7/28/13.
//
//

#import "MovingAverage.h"

@implementation MovingAverage

@synthesize alpha = _alpha;
@synthesize value = _value;

- (id)init {
self = [super init];
if (self) {
_alpha = 0.5;
}
return self;
}

- (void)startTimer {
_time = [NSDate timeIntervalSinceReferenceDate];
}

- (NSTimeInterval)timeSinceTimerStarted {
return [NSDate timeIntervalSinceReferenceDate] - _time;
}

- (void)addValue:(double)value {
_value = _alpha * _value + (1.0 - _alpha) * value;
}

- (BOOL)haveStartedTimer {
return _time > 0;
}

@end
2 changes: 1 addition & 1 deletion PTYSession.m
Expand Up @@ -1977,7 +1977,7 @@ + (NSString*)pasteboardString
[escapedFilenames addObject:[filename stringWithEscapedShellCharacters]];
}
if (escapedFilenames.count > 0) {
info = [escapedFilenames componentsJoinedByString:@"\n"];
info = [escapedFilenames componentsJoinedByString:@" "];
}
if ([info length] == 0) {
info = nil;
Expand Down
3 changes: 3 additions & 0 deletions PTYTextView.h
Expand Up @@ -44,6 +44,7 @@

@class VT100Screen;
@class ThreeFingerTapGestureRecognizer;
@class MovingAverage;

// Amount of time to highlight the cursor after beginFindCursor:YES
static const double kFindCursorHoldTime = 1;
Expand Down Expand Up @@ -332,6 +333,8 @@ enum {
// calls to -updateDirtyRects without making any changes, we only redraw the old and new cursor
// positions.
int prevCursorX, prevCursorY;

MovingAverage *drawRectDuration_, *drawRectInterval_;
}

+ (NSCursor *)textViewCursor;
Expand Down
35 changes: 21 additions & 14 deletions PTYTextView.m
Expand Up @@ -70,6 +70,7 @@
#import "CharacterRun.h"
#import "ThreeFingerTapGestureRecognizer.h"
#import "FutureMethods.h"
#import "MovingAverage.h"

#include <sys/time.h>
#include <math.h>
Expand All @@ -90,9 +91,6 @@
// B/W text mode is triggered. 0 means always trigger, 1 means never trigger.
static double gSmartCursorFgThreshold = 0.75;

// If set log info about drawing speed to console
static int gLogDrawingPerformance;

@implementation FindCursorView

@synthesize cursor;
Expand Down Expand Up @@ -196,8 +194,6 @@ @implementation PTYTextView

+ (void)initialize
{
gLogDrawingPerformance = [[NSUserDefaults standardUserDefaults] boolForKey:@"LogDrawingPerformance"];

NSPoint hotspot = NSMakePoint(4, 5);

NSBundle* bundle = [NSBundle bundleForClass:[self class]];
Expand Down Expand Up @@ -340,6 +336,11 @@ - (id)initWithFrame:(NSRect)aRect
} else {
DLog(@"Not tracking touches in view %@", self);
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LogDrawingPerformance"]) {
NSLog(@"** Drawing performance timing enabled **");
drawRectDuration_ = [[MovingAverage alloc] init];
drawRectInterval_ = [[MovingAverage alloc] init];
}

return self;
}
Expand Down Expand Up @@ -445,6 +446,9 @@ - (void)updateTrackingAreas

- (void)dealloc
{
[drawRectDuration_ release];
[drawRectInterval_ release];

[smartSelectionRules_ release];
int i;

Expand Down Expand Up @@ -1846,22 +1850,25 @@ - (void)drawRect:(NSRect)rect
// bounding rect that contains them all. Luckily, we can get the list of the "real" dirty rects
// and they're guaranteed to be disjoint. So draw each of them individually.
static NSTimeInterval lastTime;
NSTimeInterval startTime;
if (gLogDrawingPerformance) {
startTime = [NSDate timeIntervalSinceReferenceDate];
}
const NSRect *rectArray;
NSInteger rectCount;
if (drawRectDuration_) {
[drawRectDuration_ startTimer];
NSTimeInterval interval = [drawRectInterval_ timeSinceTimerStarted];
if ([drawRectInterval_ haveStartedTimer]) {
[drawRectInterval_ addValue:interval];
}
[drawRectInterval_ startTimer];
}
[self getRectsBeingDrawn:&rectArray count:&rectCount];
for (int i = 0; i < rectCount; i++) {
[self drawRect:rectArray[i] to:nil];
}
if (gLogDrawingPerformance) {
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
NSLog(@"Elapsed drawing time=%lf, time between calls=%lf", now - startTime, startTime - lastTime);
lastTime = startTime;
if (drawRectDuration_) {
[drawRectDuration_ addValue:[drawRectDuration_ timeSinceTimerStarted]];
NSLog(@"%p Moving average time draw rect is %04f, time between calls to drawRect is %04f",
self, drawRectDuration_.value, drawRectInterval_.value);
}

const NSRect frame = [self visibleRect];
double x = frame.origin.x + frame.size.width;
if ([[[[dataSource session] tab] realParentWindow] broadcastInputToSession:[dataSource session]]) {
Expand Down
17 changes: 12 additions & 5 deletions PreferencePanel.m
Expand Up @@ -48,6 +48,7 @@
NSString* kDeleteKeyString = @"0x7f-0x0";

static float versionNumber;
static NSString * const kRebuildColorPresetsMenuNotification = @"kRebuildColorPresetsMenuNotification";

@interface NSFileManager (TemporaryDirectory)

Expand Down Expand Up @@ -184,6 +185,10 @@ - (id)initWithDataSource:(ProfileModel*)model userDefaults:(NSUserDefaults*)user
selector:@selector(keyBindingsChanged)
name:@"iTermKeyBindingsChanged"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(rebuildColorPresetsMenu)
name:kRebuildColorPresetsMenuNotification
object:nil];
return (self);
}

Expand Down Expand Up @@ -258,7 +263,7 @@ - (void)_addColorPresetsInDict:(NSDictionary*)presetsDict toMenu:(NSMenu*)theMen
}
}

- (void)_rebuildColorPresetsMenu
- (void)rebuildColorPresetsMenu
{
while ([presetsMenu numberOfItems] > 1) {
[presetsMenu removeItemAtIndex:1];
Expand Down Expand Up @@ -305,7 +310,8 @@ - (void)_addColorPreset:(NSString*)presetName withColors:(NSDictionary*)theDict
[customPresets setObject:theDict forKey:temp];
[[NSUserDefaults standardUserDefaults] setObject:customPresets forKey:CUSTOM_COLOR_PRESETS];

[self _rebuildColorPresetsMenu];
[[NSNotificationCenter defaultCenter] postNotificationName:kRebuildColorPresetsMenuNotification
object:nil];
}

- (NSString*)_presetNameFromFilename:(NSString*)filename
Expand Down Expand Up @@ -473,7 +479,8 @@ - (void)deleteColorPreset:(id)sender
[newCustom removeObjectForKey:[[pub selectedItem] title]];
[[NSUserDefaults standardUserDefaults] setObject:newCustom
forKey:CUSTOM_COLOR_PRESETS];
[self _rebuildColorPresetsMenu];
[[NSNotificationCenter defaultCenter] postNotificationName:kRebuildColorPresetsMenuNotification
object:nil];
}
}

Expand Down Expand Up @@ -575,7 +582,7 @@ - (void)awakeFromNib
keyboardToolbarId = [keyboardToolbarItem itemIdentifier];
arrangementsToolbarId = [arrangementsToolbarItem itemIdentifier];
mouseToolbarId = [mouseToolbarItem itemIdentifier];

[globalToolbarItem setEnabled:YES];
[toolbar setSelectedItemIdentifier:globalToolbarId];

Expand All @@ -598,7 +605,7 @@ - (void)awakeFromNib
[copyTo allowMultipleSelections];

// Add presets to preset color selection.
[self _rebuildColorPresetsMenu];
[self rebuildColorPresetsMenu];

// Add preset keybindings to button-popup-list.
NSArray* presetArray = [iTermKeyBindingMgr presetKeyMappingsNames];
Expand Down
4 changes: 2 additions & 2 deletions PseudoTerminal.m
Expand Up @@ -4272,8 +4272,8 @@ - (void)toggleBroadcastingInputToSession:(PTYSession *)session
} else if ([broadcastViewIds_ count] == 1) {
// Turned on one session so add the current session.
[broadcastViewIds_ addObject:[NSNumber numberWithInt:[[[self currentSession] view] viewId]]];
// NOTE: There may still be only one session. This is of use to focus
// follows mouse users who want to toggle particular panes.
// NOTE: There may still be only one session. This is of use to focus
// follows mouse users who want to toggle particular panes.
}
for (PTYTab *aTab in [self tabs]) {
for (PTYSession *aSession in [aTab sessions]) {
Expand Down
7 changes: 5 additions & 2 deletions Sparkle.framework/Versions/A/Headers/SUAppcast.h
Expand Up @@ -10,11 +10,14 @@
#define SUAPPCAST_H

@class SUAppcastItem;
@interface SUAppcast : NSObject {
@interface SUAppcast : NSObject
{
@private
NSArray *items;
NSString *userAgentString;
id delegate;
NSMutableData *incrementalData;
NSString *downloadFilename;
NSURLDownload *download;
}

- (void)fetchAppcastFromURL:(NSURL *)url;
Expand Down

0 comments on commit 988a8c1

Please sign in to comment.