Skip to content

Commit a3be996

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 5202a07 + 0727d36 commit a3be996

File tree

18 files changed

+756
-598
lines changed

18 files changed

+756
-598
lines changed

src/MacVim/MMBackend.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ extern NSTimeInterval MMBalloonEvalInternalDelay;
156156
- (BOOL)imState;
157157
- (void)setImState:(BOOL)activated;
158158

159-
- (void)addChannel:(int)idx fileDescriptor:(int)fd;
160-
- (void)removeChannel:(int)idx;
159+
- (void)addChannel:(channel_T *)channel;
160+
- (void)removeChannel:(channel_T *)channel;
161161

162162
#ifdef FEAT_BEVAL
163163
- (void)setLastToolTip:(NSString *)toolTip;

src/MacVim/MMBackend.m

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ @interface MMChannel : NSObject {
168168
CFRunLoopSourceRef runLoopSource;
169169
}
170170

171-
- (id)initWithIndex:(int)idx fileDescriptor:(int)fd;
171+
- (id)initWithChannel:(channel_T *)channel;
172172
@end
173173

174174

@@ -1684,20 +1684,17 @@ - (void)setImState:(BOOL)activated
16841684
[self flushQueue:YES];
16851685
}
16861686

1687-
- (void)addChannel:(int)idx fileDescriptor:(int)fd
1687+
- (void)addChannel:(channel_T *)channel
16881688
{
1689-
if (fd == -1)
1690-
return;
1691-
1692-
NSNumber *key = [NSNumber numberWithInt:idx];
1693-
MMChannel *channel =
1694-
[[[MMChannel alloc] initWithIndex:idx fileDescriptor:fd] autorelease];
1695-
[channelDict setObject:channel forKey:key];
1689+
NSValue *key = [NSValue valueWithPointer:channel];
1690+
MMChannel *mmChannel =
1691+
[[[MMChannel alloc] initWithChannel:channel] autorelease];
1692+
[channelDict setObject:mmChannel forKey:key];
16961693
}
16971694

1698-
- (void)removeChannel:(int)idx
1695+
- (void)removeChannel:(channel_T *)channel
16991696
{
1700-
NSNumber *key = [NSNumber numberWithInt:idx];
1697+
NSValue *key = [NSValue valueWithPointer:channel];
17011698
[channelDict removeObjectForKey:key];
17021699
}
17031700

@@ -3432,20 +3429,19 @@ static void socketReadCallback(CFSocketRef s,
34323429
void *info)
34333430
{
34343431
#ifdef FEAT_CHANNEL
3435-
int idx = (int)(intptr_t)info;
3436-
channel_read(idx, FALSE, "socketReadCallback");
3432+
channel_read((channel_T *)info, FALSE, "socketReadCallback");
34373433
#endif
34383434
}
34393435

3440-
- (id)initWithIndex:(int)idx fileDescriptor:(int)fd
3436+
- (id)initWithChannel:(channel_T *)channel
34413437
{
34423438
self = [super init];
34433439
if (!self) return nil;
34443440

34453441
// Tell CFRunLoop that we are interested in channel socket input.
3446-
CFSocketContext ctx = {0, (void *)(intptr_t)idx, NULL, NULL, NULL};
3442+
CFSocketContext ctx = {0, channel, NULL, NULL, NULL};
34473443
socket = CFSocketCreateWithNative(kCFAllocatorDefault,
3448-
fd,
3444+
channel->ch_sock,
34493445
kCFSocketReadCallBack,
34503446
&socketReadCallback,
34513447
&ctx);

src/MacVim/gui_macvim.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,15 +2242,15 @@ static int vimModMaskToEventModifierFlags(int mods)
22422242
// -- Channel Support ------------------------------------------------------
22432243

22442244
void
2245-
gui_macvim_add_channel(int idx, int fd)
2245+
gui_macvim_add_channel(channel_T *channel)
22462246
{
2247-
[[MMBackend sharedInstance] addChannel:idx fileDescriptor:fd];
2247+
[[MMBackend sharedInstance] addChannel:channel];
22482248
}
22492249

22502250
void
2251-
gui_macvim_remove_channel(int idx)
2251+
gui_macvim_remove_channel(channel_T *channel)
22522252
{
2253-
[[MMBackend sharedInstance] removeChannel:idx];
2253+
[[MMBackend sharedInstance] removeChannel:channel];
22542254
}
22552255

22562256

0 commit comments

Comments
 (0)