Sync MacVim channel code with Vim

This commit is contained in:
Kazuki Sakamoto
2016-02-20 17:49:47 -08:00
parent 937f6a1740
commit 9a00729649
5 changed files with 19 additions and 19 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ extern NSTimeInterval MMBalloonEvalInternalDelay;
- (BOOL)imState;
- (void)setImState:(BOOL)activated;
- (void *)addChannel:(channel_T *)channel which:(int)which;
- (void *)addChannel:(channel_T *)channel part:(int)part;
- (void)removeChannel:(void *)cookie;
#ifdef FEAT_BEVAL
+8 -8
View File
@@ -165,12 +165,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
@interface MMChannel : NSObject {
channel_T *channel;
int which;
int part;
CFSocketRef socket;
CFRunLoopSourceRef runLoopSource;
}
- (id)initWithChannel:(channel_T *)c which:(int)w;
- (id)initWithChannel:(channel_T *)c part:(int)p;
- (void)read;
@end
@@ -1685,10 +1685,10 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[self flushQueue:YES];
}
- (void *)addChannel:(channel_T *)channel which:(int)which
- (void *)addChannel:(channel_T *)channel part:(int)part
{
MMChannel *mmChannel =
[[MMChannel alloc] initWithChannel:channel which:which];
[[MMChannel alloc] initWithChannel:channel part:part];
return (__bridge void *)mmChannel;
}
@@ -3432,18 +3432,18 @@ static void socketReadCallback(CFSocketRef s,
[mmChannel read];
}
- (id)initWithChannel:(channel_T *)c which:(int)w
- (id)initWithChannel:(channel_T *)c part:(int)p
{
self = [super init];
if (!self) return nil;
channel = c;
which = w;
part = p;
// Tell CFRunLoop that we are interested in channel socket input.
CFSocketContext ctx = {0, (__bridge void *)self, NULL, NULL, NULL};
socket = CFSocketCreateWithNative(kCFAllocatorDefault,
channel->ch_pfd[which].ch_fd,
channel->ch_part[part].ch_fd,
kCFSocketReadCallBack,
&socketReadCallback,
&ctx);
@@ -3460,7 +3460,7 @@ static void socketReadCallback(CFSocketRef s,
- (void)read
{
#ifdef FEAT_CHANNEL
channel_read(channel, which, "MMChannel_read");
channel_read(channel, part, "MMChannel_read");
#endif
}
+2 -2
View File
@@ -2242,9 +2242,9 @@ static int vimModMaskToEventModifierFlags(int mods)
// -- Channel Support ------------------------------------------------------
void *
gui_macvim_add_channel(channel_T *channel, int which)
gui_macvim_add_channel(channel_T *channel, int part)
{
return [[MMBackend sharedInstance] addChannel:channel which:which];
return [[MMBackend sharedInstance] addChannel:channel part:part];
}
void
+7 -7
View File
@@ -300,7 +300,7 @@ add_channel(void)
channel->ch_part[part].ch_inputHandler = -1;
#endif
#ifdef FEAT_GUI_MACVIM
channel->ch_pfd[which].ch_inputHandler = 0;
channel->ch_part[part].ch_inputHandler = 0;
#endif
channel->ch_part[part].ch_timeout = 2000;
}
@@ -409,9 +409,9 @@ channel_gui_register_one(channel_T *channel, int part)
# ifdef FEAT_GUI_MACVIM
/* Tell Core Foundation we are interested in being called when there
* is input on the editor connection socket. */
if (channel->ch_pfd[which].ch_inputHandler == 0)
channel->ch_pfd[which].ch_inputHandler = gui_macvim_add_channel(
channel, which);
if (channel->ch_part[part].ch_inputHandler == 0)
channel->ch_part[part].ch_inputHandler = gui_macvim_add_channel(
channel, part);
# endif
# endif
# endif
@@ -480,10 +480,10 @@ channel_gui_unregister(channel_T *channel)
}
# else
# ifdef FEAT_GUI_MACVIM
if (channel->ch_pfd[which].ch_inputHandler != 0)
if (channel->ch_part[part].ch_inputHandler != 0)
{
gui_macvim_remove_channel(channel->ch_pfd[which].ch_inputHandler);
channel->ch_pfd[which].ch_inputHandler = 0;
gui_macvim_remove_channel(channel->ch_part[part].ch_inputHandler);
channel->ch_part[part].ch_inputHandler = 0;
}
# endif
# endif
+1 -1
View File
@@ -228,7 +228,7 @@ gui_mch_replace_dialog(exarg_T *eap);
im_set_control(int enable);
void *
gui_macvim_add_channel(channel_T *channel, int which);
gui_macvim_add_channel(channel_T *channel, int part);
void
gui_macvim_remove_channel(void *cookie);