From 9498828e29c8e8cd98661fad9df51c33d12c5c29 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Wed, 27 Jan 2016 08:53:08 -0800 Subject: [PATCH] Fix #222 --- src/channel.c | 20 +++++++++++++++++--- src/netbeans.c | 20 -------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/channel.c b/src/channel.c index f1709ac44f..acf32e6ccb 100644 --- a/src/channel.c +++ b/src/channel.c @@ -94,6 +94,9 @@ typedef struct { #ifdef FEAT_GUI_W32 int ch_inputHandler; /* simply ret.value of WSAAsyncSelect() */ #endif +#ifdef FEAT_GUI_MACVIM + int ch_inputHandler; +#endif void (*ch_close_cb)(void); /* callback invoked when channel is closed */ } channel_T; @@ -174,7 +177,7 @@ messageFromNetbeans(gpointer clientData, } #endif -#if defined(FEAT_GUI_MACVIM) +#ifdef FEAT_GUI_MACVIM static int sock_select(int s) { @@ -234,7 +237,12 @@ channel_gui_register(int idx) * Tell Core Foundation we are interested in being called when there * is input on the editor connection socket */ - gui_macvim_set_netbeans_socket(channel->ch_fd); + if (channel->ch_inputHandler == -1) { + channel->ch_inputHandler = 0; +# ifdef FEAT_NETBEANS_INTG + gui_macvim_set_netbeans_socket(channel->ch_fd); +# endif + } # endif # endif # endif @@ -282,7 +290,13 @@ channel_gui_unregister(int idx) } # else # ifdef FEAT_GUI_MACVIM - gui_macvim_set_netbeans_socket(-1); + if (channel->ch_inputHandler == 0) + { +# ifdef FEAT_NETBEANS_INTG + gui_macvim_set_netbeans_socket(-1); +# endif + channel->ch_inputHandler = -1; + } # endif # endif # endif diff --git a/src/netbeans.c b/src/netbeans.c index 945e732b93..2e7890d95e 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -67,10 +67,6 @@ static void nb_free __ARGS((void)); static int nb_channel_idx = -1; static int r_cmdno; /* current command number for reply */ -#ifdef FEAT_GUI_MACVIM -static int sock_select(int s); -#endif - static int dosetvisible = FALSE; /* @@ -132,22 +128,6 @@ netbeans_close(void) #endif } -#if defined(FEAT_GUI_MACVIM) - static int -sock_select(int s) -{ - fd_set readset; - struct timeval timeout; - - FD_ZERO(&readset); - FD_SET(s, &readset); - timeout.tv_sec = 0; - timeout.tv_usec = 0; - - return select(s + 1, &readset, NULL, NULL, &timeout); -} -#endif /* FEAT_GUI_MACVIM */ - #define NB_DEF_HOST "localhost" #define NB_DEF_ADDR "3219" #define NB_DEF_PASS "changeme"