Skip to content

Commit

Permalink
Fix various warnings, mostly stemming from change to 10.6 sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
gnachman committed Nov 14, 2011
1 parent ff4b42a commit 8423443
Show file tree
Hide file tree
Showing 30 changed files with 179 additions and 104 deletions.
2 changes: 1 addition & 1 deletion BookmarkListView.h
Expand Up @@ -91,7 +91,7 @@
- (NSMenu*)bookmarkTable:(id)bookmarkTable menuForEvent:(NSEvent*)theEvent;
@end

@interface BookmarkListView : NSView {
@interface BookmarkListView : NSView <NSTextFieldDelegate, NSTableViewDataSource, NSTableViewDelegate> {
int normalRowHeight_;
int rowHeightWithTags_;
NSScrollView* scrollView_;
Expand Down
2 changes: 1 addition & 1 deletion BookmarksWindow.h
Expand Up @@ -25,7 +25,7 @@
#import <Cocoa/Cocoa.h>
#import "BookmarkListView.h"

@interface BookmarksWindow : NSWindowController <BookmarkTableDelegate> {
@interface BookmarksWindow : NSWindowController <BookmarkTableDelegate, NSWindowDelegate> {
IBOutlet BookmarkListView* tableView_;
IBOutlet NSSegmentedControl* actions_;
IBOutlet NSButton* horizontalPaneButton_;
Expand Down
2 changes: 1 addition & 1 deletion CGSInternal/CGSDisplays.h
Expand Up @@ -30,7 +30,7 @@ CG_EXTERN_C_BEGIN
CG_EXTERN CGDisplayErr CGSBeginDisplayConfiguration(CGDisplayConfigRef *config);

/*! Sets the origin of a display relative to the main display. The main display is at (0, 0) and contains the menubar. */
CG_EXTERN CGDisplayErr CGSConfigureDisplayOrigin(CGDisplayConfigRef config, CGDirectDisplayID display, CGDisplayCoord x, CGDisplayCoord y);
CG_EXTERN CGDisplayErr CGSConfigureDisplayOrigin(CGDisplayConfigRef config, CGDirectDisplayID display, int32_t x, int32_t y);

/*! Applies the configuration changes made in this transaction. */
CG_EXTERN CGDisplayErr CGSCompleteDisplayConfiguration(CGDisplayConfigRef config);
Expand Down
2 changes: 1 addition & 1 deletion CGSInternal/CGSInternal.h
Expand Up @@ -25,7 +25,7 @@
#include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>

#warning CGSInternal contains PRIVATE FUNCTIONS and should NOT BE USED in shipping applications!
// WARNING: CGSInternal contains PRIVATE FUNCTIONS and should NOT BE USED in shipping applications!

#ifndef MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
#define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER UNAVAILABLE_ATTRIBUTE
Expand Down
2 changes: 1 addition & 1 deletion FindViewController.h
Expand Up @@ -65,7 +65,7 @@
@end


@interface FindViewController : NSViewController {
@interface FindViewController : NSViewController <NSTextFieldDelegate> {
IBOutlet NSSearchField* findBarTextField_;
IBOutlet NSProgressIndicator* findBarProgressIndicator_;
// These pointers are just "prototypes" and do not refer to any actual menu
Expand Down
19 changes: 19 additions & 0 deletions FutureMethods.h
Expand Up @@ -7,6 +7,8 @@

#import <Cocoa/Cocoa.h>

extern const int FutureNSWindowCollectionBehaviorStationary;

@interface NSView (Future)
- (void)futureSetAcceptsTouchEvents:(BOOL)value;
- (void)futureSetWantsRestingTouches:(BOOL)value;
Expand All @@ -20,4 +22,21 @@
- (void)futureSetRestorable:(BOOL)value;
- (void)futureSetRestorationClass:(Class)class;
- (void)futureInvalidateRestorableState;
@end

enum {
FutureNSScrollerStyleLegacy = 0,
FutureNSScrollerStyleOverlay = 1
};
typedef NSInteger FutureNSScrollerStyle;

@interface NSScroller (Future)
- (FutureNSScrollerStyle)futureScrollerStyle;
@end

@interface NSScrollView (Future)
- (FutureNSScrollerStyle)futureScrollerStyle;
@end

@interface CIImage (Future)
@end
45 changes: 45 additions & 0 deletions FutureMethods.m
Expand Up @@ -8,6 +8,8 @@

#import "FutureMethods.h"

const int FutureNSWindowCollectionBehaviorStationary = (1 << 4); // value stolen from 10.6 SDK

@implementation NSWindow (Future)

- (void)futureSetRestorable:(BOOL)value
Expand Down Expand Up @@ -82,3 +84,46 @@ - (NSArray *)futureTouchesMatchingPhase:(int)phase inView:(NSView *)view
}
}
@end

static FutureNSScrollerStyle GetScrollerStyle(id theObj)
{
NSMethodSignature *sig = [[NSScroller class] instanceMethodSignatureForSelector:@selector(scrollerStyle)];
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:sig];
[inv setTarget:theObj];
[inv setSelector:@selector(scrollerStyle)];
[inv invoke];
FutureNSScrollerStyle result;
[inv getReturnValue:&result];
return result;
}

@implementation NSScroller (Future)

- (FutureNSScrollerStyle)futureScrollerStyle
{
if ([self respondsToSelector:@selector(scrollerStyle)]) {
return GetScrollerStyle(self);
} else {
return FutureNSScrollerStyleLegacy;
}
}

@end

@implementation NSScrollView (Future)

- (FutureNSScrollerStyle)futureScrollerStyle
{
if ([self respondsToSelector:@selector(scrollerStyle)]) {
return GetScrollerStyle(self);
} else {
return FutureNSScrollerStyleLegacy;
}
}

@end

@implementation CIImage (Future)


@end
2 changes: 1 addition & 1 deletion GlobalSearch.h
Expand Up @@ -48,7 +48,7 @@

@end

@interface GlobalSearch : NSViewController
@interface GlobalSearch : NSViewController <NSTextFieldDelegate, NSTableViewDataSource, NSTableViewDelegate>
{
IBOutlet iTermSearchField* searchField_;
IBOutlet NSTableView* tableView_;
Expand Down
9 changes: 8 additions & 1 deletion Headers/iTerm/PreferencePanel.h
Expand Up @@ -60,7 +60,14 @@

typedef enum { CURSOR_UNDERLINE, CURSOR_VERTICAL, CURSOR_BOX } ITermCursorType;

@interface PreferencePanel : NSWindowController <BookmarkTableDelegate, TriggerDelegate, SmartSelectionDelegate>
@interface PreferencePanel : NSWindowController <
BookmarkTableDelegate,
TriggerDelegate,
SmartSelectionDelegate,
NSTokenFieldDelegate,
NSWindowDelegate,
NSTextFieldDelegate,
NSMenuDelegate>
{
BookmarkModel* dataSource;
BOOL oneBookmarkMode;
Expand Down
2 changes: 1 addition & 1 deletion ITAddressBookMgr.h
Expand Up @@ -175,7 +175,7 @@ typedef enum {
iTermPaneObject,
} iTermObjectType;

@interface ITAddressBookMgr : NSObject
@interface ITAddressBookMgr : NSObject <NSNetServiceBrowserDelegate, NSNetServiceDelegate>
{
NSNetServiceBrowser *sshBonjourBrowser;
NSNetServiceBrowser *ftpBonjourBrowser;
Expand Down
2 changes: 1 addition & 1 deletion ITAddressBookMgr.m
Expand Up @@ -271,7 +271,7 @@ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindServi
// resolving works.
[bonjourServices addObject:aNetService];
[aNetService setDelegate:self];
[aNetService resolve];
[aNetService resolveWithTimeout:5];
}


Expand Down
2 changes: 1 addition & 1 deletion LineBuffer.h
Expand Up @@ -147,7 +147,7 @@ typedef struct FindContext {

// Drop lines from the start of the buffer. Returns the number of lines actually dropped
// (either n or the number of lines in the block).
- (int) dropLines: (int) n withWidth: (int) width;
- (int) dropLines:(int)n withWidth:(int)width chars:(int *)charsDropped;

// Returns true if there are no lines in the block
- (BOOL) isEmpty;
Expand Down
19 changes: 9 additions & 10 deletions NSImage+CoreImage.m
Expand Up @@ -4,6 +4,7 @@
// iTerm2

#import "NSImage+CoreImage.h"
#import "NSBitmapImageRep+CoreImage.h"

@implementation NSImage (CoreImage)
- (void)drawAtPoint: (NSPoint)point fromRect: (NSRect)fromRect coreImageFilter: (NSString *)filterName arguments: (NSDictionary *)arguments {
Expand All @@ -14,18 +15,16 @@ - (void)drawAtPoint: (NSPoint)point fromRect: (NSRect)fromRect coreImageFilter:

if (filterName) {
rep = [self bitmapImageRepresentation];
[rep
drawAtPoint: point
fromRect: fromRect
coreImageFilter: filterName
arguments: arguments];
[rep drawAtPoint:point
fromRect:fromRect
coreImageFilter:filterName
arguments:arguments];
} else {
/* bypass core image if no filter is specified */
[self
drawAtPoint: point
fromRect: fromRect
operation: NSCompositeSourceOver
fraction: 1.0f];
[self drawAtPoint:point
fromRect:fromRect
operation:NSCompositeSourceOver
fraction:1.0f];
}

[pool release];
Expand Down
2 changes: 1 addition & 1 deletion PTToolbarController.h
Expand Up @@ -35,7 +35,7 @@ extern NSString *CommandToolbarItem;

@class PseudoTerminal;

@interface PTToolbarController : NSObject
@interface PTToolbarController : NSObject <NSToolbarDelegate>
{
NSToolbar* _toolbar;
PseudoTerminal* _pseudoTerminal;
Expand Down
13 changes: 3 additions & 10 deletions PTYScrollView.m
Expand Up @@ -33,6 +33,7 @@

#import "iTerm.h"
#import <iTerm/PTYScrollView.h>
#import "FutureMethods.h"
#import <iTerm/PTYTextView.h>
#import <PreferencePanel.h>
#include "NSImage+CoreImage.h"
Expand Down Expand Up @@ -109,11 +110,7 @@ - (NSScrollerPart)hitPart

- (BOOL)isLegacyScroller
{
if ([self respondsToSelector:@selector(scrollerStyle)]) {
return (int)[self scrollerStyle] == NSScrollerStyleLegacy;
} else {
return YES;
}
return [(NSScroller*)self futureScrollerStyle] == FutureNSScrollerStyleLegacy;
}

- (void)drawRect:(NSRect)dirtyRect {
Expand Down Expand Up @@ -277,11 +274,7 @@ - (void)reallyShowScroller

- (BOOL)isLegacyScroller
{
if ([self respondsToSelector:@selector(scrollerStyle)]) {
return [self scrollerStyle] == NSScrollerStyleLegacy;
} else {
return YES;
}
return [(NSScrollView*)self futureScrollerStyle] == FutureNSScrollerStyleLegacy;
}

- (void)setHasVerticalScroller:(BOOL)flag
Expand Down
2 changes: 1 addition & 1 deletion PTYTab.h
Expand Up @@ -41,7 +41,7 @@ static const int MIN_SESSION_COLUMNS = 2;

// This implements NSSplitViewDelegate but it was an informal protocol in 10.5. If 10.5 support
// is eventually dropped, change this to make it official.
@interface PTYTab : NSObject {
@interface PTYTab : NSObject <NSSplitViewDelegate> {
PTYSession* activeSession_;

// Owning tab view item
Expand Down
5 changes: 3 additions & 2 deletions PTYTab.m
Expand Up @@ -863,7 +863,7 @@ - (void)_dumpView:(id)view withPrefix:(NSString*)prefix
if ([view isKindOfClass:[SessionView class]]) {
SessionView* sv = (SessionView*)view;
NSSize size = [sv frame].size;
PtyLog([NSString stringWithFormat:@"%@%lfx%lf", prefix, size.width, size.height]);
PtyLog(@"%@%lfx%lf", prefix, size.width, size.height);
} else {
NSSplitView* sv = (NSSplitView*)view;
for (id v in [sv subviews]) {
Expand Down Expand Up @@ -1548,7 +1548,8 @@ - (NSImage*)image:(BOOL)withSpaceForFrame
[transform scaleXBy:1.0 yBy:-1.0];
[transform concat];
tabFrame.origin.y = -tabFrame.origin.y - tabFrame.size.height;
[(id <PSMTabStyle>)[[[realParentWindow_ tabView] delegate] style] drawBackgroundInRect:tabFrame color:nil]; // TODO: use the right color
PSMTabBarControl *control = (PSMTabBarControl *)[[realParentWindow_ tabView] delegate];
[(id <PSMTabStyle>)[control style] drawBackgroundInRect:tabFrame color:nil]; // TODO: use the right color
[transform invert];
[transform concat];
}
Expand Down
6 changes: 2 additions & 4 deletions PTYTextView.m
Expand Up @@ -2900,8 +2900,6 @@ - (BOOL)mouseDownImpl:(NSEvent*)event
}

DebugLog([NSString stringWithFormat:@"Mouse down. startx=%d starty=%d, endx=%d, endy=%d", startX, startY, endX, endY]);
if([_delegate respondsToSelector: @selector(willHandleEvent:)] && [_delegate willHandleEvent: event])
[_delegate handleEvent:event];
[[[self dataSource] session] refreshAndStartTimerIfNeeded];

return NO;
Expand Down Expand Up @@ -3922,8 +3920,8 @@ - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
for (i = 0; i < (int)[propertyList count]; i++) {
// Ignore text clippings
NSString *filename = (NSString*)[propertyList objectAtIndex:i]; // this contains the POSIX path to a file
NSDictionary *filenamesAttributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename
traverseLink:YES];
NSDictionary *filenamesAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filename
error:nil];
if (([filenamesAttributes fileHFSTypeCode] == 'clpt' &&
[filenamesAttributes fileHFSCreatorCode] == 'MACS') ||
[[filename pathExtension] isEqualToString:@"textClipping"] == YES) {
Expand Down
6 changes: 4 additions & 2 deletions PTYWindow.m
Expand Up @@ -288,9 +288,11 @@ - (void)setLayoutDone

- (void)makeKeyAndOrderFront:(id)sender
{
if(!layoutDone) {
if (!layoutDone) {
layoutDone = YES;
[[self delegate] windowWillShowInitial];
if ([[self delegate] respondsToSelector:@selector(windowWillShowInitial)]) {
[[self delegate] performSelector:@selector(windowWillShowInitial)];
}
}
PtyLog(@"PTYWindow - calling makeKeyAndOrderFont, which triggers a window resize");
PtyLog(@"The current window frame is %fx%f", [self frame].size.width, [self frame].size.height);
Expand Down
2 changes: 1 addition & 1 deletion PreferencePanel.m
Expand Up @@ -125,7 +125,7 @@ + (BOOL)migratePreferences
}

NSLog(@"Preference file migrated");
[mgr copyPath:source toPath:newPrefs handler:nil];
[mgr copyItemAtPath:source toPath:newPrefs error:nil];
[NSUserDefaults resetStandardUserDefaults];
return (YES);
}
Expand Down

0 comments on commit 8423443

Please sign in to comment.