Skip to content

Commit 6a534f5

Browse files
committed
Fix building with Xcode 11
Two changes: 1. Switch PSMTabBarCell from accessing NSCell's _controlView ivar, which is gone, to accessing its controlView property. Also override the controlView property to be a PSMTabBarControl instead of an NSView. 2. Move macvim-askpass from MacOS to Resources to not confuse codesign. Fixes #936.
1 parent 8eea335 commit 6a534f5

4 files changed

Lines changed: 22 additions & 32 deletions

File tree

src/MacVim/MacVim.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
isa = PBXCopyFilesBuildPhase;
158158
buildActionMask = 2147483647;
159159
dstPath = "";
160-
dstSubfolderSpec = 6;
160+
dstSubfolderSpec = 7;
161161
files = (
162162
528DA66A1426D4F9003380F1 /* macvim-askpass in Copy Scripts */,
163163
);

src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
NSString *_toolTip;
3535
}
3636

37+
@property(assign) PSMTabBarControl* controlView;
38+
3739
// creation/destruction
3840
- (id)initWithControlView:(PSMTabBarControl *)controlView;
3941
- (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:(PSMTabBarControl *)controlView;
4042
- (void)dealloc;
4143

4244
// accessors
43-
- (id)controlView;
44-
- (void)setControlView:(id)view;
4545
- (NSTrackingRectTag)closeButtonTrackingTag;
4646
- (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag;
4747
- (NSTrackingRectTag)cellTrackingTag;

src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414

1515

1616
@implementation PSMTabBarCell
17+
@dynamic controlView;
1718

1819
#pragma mark -
1920
#pragma mark Creation/Destruction
2021
- (id)initWithControlView:(PSMTabBarControl *)controlView
2122
{
2223
self = [super init];
2324
if(self){
24-
_controlView = controlView;
25+
self.controlView = controlView;
2526
_closeButtonTrackingTag = 0;
2627
_cellTrackingTag = 0;
2728
_closeButtonOver = NO;
@@ -41,7 +42,7 @@ - (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:
4142
{
4243
self = [super init];
4344
if(self){
44-
_controlView = controlView;
45+
self.controlView = controlView;
4546
_isPlaceholder = YES;
4647
if(!value)
4748
frame.size.width = 0.0;
@@ -76,17 +77,6 @@ - (void)dealloc
7677
#pragma mark -
7778
#pragma mark Accessors
7879

79-
- (id)controlView
80-
{
81-
return _controlView;
82-
}
83-
84-
- (void)setControlView:(id)view
85-
{
86-
// no retain release pattern, as this simply switches a tab to another view.
87-
_controlView = view;
88-
}
89-
9080
- (NSTrackingRectTag)closeButtonTrackingTag
9181
{
9282
return _closeButtonTrackingTag;
@@ -127,7 +117,7 @@ - (void)setStringValue:(NSString *)aString
127117
[super setStringValue:aString];
128118
_stringSize = [[self attributedStringValue] size];
129119
// need to redisplay now - binding observation was too quick.
130-
[_controlView update];
120+
[self.controlView update];
131121
}
132122

133123
- (NSSize)stringSize
@@ -137,7 +127,7 @@ - (NSSize)stringSize
137127

138128
- (NSAttributedString *)attributedStringValue
139129
{
140-
return [[_controlView psmTabStyle] attributedStringValueForTabCell:self];
130+
return [[self.controlView psmTabStyle] attributedStringValueForTabCell:self];
141131
}
142132

143133
- (int)tabState
@@ -213,7 +203,7 @@ - (BOOL)hasIcon
213203
- (void)setHasIcon:(BOOL)value
214204
{
215205
_hasIcon = value;
216-
[_controlView update]; // binding notice is too fast
206+
[self.controlView update]; // binding notice is too fast
217207
}
218208

219209
- (int)count
@@ -224,7 +214,7 @@ - (int)count
224214
- (void)setCount:(int)value
225215
{
226216
_count = value;
227-
[_controlView update]; // binding notice is too fast
217+
[self.controlView update]; // binding notice is too fast
228218
}
229219

230220
- (BOOL)isPlaceholder
@@ -271,22 +261,22 @@ - (void)setToolTip:(NSString *)tip
271261

272262
- (NSRect)indicatorRectForFrame:(NSRect)cellFrame
273263
{
274-
return [[_controlView psmTabStyle] indicatorRectForTabCell:self];
264+
return [[self.controlView psmTabStyle] indicatorRectForTabCell:self];
275265
}
276266

277267
- (NSRect)closeButtonRectForFrame:(NSRect)cellFrame
278268
{
279-
return [[_controlView psmTabStyle] closeButtonRectForTabCell:self];
269+
return [[self.controlView psmTabStyle] closeButtonRectForTabCell:self];
280270
}
281271

282272
- (float)minimumWidthOfCell
283273
{
284-
return [[_controlView psmTabStyle] minimumWidthOfTabCell:self];
274+
return [[self.controlView psmTabStyle] minimumWidthOfTabCell:self];
285275
}
286276

287277
- (float)desiredWidthOfCell
288278
{
289-
return [[_controlView psmTabStyle] desiredWidthOfTabCell:self];
279+
return [[self.controlView psmTabStyle] desiredWidthOfTabCell:self];
290280
}
291281

292282
#pragma mark -
@@ -300,7 +290,7 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
300290
return;
301291
}
302292

303-
[[_controlView psmTabStyle] drawTabCell:self];
293+
[[self.controlView psmTabStyle] drawTabCell:self];
304294
}
305295

306296
#pragma mark -
@@ -315,7 +305,7 @@ - (void)mouseEntered:(NSEvent *)theEvent
315305
if([theEvent trackingNumber] == _cellTrackingTag){
316306
[self setHighlighted:YES];
317307
}
318-
[_controlView setNeedsDisplay];
308+
[self.controlView setNeedsDisplay];
319309
}
320310

321311
- (void)mouseExited:(NSEvent *)theEvent
@@ -327,22 +317,22 @@ - (void)mouseExited:(NSEvent *)theEvent
327317
if([theEvent trackingNumber] == _cellTrackingTag){
328318
[self setHighlighted:NO];
329319
}
330-
[_controlView setNeedsDisplay];
320+
[self.controlView setNeedsDisplay];
331321
}
332322

333323
#pragma mark -
334324
#pragma mark Drag Support
335325

336326
- (NSImage*)dragImageForRect:(NSRect)cellFrame
337327
{
338-
if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"]))
328+
if(([self state] == NSOnState) && ([[self.controlView styleName] isEqualToString:@"Metal"]))
339329
cellFrame.size.width += 1.0;
340-
[_controlView lockFocus];
330+
[self.controlView lockFocus];
341331

342332
NSBitmapImageRep *rep = [[self controlView] bitmapImageRepForCachingDisplayInRect:cellFrame];
343333
[[self controlView] cacheDisplayInRect:cellFrame toBitmapImageRep:rep];
344334

345-
[_controlView unlockFocus];
335+
[self.controlView unlockFocus];
346336
NSImage *image = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
347337
[image addRepresentation:rep];
348338
NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
@@ -353,7 +343,7 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame
353343
NSImage *pi = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]];
354344
[returnImage lockFocus];
355345
NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y);
356-
if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"]))
346+
if(([self state] == NSOnState) && ([[self.controlView styleName] isEqualToString:@"Metal"]))
357347
indicatorPoint.y += 1.0;
358348
[pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7];
359349
[returnImage unlockFocus];

src/MacVim/gvimrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ endif
3737
set printexpr=system('open\ -a\ Preview\ '.v:fname_in)\ +\ v:shell_error
3838

3939
" askpass
40-
let $SSH_ASKPASS = simplify($VIM . '/../../MacOS') . '/macvim-askpass'
40+
let $SSH_ASKPASS = simplify($VIM . '/../../Resources') . '/macvim-askpass'
4141
let $SUDO_ASKPASS = $SSH_ASKPASS
4242

4343

0 commit comments

Comments
 (0)